diff options
| author | kj_sh604 | 2026-03-15 16:19:35 -0400 |
|---|---|---|
| committer | kj_sh604 | 2026-03-15 16:19:35 -0400 |
| commit | bc297e5e496d9f48ef77581b7fb41fdf328a62cf (patch) | |
| tree | 66192466eef76ee4c5cf71a9788ae9fe947514d4 /dev-docs/docs/@excalidraw/excalidraw/customizing-styles.mdx | |
| parent | f6538b8f1a78a7d72a41916ac79376f8c2d30193 (diff) | |
refactor: dev-docs/
Diffstat (limited to 'dev-docs/docs/@excalidraw/excalidraw/customizing-styles.mdx')
| -rw-r--r-- | dev-docs/docs/@excalidraw/excalidraw/customizing-styles.mdx | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/dev-docs/docs/@excalidraw/excalidraw/customizing-styles.mdx b/dev-docs/docs/@excalidraw/excalidraw/customizing-styles.mdx new file mode 100644 index 0000000..ea9073c --- /dev/null +++ b/dev-docs/docs/@excalidraw/excalidraw/customizing-styles.mdx @@ -0,0 +1,49 @@ +# Customizing Styles + +Excalidraw uses CSS variables to style certain components. To override them, you should set your own on the `.excalidraw` and `.excalidraw.theme--dark` (for dark mode variables) selectors. + +Make sure the selector has higher specificity, e.g. by prefixing it with your app's selector: + +```css +.your-app .excalidraw { + --color-primary: red; +} +.your-app .excalidraw.theme--dark { + --color-primary: pink; +} +``` + +Most notably, you can customize the primary colors, by overriding these variables: + +- `--color-primary` +- `--color-primary-darker` +- `--color-primary-darkest` +- `--color-primary-light` +- `--color-primary-contrast-offset` — a slightly darker (in light mode), or lighter (in dark mode) `--color-primary` color to fix contrast issues (see [Chubb illusion](https://en.wikipedia.org/wiki/Chubb_illusion)). It will fall back to `--color-primary` if not present. + +For a complete list of variables, check [theme.scss](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/css/theme.scss), though most of them will not make sense to override. + +```css showLineNumbers +.custom-styles .excalidraw { + --color-primary: #fcc6d9; + --color-primary-darker: #f783ac; + --color-primary-darkest: #e64980; + --color-primary-light: #f2a9c4; +} + +.custom-styles .excalidraw.theme--dark { + --color-primary: #d494aa; + --color-primary-darker: #d64c7e; + --color-primary-darkest: #e86e99; + --color-primary-light: #dcbec9; +} +``` +```tsx live +function App() { + return ( + <div style={{ height: "500px" }} className="custom-styles"> + <Excalidraw /> + </div> + ); +} +``` |
