Presets
A preset is one CSS file of token values that gives every part a new look.
A preset is a CSS file that sets tokens: colors, corners, shadows, fonts and spacing, in light and dark. Every part reads those tokens, so one preset file restyles the whole kit at once.
Astronomic UI comes with 6 presets. Pick one as a starting point, change it, or make your own.
The 6 presets
| Preset | File | The look | Fonts |
|---|---|---|---|
| Minimal | none: tokens.css alone | Ink and grays, flat cards with a hairline edge, no shadow | Geist |
| Clean | clean.css | White sheets on a gray page, crisp edges, layered shadows, one violet accent | Inter |
| Modern | modern.css | Soft and borderless: big round corners, wide soft shadows, filled text fields | Plus Jakarta Sans |
| Playful | playful.css | Hot pink and butter yellow, pill buttons and fields, a bouncy press | Bricolage Grotesque and Nunito |
| Soft | soft.css | Pill controls, round cards, roomy spacing, soft shadows | Figtree |
| Ink | ink.css | Square corners, heavy borders, hard offset shadows, serif headings | Newsreader and Libre Franklin |
Minimal is the default. It is the values in tokens.css, so you get it when you add no preset. The other files are in @astronomic-dev/ui/presets/.
Use the style switch in the top bar to see every part in each preset, in light and dark.
Use a preset
Import one preset in your site's main CSS file, after tokens.css:
@import "tailwindcss";
@import "@astronomic-dev/ui/tokens.css";
@import "@astronomic-dev/ui/theme.css";
@import "@astronomic-dev/ui/presets/soft.css";Import at most one preset. Then load the preset's fonts: see Fonts.
How a preset file works
A preset sets tokens in three blocks:
:rootholds the light values.@media (prefers-color-scheme: dark)with:root:not([data-theme="light"])holds the dark values for a reader whose system is set to dark.:root[data-theme="dark"]holds the same dark values for a reader who picked dark with the switch.
Any token the preset leaves out keeps its value from tokens.css. Here is a small preset:
:root {
--ui-accent: #6a3be0;
--ui-accent-fg: #ffffff;
--ui-radius-card: 4px;
--ui-font-display: "Fraunces", "Fraunces Variable", ui-serif, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--ui-accent: #9a7cff;
--ui-accent-fg: #170b36;
color-scheme: dark;
}
}
:root[data-theme="dark"] {
--ui-accent: #9a7cff;
--ui-accent-fg: #170b36;
color-scheme: dark;
}The two dark blocks must match. Dark mode explains why there are two.
Note
Minimal sets a few optional tokens, such as --ui-accent-hover-mix, --ui-tint and --ui-button-shadow. A preset that wants the part's own fallback instead sets that token to initial: Clean, Modern, Playful, Soft and Ink all do this for --ui-accent-hover-mix. A preset may also set its own value (Playful's --ui-tint, Clean's --ui-button-shadow) or turn a token off with none (Soft's --ui-button-shadow).
Make your own
The quickest way is Create:
- Open Create and pick the preset closest to the look you want.
- Change colors, fonts, corners and spacing. Create checks the color contrast as you go.
- Press Copy CSS. You get a full preset file in the shape above, with a comment that names the Fontsource files for its fonts.
- Paste it into your site's main CSS file, after the
@astronomic-dev/ui/tokens.cssimport. Or save it as its own file and import that instead of a kit preset.
You can also copy one of the kit's preset files into your site and edit it by hand.
Presets on this site
These are the presets the style switch offers here.
| Preset | Id |
|---|---|
| Minimal | minimal |
| Clean | clean |
| Modern | modern |
| Playful | playful |
| Soft | soft |
| Ink | ink |