Convert tinted-theming base24 color schemes to CSS themes for Basecoat UI, shadcn/ui, and Astryx.
| File | Purpose |
|---|---|
src/cli.ts |
CLI: bun src/cli.ts <scheme.yaml> [-o theme.css] [-p base0D] [-r 0.625rem] [--preview] |
src/server.ts |
Bun HTTP server on port 3001: gallery + basecoat proxy (localhost only) + CSS API + /astryx |
src/core.ts |
Shared: YAML parse, hex→oklch, CSS generation, opposite variant |
docs/gallery.html |
Self-contained browser gallery (190 schemes, live preview, CSS customizer). Served via GitHub Pages. |
docs/schemes/ |
190 base24 YAMLs for GitHub Pages. docs/schemes.json is the index. |
schemes/base24/ |
190 base24 YAMLs for the Bun dev server. |
docs/astryx/ |
Built Astryx theme POC (Vite+React, 12 schemes, defineTheme adapter) |
poc-astryx/src/mapper.ts |
base24 → defineTheme() adapter: paletteToThemeInput() |
README.md |
Full documentation |
- Only color tokens in theme output —
--radius, spacing, shadows belong to the style pack - Hex → oklch via Björn Ottosson conversion (D65, gamma 2.2), 3 decimal L/C, 0 decimal H
- Mode detection:
variantfield first, then luminance of base00 vs base07 - Opposite variant: auto-generated for the other mode (neutral swap, capped chroma)
- Primary slot: defaults to
base0D(blue), overridable via-por--primary - Schemes hosted locally — 190 YAMLs in
schemes/base24/anddocs/schemes/. No GitHub API dependency. - Basecoat CDN:
unpkg.com/basecoat-css@1.0.1(jsDelivr had 503 for this version) - Tailwind v3 vs v4 conflict: gallery uses Tailwind v3 CDN which conflicts with Basecoat v4
@layer— fix with explicit unlayered cascade rules. Browse mode uses v4 natively so no conflict.
/ docs/index.html (landing page)
/gallery docs/gallery.html (GitHub Pages ready)
/gallery?scheme=<name> gallery with specific scheme
/browse?scheme=<name> basecoatui.com proxied + theme injected (localhost only)
/browse?scheme=<name>&style=<s> same with style pack (vega/nova/…)
/theme.css?scheme=<name> raw CSS download
/theme.css?scheme=<name>&style=<s> CSS with style pack attribution
/schemes JSON list of all 190 schemes (local files)
/schemes/<name>.yaml raw YAML file (local files)
/astryx Astryx theme POC (built SPA)
/astryx/* Astryx POC assets (SPA fallback)
- Edit
docs/gallery.html— therenderPreviewfunction builds the component showcase generateCSSproduces the theme CSS,applyThemeinjects itstate.customMappingsholds CSS var → palette slot overrides- Cascade fixes are in the static
<style>block (needed for Tailwind v3 CDN)
src/server.tsline ~155:if (url.pathname.startsWith('/browse'))handler- Base tag, hx-boost stripping, resource URL rewriting are there
- Floating picker HTML + injected script (click interceptor, style switcher, theme reapply)
src/cli.ts:BASECOAT_VERSIONandBASECOAT_CDNconstantssrc/server.ts:BASECOAT_VERSIONconstantpublic/gallery.html: hardcoded CDN URLs in<link>and<script>tags
- Add explicit
background-color,color,border-colorrules for.btn,.badge,.card,.input,.select,.alertvariants - Add hover rules with
color-mix(in oklab, …) - File locations: docs/gallery.html
<style>block, src/server.tsgenerateCSSfunction
toString(16)on number literals like8.toString(16)fails — use explicit hex arrays- The basecoatui.com page resets
html.classvia JS on load — for dark schemes,generateCSSwithproxyMode=trueputs dark colors in:root sel.dispatchEvent(new Event('change'))doesn't trigger inlineonchangein all browsers<details>closes when clicking<select>inside — useonclick="event.stopPropagation()"</script>inside template literals breaks the HTML parser- Gallery
applyTheme()must be called afterselectSchemeto inject CSS GitHub API rate limits— Fixed: schemes are hosted locally indocs/schemes/andschemes/base24/. No more 429 errors.