Mordoc

Theme Toggle

Style the light/dark mode switch shown in the header.

1 MIN READ

config/styles/theme-toggle.css styles the button readers use to switch between light and dark mode.

Open the override file

Text
config/styles/theme-toggle.css

Tokens

TokenWhat it controls
--theme-toggle-sizeWidth and height of the button.
--theme-toggle-radiusCorner radius of the button.
--theme-toggle-icon-sizeSize of the sun/moon icon inside the button.
--theme-toggle-bgButton background.
--theme-toggle-bg-hoverButton background on hover.
--theme-toggle-borderButton border color.
--theme-toggle-fgIcon color.

Example theme-toggle.css

A config/styles/theme-toggle.css that sets every token on this page, for both light and dark mode:

Css
:root {
  --theme-toggle-size: 40px;
  --theme-toggle-radius: 999px;
  --theme-toggle-icon-size: 20px;
  --theme-toggle-bg: #ffffff;
  --theme-toggle-bg-hover: #f5f5f5;
  --theme-toggle-border: #e5e5e5;
  --theme-toggle-fg: #1c1c1c;
}

.dark {
  --theme-toggle-bg: #161616;
  --theme-toggle-bg-hover: #242424;
  --theme-toggle-border: #333333;
  --theme-toggle-fg: #ebebeb;
}

Next step

© 2026 MordocPowered by Mordoc