Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Cms 2.1.4 Update released for Drupal core (2.1.4)! Release: File Entity (fieldable files) 8.x-2.9 Minor update available for module file_entity (8.x-2.9). Release: Facets 3.0.6 Minor update available for module facets (3.0.6). Release: Facets 3.0.5 Minor update available for module facets (3.0.5). Release: Pantheon Advanced Page Cache 2.4.1 Minor update available for module pantheon_advanced_page_cache (2.4.1). Release: Flag 5.1.0 Minor update available for module flag (5.1.0). Release: Workbench Email 3.0.8 Minor update available for module workbench_email (3.0.8). Release: Drupal CMS Helper 2.1.4 Minor update available for module drupal_cms_helper (2.1.4). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Module Revived: ЮKassa (YooMoney) для Drupal v7 2.6.1 Module yoomoney_api updated after 7 months of inactivity (2.6.1).

Color Scheme Switcher

1 sites No security coverage
View on drupal.org

This module allows site visitors to switch between light, dark, or system-default color schemes without reloading the page. It integrates with themes and saves the user's preference locally so it persists across visits.

The Color Scheme Switcher module provides a frontend API and a ready-made block to let visitors switch between Light, System (Auto), and Dark color schemes on a Drupal 11 site — without a page reload.

Features

  • Injects an inline <style> tag early in <head> to set the CSS color-scheme property on :root, minimising flash-of-unstyled-content.
  • Adds a configurable CSS class to the <html> element (e.g. color-scheme-dark) so themes can target the active scheme with plain CSS selectors.
  • Persists the visitor's choice in localStorage so it survives page loads and hard refreshes.
  • Optionally hides elements with a "hide class" (e.g. color-scheme-only-dark) when the opposite scheme is active — useful for scheme-specific images or banners.
  • Ships a placeable block with two widget types: Buttons (one per state) and Dropdown.
  • All CSS variable names and HTML classes are configurable per active frontend theme.

Use this module when you want visitors to manually override the system color-scheme
preference and the active theme applies styles via the CSS color-scheme
property or HTML classes on <html>.

Post-Installation

  1. Go to Administration → Configuration → Color Scheme Switcher (/admin/config/cosesi/theme-settings) and configure the CSS variable name and the HTML classes for each active frontend theme.
  2. Go to Administration → Structure → Block layout and place the Color Scheme Switcher block in a region of the active theme. In the block settings choose the widget type (Buttons or Dropdown) and the per-state labels and icon sizes.
  3. Export the new cosesi.theme_settings config with the rest of the site config.

Additional Requirements

  • PHP >=8.4
  • Drupal ^11.3
  • A frontend theme that applies styles based on the color-scheme CSS property or the HTML classes configured in the module settings.

No additional modules are required.

Similar projects

  • Dark Mode Switch — provides a toggle for dark/light mode but does not expose a three-state (Light / System / Dark) API or per-theme CSS class configuration.

Known issues and limitations

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Apr 2026
Latest release
4 months ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
1.x-dev Dev 11 Apr 19, 2026
1.0.0-alpha1 Pre-release 11 Apr 19, 2026