Live Elements handles light and dark modes. You can:
By default, Live Elements loads all components in light mode.
To enable dark mode, simply add the dark
class to the page Body
:
component MyPage < PageView {
Body { classes: ['dark'] }
}
To automatically adjust to the user's system color scheme, add ColorSchemeLoader
to the page head:
import live-web-view.color
component Index < PageView {
head: PageProperties { ColorSchemeLoader {} }
}
The ColorSchemeToggleButton
lets users switch between dark and light modes.
import live-web.dom
import live-web-view.color
static any[] use = [ColorSchemeToggleButton]
ColorSchemeToggleButton{}