darkmode

Toggle website dark mode via HTML class and React component.

Updated Mar 7, 2026
One-click install
npx skills add https://github.com/Boristoka/claude-craft --skill darkmode
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: darkmode
Source: https://github.com/Boristoka/claude-craft/tree/main/.claude/skills/darkmode
Command: npx skills add https://github.com/Boristoka/claude-craft --skill darkmode

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides methods to easily implement dark mode for a website, enhancing user experience and accessibility, especially in low-light conditions.

Core Features & Use Cases

  • Manual Dark Mode: Apply a dark class to the <html> element for a permanent dark theme.
  • Auto Dark Mode: Use dark-auto to follow the user's system preference.
  • Toggle Component: Implement a user-facing button to switch between light and dark modes dynamically.
  • Use Case: A SaaS application can use this skill to offer users a choice in theme, reducing eye strain during late-night usage and personalizing the interface.

Quick Start

Add the 'dark' class to the <html> element in app/layout.tsx.

Frequently Asked Questions about darkmode

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply dark mode to my website using CSS variables?

Implement automatic dark mode by using the 'dark-auto' class, which detects the user's system preference. This allows your website to dynamically match the operating system theme settings without manual toggling.

Can I use a React component to let users toggle dark mode manually?

Yes, you can use a client-side React component to provide a user-facing toggle button. This component dynamically switches between light and dark themes by manipulating the HTML element's class attribute.

How do I make dark mode preferences persist for returning users?

Persist dark mode preferences by utilizing the browser's localStorage. This ensures that a user's theme choice is saved and automatically applied on subsequent visits to the website.

Does this dark mode implementation require external dependencies?

No, this dark mode implementation requires no external dependencies. It operates by directly modifying the HTML element's class attribute and utilizing native browser features like localStorage and CSS variables.