systemPreference

Returns the system color preference (which represents the user's device color preference).

It can be useful to set this as your site's initial color mode:

@InitSilk
fun updateTheme(ctx: InitSilkContext) = ctx.config.apply {
initialColorMode = ColorMode.systemPreference
}

as otherwise, the initial color mode will simply default to ColorMode.LIGHT.

NOTE: Following the guidelines set out by the CSS Working Group, this value will assume light mode as a default fallback. (Originally, browsers supported a "no-preference" option but that has since been removed from the spec.)