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