Skip to content

Commit

Permalink
Merge branch 'main' into vite
Browse files Browse the repository at this point in the history
  • Loading branch information
robintown committed Feb 8, 2024
2 parents 691db3a + 4c182b9 commit f2ff3e9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"vite": "^5.0.12"
},
"dependencies": {
"@vector-im/compound-design-tokens": "https://github.com/vector-im/compound-design-tokens#0.1.0",
"@vector-im/compound-design-tokens": "github:element-hq/compound-design-tokens#semver:^1.0.0",
"deepmerge": "^4.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
23 changes: 23 additions & 0 deletions stories/develop/Theming.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Meta } from "@storybook/addon-docs";

<Meta title="Develop/Theming" />

# Theming

The default set of design tokens provided by Compound contains some choices specific to Element's brand, which our users and customers may want to change to meet their needs. For this reason we allow Compound to be themed with custom sets of semantic tokens.

## Web

On Web, you can override any semantic token by redefining that token in the `custom` [cascade layer](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Cascade_layers) provided by the [design tokens package](https://github.com/vector-im/compound-design-tokens/tree/develop/assets/web). This example demonstrates how you would change the `color.icon.accent-tertiary` token to blue, rather than Element's default green:

```css
@import "@vector-im/compound-design-tokens/assets/web/css/compound-design-tokens.css" layer(compound);

@layer compound.custom {
:root, [class*="cpd-theme-"] {
--cpd-color-icon-accent-tertiary: var(--cpd-color-blue-800);
}
}
```

As long as you use the provided layer, this ensures that future internal changes to the package will not cause conflicts in selector specificity.
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3911,9 +3911,9 @@
"@typescript-eslint/types" "5.59.5"
eslint-visitor-keys "^3.3.0"

"@vector-im/compound-design-tokens@https://github.com/vector-im/compound-design-tokens#0.1.0":
version "0.0.7"
resolved "https://github.com/vector-im/compound-design-tokens#920f164856a586e7d3bbb1c0e4fd0107de381e33"
"@vector-im/compound-design-tokens@github:element-hq/compound-design-tokens#semver:^1.0.0":
version "1.0.0"
resolved "https://codeload.github.com/element-hq/compound-design-tokens/tar.gz/e7fb20f8d38821a7c3082d26d2f0f097731d776c"
dependencies:
svg2vectordrawable "^2.9.1"

Expand Down

0 comments on commit f2ff3e9

Please sign in to comment.