Correct from first paint
The inline head script applies the stored or system scheme before the stylesheet renders.
Search 71 components and 72 controllers by name, category or description.
Color scheme
Light, dark and system modes that persist, stay in sync across tabs and apply before the first paint.
Features
The inline head script applies the stored or system scheme before the stylesheet renders.
A visitor's choice persists across navigation and stays aligned across toggles and browser tabs.
System mode follows prefers-color-scheme and reacts when the OS preference changes.
Installation
Put the script in <head>, before @vite, so the preference
is resolved before the stylesheet can paint.
{{-- resources/views/components/layouts/app.blade.php --}}
<head>
<hw:color-scheme.script />
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
Place the toggle in a header, menu, or settings screen. Multiple toggles share the same preference automatically.
{{-- Anywhere inside <body> --}}
<hw:color-scheme.toggle
aria-label="Toggle color scheme"
tooltip="Toggle color scheme"
/>
No controller registration or custom storage code is required. The default mode is
system, and the toggle cycles through light dark system.
Configuration
modes
Controls the available modes and their cycle order.
default
Sets the fallback when no valid preference is stored.
view-transition
Adds a progressive cross-fade when the scheme changes.
Use all three modes for preference-aware interfaces, or limit the cycle to a direct light/dark toggle. Changes synchronize with the toggle in the top bar.
Three-mode cycle
Light, dark, and system
Two-mode cycle
Light and dark only
<div class="flex flex-wrap items-center gap-6">
<div class="flex items-center gap-3">
<hw:color-scheme.toggle
modes="light dark system"
view-transition
tooltip="Light, dark, or system"
tooltip-side="top"
aria-label="Cycle color scheme"
/>
<span class="text-sm">Three-mode cycle</span>
</div>
<div class="flex items-center gap-3">
<hw:color-scheme.toggle
modes="light dark"
view-transition
variant="secondary"
size="lg"
aria-label="Toggle dark mode"
>
Switch theme
</hw:color-scheme.toggle>
<span class="text-sm">Light and dark only</span>
</div>
</div>
The colors of each mode come from your theme tokens. Tune both in the Theme Lab.
If you customize storage-key or default, pass the same values to
<hw:color-scheme.script> and every
<hw:color-scheme.toggle>.
The Task manager combines components, controllers, frames, streams and overlays in one workflow.