Shilpi Color Modes: Dark Mode, Light Mode & Color Switcher

By Mojibur Rahman

0+ active installationsVersion 1.0.0

Dark mode and light mode toggle for any theme or page builder. Swap your exact brand colors, follow the device setting, no color inversion.

Description

Shilpi Color Modes adds a real dark mode (or light mode) to any WordPress site, built from your own colors.

Most dark mode plugins invert or filter your colors automatically. That often breaks logos, photos, gradients and brand colors, and the result looks cheap. Shilpi Color Modes works the other way: you choose exactly which color replaces which. Your background #FFFFFF becomes #0F1318, your brand blue becomes a lighter blue that reads well on dark, and everything else stays as you designed it.

It works with any theme and any page builder, because it changes colors on the finished page: theme CSS, Elementor and Gutenberg global colors, CSS variables, inline styles and SVG icons.

Main features

  • Exact color swap, no inversion. Make a list of color pairs (your color on the left, its replacement on the right).
  • Color scanner. Scan any page of your site with one click and see every color used, sorted by how often it appears. Click a color to add it.
  • Import your palette. One-click import of Elementor Global Colors and the theme.json (block theme) palette.
  • Smart suggestions. Every color gets a suggested dark or light counterpart that keeps the same hue. Accept it or pick your own.
  • Contrast check. Each text color shows its WCAG contrast ratio in the new mode, so you can fix colors that would be hard to read.
  • Works from light to dark, or dark to light. Tell the plugin which mode your design is in, and it creates the other one.
  • Automatic mode. Follows the visitor’s device setting (prefers-color-scheme) and switches live when the device changes.
  • Dark mode toggle, five ways. Floating switch, shortcode, “Dark Mode Toggle” Gutenberg block, “Dark Mode Toggle” Elementor widget, and a menu item.
  • Three toggle styles. Switch, icon, or icon with text. Choose size, position, offsets and labels.
  • Toggle and device together. Visitors can switch with the toggle at any time, and the site still follows the device when its light/dark setting changes.
  • Smart memory (optional). Turn it on to keep a visitor’s toggle choice for future visits. It still gives way to the device as soon as the device setting changes.
  • No flash of the wrong colors. A tiny script sets the mode before the page paints.
  • Beautiful switch effect. When a visitor clicks the toggle, the new mode spreads out in a circle from the toggle (or a soft fade). The whole page changes at once, with no flicker.
  • Utility classes for anything else:
    • scm-show-light: visible only in light mode (for example a dark logo).
    • scm-show-dark: visible only in dark mode (for example a white logo).
    • scm-no-swap: the element keeps its original colors in both modes.
  • Dim images in dark mode (optional), with a class to skip single images.
  • Exclusions by page ID, post type or CSS selector.
  • Import and export your settings as JSON to reuse them on client sites.
  • Cache friendly. Works with page caching and keeps its small script out of JS delay and defer features of popular optimization plugins.
  • Developer friendly. html[data-color-mode="dark"] CSS hook, scm:change JavaScript event, ShilpiColorModes.set( 'dark' ) API, and PHP filters.

Works with

Elementor, Gutenberg and block themes (Full Site Editing), Divi, Bricks, Breakdance, Oxygen, Beaver Builder, WPBakery, Shilpi, Astra, Kadence, GeneratePress, Hello Elementor, WooCommerce and custom HTML pages. Page builder editors always show your original design.

How to add dark mode to your site

  1. Go to Appearance > Color Modes.
  2. Choose whether your current design is light or dark.
  3. Open the Colors tab and click Scan page.
  4. Click the colors you want to change. A matching color for the other mode is suggested for each one.
  5. Mark your page background color, check the contrast badges, and save.
  6. Preview with the Preview dark and Preview light buttons.

Made by Shilpi Builder.

Installation

  1. Install the plugin from Plugins > Add New (search for “Shilpi Color Modes”) or upload the zip file.
  2. Activate it.
  3. Go to Appearance > Color Modes and follow the setup checklist.

FAQ

How do I add a dark mode toggle to my WordPress site?

Turn on the floating toggle in Appearance > Color Modes > Toggle, or place it yourself with the [shilpi_color_toggle] shortcode, the “Dark Mode Toggle” block, the “Dark Mode Toggle” Elementor widget, or a menu location.

How do I add a dark mode toggle in Elementor?

Search for “Dark Mode Toggle” in the Elementor widget panel and drag it into your header or any section.

My site is already dark. Can I add a light mode?

Yes. Choose “Dark design” in the Overview tab. The plugin then creates the light mode from your color pairs.

Does it invert my colors or images?

No. Only the colors you list are replaced. Images are never inverted. You can optionally dim photos a little in dark mode.

How do I show a different logo in dark mode?

Add both logos next to each other. Give the normal logo the class scm-show-light and the white logo the class scm-show-dark. In Elementor use Advanced > CSS Classes. Only the logo for the active mode is shown.

Can I keep one section exactly as it is?

Yes. Add the class scm-no-swap to it, or list its selector under Advanced > Exclusions. Note that hover colors and ::before / ::after decorations inside that section can still change if they use a swapped color.

Can visitors choose automatic mode that follows their phone or computer?

Yes. Set “Visitors see first” to Automatic. The toggle works at any time. By default a toggle choice lasts while the visitor browses your site; turn on Smart memory to keep it for future visits. Either way, if the device later switches between light and dark (for example a phone that turns dark at night), the site follows the device again. This smart memory means visitors never get stuck in the wrong mode.

Will it slow down my site?

No. The bootstrap script is under 1 KB, the engine is a small file loaded in the footer, and there are no external requests.

Does it work with caching plugins?

Yes. The mode is chosen in the browser, so cached pages work. The plugin also excludes its tiny head script from JS delay and defer in WP Rocket, LiteSpeed Cache, Autoptimize, Perfmatters and SiteGround Optimizer.

Some colors are not changing. What can I do?

Scan the page again and add the missing color. If your theme uses many slightly different shades, raise the “Color matching tolerance” slider in the Colors tab. Stylesheets loaded from another domain are swapped too when that server allows it.

How do I preview a mode without the toggle?

Add ?color-mode=dark or ?color-mode=light to any URL on your site.

Is there a JavaScript API?

Yes. ShilpiColorModes.get(), ShilpiColorModes.set( 'dark' ), ShilpiColorModes.toggle() and ShilpiColorModes.reset(). Listen for changes with document.addEventListener( 'scm:change', function ( e ) { console.log( e.detail.mode ); } ).

Screenshots

Changelog

1.0.0

  • First public release.