🛠️ API Documentation

🌑 Darkness as a Service API v2.0

Professional dark mode styling for modern web applications. Now with comprehensive CSS frameworks, multiple intensity levels, and developer-friendly features.

✨ What's New in v2.0

  • 🎨 **Framework Integration**: Bootstrap, Tailwind CSS support
  • 🌙 **Multiple Levels**: Soft, Hard, Midnight intensity options
  • 🎯 **Scoped Styling**: Apply dark mode to specific containers
  • ⚡ **Enhanced Performance**: Optimized CSS with CSS variables
  • 🔧 **Developer Experience**: Better error handling and metadata

🔗 /api/darken

Get comprehensive dark mode CSS for your applications with full customization options.

Request Parameters

Parameter Type Default Description
format string json Response format: json or css
framework string basic CSS framework: basic, comprehensive, bootstrap, tailwind
level string hard Darkness intensity: soft, hard, midnight
scope string null CSS selector to scope styles (e.g., .my-app)

Framework Options

basic
Essential dark mode CSS with CSS variables for common elements
comprehensive
Complete dark theme including modals, dropdowns, tables, and advanced components
bootstrap
Bootstrap-compatible dark mode with proper variable overrides
tailwind
Tailwind CSS dark utilities and custom properties

Level Options

soft
Gentle dark theme with gray backgrounds (#1a1a1a primary)
hard
Pure black backgrounds for maximum darkness (#000000)
midnight
Deep navy theme for late-night usage (#0f1419)

Response (JSON Format)

{
  "status": "dark",
  "css": "/* Complete dark mode CSS */",
  "meta": {
    "version": "2.0.0",
    "darkest": true,
    "framework": "comprehensive",
    "level": "hard",
    "scope": null,
    "generated": "2024-01-15T10:30:00.000Z"
  },
  "usage": {
    "css": "/api/darken?format=css&framework=comprehensive&level=hard",
    "json": "/api/darken?framework=comprehensive&level=hard"
  }
}

Usage Examples

🌐 Direct CSS Link (Recommended)
<!-- Basic dark mode -->
<link rel="stylesheet" href="https://darkestmode.com/api/darken?format=css" />

<!-- Bootstrap dark mode -->
<link rel="stylesheet" href="https://darkestmode.com/api/darken?format=css&framework=bootstrap" />

<!-- Scoped to specific container -->
<link rel="stylesheet" href="https://darkestmode.com/api/darken?format=css&scope=.my-app" />
📜 JavaScript Implementation
// Fetch and apply comprehensive dark mode
fetch('https://darkestmode.com/api/darken?framework=comprehensive&level=soft')
  .then(response => response.json())
  .then(data => {
    const style = document.createElement('style');
    style.textContent = data.css;
    document.head.appendChild(style);
    console.log('Professional dark mode applied! 🌑');
  });

// Apply to specific element only
fetch('https://darkestmode.com/api/darken?scope=.dashboard')
  .then(response => response.json())
  .then(data => {
    const style = document.createElement('style');
    style.textContent = data.css;
    document.head.appendChild(style);
  });
⚛️ React Integration
import { useEffect } from 'react';

function DarkModeProvider({ children }) {
  useEffect(() => {
    fetch('https://darkestmode.com/api/darken?framework=comprehensive')
      .then(res => res.json())
      .then(data => {
        const style = document.createElement('style');
        style.textContent = data.css;
        document.head.appendChild(style);
      });
  }, []);

  return children;
}
🎨 CSS Framework Examples
Bootstrap Integration
<!-- Load Bootstrap first -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">

<!-- Then apply dark mode -->
<link rel="stylesheet" href="https://darkestmode.com/api/darken?format=css&framework=bootstrap">

<!-- Your Bootstrap components will now be dark -->
<div class="bg-light text-dark p-3">This will be dark!
Tailwind CSS Integration
<!-- Load Tailwind -->
<script src="https://cdn.tailwindcss.com">

<!-- Apply dark utilities -->
<link rel="stylesheet" href="https://darkestmode.com/api/darken?format=css&framework=tailwind">

<!-- Use Tailwind dark classes -->
<div class="dark:bg-gray-900 dark:text-white p-4">
  This adapts to dark mode!
</div>

Features

📊 /api/status

Check the operational status and statistics of Darkness as a Service.

Request

GET /api/status

Response

{
  "status": "operational",
  "uptime": 1234567,
  "darkness": "permanent",
  "sla": "99.999%",
  "photonsPrevented": 12345678,
  "api": {
    "version": "2.0.0",
    "requests": 987654,
    "darknessApplied": 876543
  }
}

🚀 Quick Start

Want to add professional darkness to your site in under 60 seconds?

Try It Live

Or Enable Dark Mode on This Site