MCPcopy Create free account
hub / github.com/adobe/react-spectrum / colorValue

Function colorValue

packages/@adobe/react-spectrum/src/utils/styleProps.ts:177–183  ·  view source on GitHub ↗
(value: ColorValue, type: ColorType = 'default', version = 5)

Source from the content-addressed store, hash-verified

175
176type ColorType = 'default' | 'background' | 'border' | 'icon' | 'status';
177function colorValue(value: ColorValue, type: ColorType = 'default', version = 5) {
178 if (version > 5) {
179 return `var(--spectrum-${value}, var(--spectrum-semantic-${value}-color-${type}))`;
180 }
181
182 return `var(--spectrum-legacy-color-${value}, var(--spectrum-global-color-${value}, var(--spectrum-semantic-${value}-color-${type})))`;
183}
184
185function backgroundColorValue(value: BackgroundColorValue, version = 5): string | undefined {
186 if (!value) {

Callers 2

backgroundColorValueFunction · 0.85
borderColorValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected