Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions packages/docs/src/pages/color-modes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,44 @@ be accessible as

## Colors Object

The `colors` object contains Custom CSS Properties
The `colors` object can contain plain hex color like:

``` js
{
colors: {
text: '#000', // black, use 'text' in sx prop.
background: 'white', // use 'background' in sx prop.
}
}
```

The `colors` object can contain Custom CSS Properties

```js
{
colors: {
text: 'var(--theme-ui-colors-text)',
background: 'var(--theme-ui-colors-background)',
primary: 'var(--theme-ui-colors-primary)',
text: 'var(--theme-ui-colors-text)', // use 'text' in sx prop.
background: 'var(--theme-ui-colors-background)', // use 'background' in sx prop.
primary: 'var(--theme-ui-colors-primary)', // use 'primary' in sx prop.
}
}
```

And the `colors` object also can contain array or object:
{
colors: {
text: {
__default: 'black', // use 'text' in sx prop.
danger: 'red', // use 'text.danger' in sx prop.
warning: 'yellow', // use 'text.warning' in sx prop.
},
background: [
'red', // use 'background' or 'background.0' in sx prop.
'white', // use 'background.1' in sx prop.
]
}
}

## rawColors Object

If you need to pass original value somewhere where CSS Properties (e.g. WebGL
Expand Down