Skip to main content

Color.dynamic

It would be useful to have a built-in Color.dynamic(light, dark) method for scripts. Right now only system colours (Color.label() and friends) adapt to light and dark modes, creating custom colors that have the same bahaviour requires manual workarounds (setting the .variants afterwards), for example:

function dyn(light, dark) {
    var c = Color.hex(light);
    c.variants = { light: Color.hex(light), dark: Color.hex(dark) };
    return c;
}

A clean helper function where both inputs can take either hex strings or color objects would make designing widgets and UI elements for both appearances easier and more intuitive

Status: Planned

Log in to comment and vote

No comments yet

Be the first to share your thoughts.