Tokens
The few values every component shares: the colours, the border width and the radius. Redeclare one and the whole kit follows.
How tokens work
Each token is a --margo-* custom property, and the components read it directly. To change one, redeclare it after the kit's import:
css
/* after @import "margo-ui/css" */
:root {
--margo-color-primary: #4f8cff;
--margo-color-primary-darken: #2f6ad9;
--margo-radius: 0.75rem;
}
.dark {
--margo-color-primary: #7aa9ff;
--margo-color-primary-darken: #4f8cff;
}Colours
Colours are named by role, not by hue: main is the page, on-main is what sits on it.
| token | value | |
|---|---|---|
--margo-color-main | #f3f3f3light#151515dark | page background |
--margo-color-on-main | #151515light#f3f3f3dark | text and icons on main |
--margo-color-neutral | #fffffflight#000000dark | the far end of the theme: white in light, black in dark |
--margo-color-on-neutral | #000000light#ffffffdark | text and icons on neutral |
--margo-color-primary | #9c0ea3light#57e550dark | the accent: active and focused states, glows |
--margo-color-primary-darken | #7d0b82light#45b93fdark | the darker accent, and the other end of primary gradients |
--margo-color-low | on-main 3.5% in mainlighton-main 2.5% in maindark | quiet fills, like the background of Item and Input |
--margo-color-low-alpha | on-main 3.5%, translucentlighton-main 2.5%, translucentdark | the same fill, for surfaces other than main |
--margo-color-medium | #808080light#999999dark | muted text and icons at rest |
--margo-color-border | #cececelight#2c2c2cdark | borders |
Border and radius
There is one border width and one radius. The kit derives three smaller corners from the radius, so changing it moves every corner and keeps the proportions.
| token | value | |
|---|---|---|
--margo-border | 1.5px | the width of every border in the kit |
--margo-radius | 0.5rem | the largest corner; the smaller ones follow |
--margo-radius-sm | 0.375rem | radius × 3/4; derived |
--margo-radius-xs | 0.25rem | radius / 2; derived |
--margo-radius-mc | 0.125rem | radius / 4; derived |
Light and dark
The light values are declared on :root, the dark ones on .dark. Components turn dark when .dark is on them or on an ancestor, usually the html element. When you change a colour, change it in both blocks.