Modifying
Sizing uses em so it can be resized by changing the css font-size. Base color for text, knob, and track border uses currentColor so it will update if you
change the body text color.
The layout and knob-width properties
Further restyling is possible via slots, parts, and css variables. Properties allows changing defaults and values for changing meta theme-color.
Default Slots
Slots are dynamically named after the theme names.
Default Parts
- light
- auto
- dark
- track
- knob
Label Parts are dynamically named after the theme names.
CSS Color Variables
- --theme-switch-knob
background: var(--theme-switch-knob, currentColor);
- --theme-switch-track
background: var(--theme-switch-track, #88888822);
- --theme-switch-track-border
border: 0.1em solid var(--theme-switch-border, currentColor);
- --theme-switch-highlight
color: var(--theme-switch-highlight, inherit);
- --theme-switch-knob-width
width: calc(var(--theme-switch-knob-width, 1) * 1em);
Properties
- themes = "light,auto,dark"
- theme = defaults to themes[1]
- meta-colors = ""
- layout = "around top"
themes and meta-colors accepts either a comma separated string or a stringified JSON array
layout can be either "around top", "around bottom", or just "top" or "bottom"