Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

Create an Astro UI theme

Use the Gnostic theme generator to choose a style, brand colors, font, and radius. Export a complete preset for shadcn installation in Astro.

Open the theme generator to compare Default, Glow, Soft, Graphite, and all eight shadcn styles. A style controls component design. A palette controls colors. A saved theme records both choices. Templates supply page layouts and content separately. Open Design in the header to change the docs and examples. Preset applies a complete named design, including colors, fonts, and radius. Style groups component styles under Gnostic and shadcn. A style change keeps the current color system and explicit font and radius choices. Import a shadcn code to use its complete preset and color controls.

Font and radius settings start at Style default. This uses the selected style’s defaults. None, Small, Medium, and Large show their base values and replace the style’s radius scale. Large can be smaller than the default for a rounded style such as Soft. Each style selects its component radius classes: Luma buttons use rounded-4xl, while Gnostic buttons use rounded-lg. Vertical Tabs keep a maximum corner radius of 1rem.

Workspace

Make room for good work.

Use an exported theme

Save the theme JSON, then generate a site from this workspace:

bun run gnostic create ../my-site --template sable --preset ./my-theme.json --yes

Or select a complete preset from the catalog:

bun run gnostic create ../my-site --template sable --preset earth --yes

Choose colors

Gnostic presets use a base tint plus primary, secondary, card, and background. Choose a Tailwind shade or enter an OKLCH color. The remaining semantic colors come from these inputs and the Coss light/dark rules. Missing inputs use generated defaults. Primary, secondary, background, and card edits affect the current mode only. The other mode keeps its generated colors or saved overrides. Use the Dark mode switch at the top of the Design menu to edit the other mode. Reset removes the current mode’s override and restores its generated color.

Add a JSON file in packages/themes/presets/ to create a catalog preset. The normal registry build discovers it. The file contains name, label, style, colors, and optional font, radius, and menu settings. It does not contain site routes or block selections. The generated schema supplies editor completion.

Use the shadcn CLI

Copy the command from Keep your theme on the generator page. It uses a short preset URL in an existing Astro project. For example:

bunx --bun shadcn@latest init --preset https://ui.gnosticai.com/p/b2fA

Then add components

bunx –bun shadcn@latest add @gnostic/button

The preset installs Astro styles and sets the registry in components.json. Keep that registry URL: it preserves your selected recipe during component updates. Follow the printed Tailwind setup instructions and import src/styles/tailwind.css in your layout.

Design can also import a shadcn short code. Supported codes use Lucide icons, the default menu color, and a color in the supplied shadcn data. A matching code is shown when it can retain every design choice. Both a and b code versions are supported. The short Gnostic URL uses that official code when possible. Catalog presets can use a named URL such as /p/n-soft. Custom Gnostic palettes and style-default fonts use a saved preset ID. Saved IDs keep the complete preset and do not change when you edit the current preview. A plain shadcn code by itself does not select the Gnostic Astro registry; use the generated URL to install it. Earlier JSON preset URLs still work.

Run bun run gnostic create for guided setup. Add --dry-run to a command to list the changes without writing files. The CLI is available from this private workspace; it is not yet an npm package.

Apply a theme to an existing site

The project needs Astro, Gnostic registry base styles, and components.json. Apply changes color, font, and radius tokens within the installed component style. The requested style must match components.json. To change component classes, use the generated shadcn init --preset <url> --reinstall command after you review local component edits. Then apply the token settings. Run these commands from this workspace:

bun run gnostic theme check ./my-theme.json
bun run gnostic theme apply ./my-theme.json --cwd ../my-site --dry-run
bun run gnostic theme apply ./my-theme.json --cwd ../my-site

The CLI adds gnostic-theme.css beside the configured global stylesheet and imports it after the layout’s other imports. It sets the layout’s preset boundary to the installed style. Presets also update the configured registry URL so later component installs use the same settings. When several document layouts exist, add --layout src/layouts/site.astro. This path is relative to the target project. The theme file path is relative to the directory where you run the command.

Commit the .gnostic/ folder with your theme. It records the applied recipe and file hashes. The CLI stops before replacing a managed file with local edits. Component files, content, and base styles stay intact. New generated templates share the style through src/lib/theme.ts. Explicit preset props in other sites keep their value. A computed HTML preset boundary requires manual setup.

Export token CSS

bun run gnostic theme export ./my-theme.json --out ./my-theme.css

Check, apply, and export accept JSON, a built-in preset such as earth, a supported shadcn code, or a Gnostic preset URL. Export writes CSS to stdout when --out is absent. Add --format json to export normalized JSON. Use the CSS export to merge local theme edits manually.

To use the CSS export manually, import it after src/styles/tailwind.css. The file contains color, font, and radius tokens. It does not change the utility classes in installed components. Use an export with the same component style as the installed preset. To change component styles, use the preset installation command and review the resulting source changes.

The docs shell, controls, examples, and overlays use the selected preset. Fixed comparison samples and full template previews keep their assigned presets. The site light/dark toggle controls both the documentation and the examples.