prefers-color-scheme

Since UXP v4.1

Enables you to restrict a set of CSS rules to match only when a specific theme is being used by the host application.

Value
Ps
Xd
lightest
*
light
medium
dark
darkest

* XD only supports a single theme. This wll match the "lightest" theme in XD 35.

Example

:root {
    --primary-color: #E8E8E8; /* default colors are for dark themes */
}
@media (prefers-color-scheme: lightest), (prefers-color-scheme:light) {
    :root {
        --primary-color: #181818; /* override for light themes */
    }
}

Known Issues