Skip to content
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

[pigment-css][docs] Adjust the bit about CSS vars on the README #41463

Merged
merged 1 commit into from
Mar 12, 2024
Merged
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
38 changes: 19 additions & 19 deletions packages/pigment-css-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,25 @@ console.log(theme.colors.primary); // 'tomato'
console.log(theme.vars.colors.primary); // 'var(--colors-primary)'
```

#### Adding a prefix to CSS variables

You can add a prefix to the generated CSS variables by providing a `cssVarPrefix` option to the `extendTheme` utility:

```jsx
extendTheme({
cssVarPrefix: 'pigment',
});
```

The generated CSS variables will have the `pigment` prefix:

```css
:root {
--pigment-colors-background: #f9f9f9;
--pigment-colors-foreground: #121212;
}
```

#### Color schemes

Some tokens, especially color-related tokens, can have different values for different scenarios. For example in a daylight condition, the background color might be white, but in a dark condition, it might be black.
Expand Down Expand Up @@ -573,25 +592,6 @@ const Heading = styled('h1')(({ theme }) => ({
}));
```

#### CSS variables prefix

You can add a prefix to the generated CSS variables by providing a `cssVarPrefix` option to the `extendTheme` utility:

```jsx
extendTheme({
cssVarPrefix: 'pigment',
});
```

The generated CSS variables will have the `pigment` prefix:

```css
:root {
--pigment-colors-background: #f9f9f9;
--pigment-colors-foreground: #121212;
}
```

#### TypeScript

To get the type checking for the theme, you need to augment the theme type:
Expand Down
Loading