Phox Elements
DARK MODE Dark mode switch for Breakdance

Let visitors switch your site to dark mode

Dark Mode Toggle adds a switch that swaps your site's global colours for a dark set. You choose the dark colours once in Global Settings. The visitor's choice is saved, so dark mode stays on as they move between pages.

Colours set in Global Settings Remembers the visitor's choice Multiple toggles stay in sync
Live demos

Flip any switch to try dark mode

Every switch on this page is a Dark Mode Toggle, and they all stay in step. The mini site and the colour chips use the global colours, so they change when you flip a switch. Your choice is saved, so it is still set when you reload the page.

Page preview

Flip the switch in this mini site header

Show Labels on with Light and Dark labels, a lilac track and a purple active track. The mini site below is coloured with the global brand, headings, links, text and background colours, so it changes with the switch.

Light Dark
Open today 8:00 to 16:00

Breakfast by the harbour, every day of the week

Fresh sourdough from the bakery next door, eggs from a farm up the hill and coffee roasted in town. Sit in, take away or order ahead for collection.

See the menuOpening times →
  • Smoked salmon and eggs£9.75
  • Buttermilk pancakes£7.50
  • Porridge with oat milk£5.25
Switch styles

Three toggles, one setting

Each toggle below has its own track, handle and label settings. They share one cookie, so flipping any of them flips the rest.

Light Dark
Plain switchLabels off. A slate track that turns navy, and a white handle that turns amber.
Light Dark
Labelled switchShow Labels on with Light and Dark in 14px text.
Day Night
Day and nightCustom label text, an amber track and a deep blue track when on.
What it swaps

The five colours set in Global Settings

Each chip is filled with one of the colour variables the toggle changes. Flip any switch on this page and watch them change.

Brand--bde-brand-primary-color
Headings--bde-headings-color
Links--bde-links-color
Text--bde-text-color
Background--bde-background-color
How it works

Three steps to dark mode

Set the colours once, then place the switch wherever you like.

1

Set your dark colours

In Breakdance Global Settings, open the Dark Mode Colors tab and choose the brand, headings, links, text and background colours.

2

Place the toggle

Drop Dark Mode Toggle into your header, footer or any page.

3

Visitors switch

When a visitor flips the switch, the dark colours replace your global colours across the page.

Features

What the toggle does

A small switch that changes your site's global colours.

Five global colours

Swap the brand, headings, links, text and background colours for your dark set.

Set once, used site-wide

The dark colours live in Global Settings, so every toggle on your site uses the same set.

Remembers the choice

The visitor's choice is saved in a cookie for 30 days and applied on every page that has a toggle.

Toggles stay in sync

Place a toggle in the header and another in the footer. Flip one and the other follows.

Optional labels

Show text labels either side of the switch, such as Light and Dark, and style their typography.

Switch colours

Set the track and handle colours for both the on and off states.

Use cases

Where it works best

Anywhere visitors read for a while or browse at night.

01

Blogs

Give readers a darker page that is easier on the eyes in the evening.

02

Documentation

Let developers read docs in the dark style many of them prefer.

03

Portfolios

Offer a dark version that shows off photos and artwork.

04

SaaS sites

Match the dark mode your app already offers.

05

Headers and footers

Put the switch in a global header so it is on every page.

06

Accessibility options

Give visitors more control over how your site looks.

Settings reference

Every control, explained

The element settings and the Dark Mode Colors tab in Global Settings, with their default values.

ControlWhat it doesDefault
Content
Label Text OffText shown on the light side of the switch.Light
Label Text OnText shown on the dark side of the switch.Dark
Design
Show LabelsShow or hide the text labels.Off
Inactive Background ColorTrack colour when dark mode is off.—
Active Background ColorTrack colour when dark mode is on.—
Handle Inactive ColorHandle colour when dark mode is off.—
Handle Active ColorHandle colour when dark mode is on.—
TypographyText style for the labels.—
Global Settings: Dark Mode Colors
Brand ColourBrand colour used in dark mode.#000000
Headings ColourHeading colour used in dark mode.#333333
Links ColourLink colour used in dark mode.#0066CC
Text ColourBody text colour used in dark mode.#222222
Background ColourPage background used in dark mode.#FFFFFF
Tips & FAQ

Good to know

Where do I set the dark mode colours?

In Breakdance Global Settings, under the Dark Mode Colors tab. The toggle needs these colours set to have any effect.

I cannot see the Dark Mode Colors tab. Where is it?

The tab only appears when Dark Mode Colors is switched on in the Features tab of the Phox Elements settings. It is off by default.

Why does nothing change when I flip the switch?

The toggle swaps Breakdance's global colours. Check you have set dark colours in Global Settings, and that your elements use the global colours rather than fixed colours.

Does it remember the visitor's choice?

Yes. The choice is saved in a cookie for 30 days, so dark mode stays on across pages and return visits.

Can I have more than one toggle on a page?

Yes. Every toggle on the page stays in sync, so flipping one updates the others.

Can I style the switch?

Yes. Set the track and handle colours for the on and off states, and turn on labels if you want text either side.

Add Dark Mode Toggle to your next page

Dark Mode Toggle is included with Phox Elements, along with 140+ other premium elements for Breakdance.