@mocanvas/editor · function

getColorValue

declare function getColorValue(colors: TLThemeColors, name: DefaultColorStyle$1 | (string & {}), variant?: TLDefaultColorVariant): string

One value out of a ramp: the paint a given colour name gets for a given variant.

This is the accessor a UI should use to preview a colour, because it reads the ramp the editor is *currently* painting with (theme.colors[editor.getColorMode()]) rather than a snapshot of one. Unknown names fall back to black, so a stale persisted colour previews as ink rather than as undefined.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.