Skip to content

docs(color-modes): Add document about color value can be obj/arr/hex. #2128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
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