restructure theme css
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
Dark mode: `dark:` as a CLASS, not a media query.
|
||||
kjol-website — brand stylesheet for the Kjol Go/WASM section (/wasm/*).
|
||||
---------------------------------------------------------------------------
|
||||
Tailwind's built-in dark variant follows the operating system. A site with its own
|
||||
theme switch cannot use it: the OS says one thing, the switch says another, and the
|
||||
media query wins — so the switch appears to do nothing.
|
||||
There is deliberately no `@import "tailwindcss"` and no `@custom-variant dark`
|
||||
here. twcss compiles this file via tw.CompileAppFiles, which prepends kjol's
|
||||
shared extension layer (tw/kjol_theme.css) — the import, the class-based dark
|
||||
variant, the semantic tokens (surface/line/ink/…), and the chart palette. This
|
||||
file carries only what is genuinely this app's: the brand.
|
||||
|
||||
This redefines it against a class on <html>, which webui.Theme toggles. The OS is
|
||||
still respected: it is the DEFAULT (see the boot script in server/main.go), just no
|
||||
longer the last word.
|
||||
The values below match the /js side's frontend/css/style.css on purpose — same
|
||||
Open Sans, same navy accent — so that crossing between /wasm and /js reads as two
|
||||
parts of ONE site rather than two demos that happen to share a domain. The two
|
||||
sections are built by completely different pipelines; they should not look like it.
|
||||
--------------------------------------------------------------------------- */
|
||||
@custom-variant dark (&:where(.dark, .dark *));
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
Open Sans — self-hosted (files in wwwroot/fonts). One variable file per subset
|
||||
@@ -53,13 +53,9 @@
|
||||
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* App-side design tokens the webui kit references (Tailwind v4 @theme). Brand
|
||||
values live with the app; the kit stays generic.
|
||||
|
||||
The surface/line/ink tokens are the kit's THEME CONTRACT (see webui.ThemeTokens):
|
||||
components say bg-surface / border-line / text-ink and never name a colour, so the
|
||||
whole kit changes theme by changing these ten values rather than by carrying a dark:
|
||||
variant on four hundred class strings. */
|
||||
/* The brand — the values the shared kit's tokens are re-pointed to. Everything the
|
||||
kit already defines (surfaces, lines, ink, the chart palette, the state colours)
|
||||
comes from tw/kjol_theme.css; this block sets only what is this site's own. */
|
||||
@theme {
|
||||
--radius-default: 0.375rem;
|
||||
|
||||
@@ -71,8 +67,7 @@
|
||||
|
||||
/* Navy and red — the flag, muted. kjøl is a Norwegian word and the palette says so.
|
||||
Both are dark and low-key: the page is mostly prose, code and tables, and the brand's
|
||||
job is to mark the few things you can act on, not to compete with them for attention.
|
||||
(The previous sky blue did the same job, but said nothing.) */
|
||||
job is to mark the few things you can act on, not to compete with them for attention. */
|
||||
--color-primary: #1e3a63; /* muted navy — FILLS; they carry white text */
|
||||
--color-primary-hover: #16294a;
|
||||
--color-primary-subtle: #eef2f8; /* a navy wash — tinted panels, badges, callouts */
|
||||
@@ -82,44 +77,12 @@
|
||||
separate token from primary, because the two have opposite constraints: a fill must be
|
||||
dark enough for white text on TOP of it, and accent text must be readable ON the
|
||||
surface. Here they are the same hue — navy — but not the same value: the accent is a
|
||||
touch deeper so a navy link on white is unmistakably a link. (The red is gone; the
|
||||
brand is navy throughout now. Only the flag keeps its red field.) */
|
||||
touch deeper so a navy link on white is unmistakably a link. */
|
||||
--color-accent: #1c3a66; /* navy — accent TEXT */
|
||||
|
||||
/* Surfaces, lines, ink — the kit's theme contract. */
|
||||
--color-surface: #ffffff;
|
||||
--color-surface-muted: #fafafa;
|
||||
--color-surface-raised: #f5f5f5;
|
||||
--color-surface-strong: #e5e5e5;
|
||||
--color-line: #e5e5e5;
|
||||
--color-line-strong: #d4d4d4;
|
||||
--color-ink: #171717;
|
||||
--color-ink-soft: #525252;
|
||||
--color-ink-muted: #737373;
|
||||
--color-ink-faint: #a3a3a3;
|
||||
|
||||
/* Heading ink — a touch stronger than body ink. Not part of the shared contract, so
|
||||
the site names it here and re-points it in the .dark block below. */
|
||||
--color-text-heading: #111827;
|
||||
--color-text-on-dark: #f9fafb;
|
||||
--color-text-on-dark-muted: #9ca3af;
|
||||
|
||||
/* The categorical CHART palette (webui/chart.go) and the sequential choropleth ramp
|
||||
(webui/usheatmap.go) — the SAME tokens the Solid kit names in jsruntime/styles/
|
||||
theme.css, so a chart looks identical on both front-ends. Marks name these as raw
|
||||
CSS variables in the SVG they draw. Dark values in the .dark block below. */
|
||||
--color-chart-1: #2a78d6;
|
||||
--color-chart-2: #1baf7a;
|
||||
--color-chart-3: #eda100;
|
||||
--color-chart-4: #008300;
|
||||
--color-chart-5: #4a3aa7;
|
||||
--color-chart-6: #e34948;
|
||||
--color-chart-7: #e87ba4;
|
||||
--color-chart-8: #eb6834;
|
||||
--color-choropleth-1: #dbe9fb;
|
||||
--color-choropleth-2: #b3d0f6;
|
||||
--color-choropleth-3: #85b3ee;
|
||||
--color-choropleth-4: #5591e4;
|
||||
--color-choropleth-5: #2f6fca;
|
||||
--color-choropleth-6: #124f8f;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
@@ -139,37 +102,15 @@
|
||||
--grid-line: rgba(30, 58, 99, 0.06); /* the navy, at the edge of visible */
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
The dark theme.
|
||||
/* The dark values for the brand.
|
||||
---------------------------------------------------------------------------
|
||||
Only the token VALUES change. Not one component knows this block exists — they ask
|
||||
for bg-surface and text-ink, and here is where those come to mean something else.
|
||||
|
||||
This is a plain rule, not another @theme block: @theme generates utilities, and these
|
||||
are overrides of utilities that already exist.
|
||||
|
||||
The surfaces are not pure black. Black gives a dark UI a hard, glaring edge against
|
||||
white text and makes every border invisible; a very dark grey leaves room for the
|
||||
raised surfaces and lines above it to actually be seen. --------------------------- */
|
||||
The shared surfaces/lines/ink re-point themselves in tw/kjol_theme.css's own .dark
|
||||
block; this one moves only the site's brand. Navy is too dark to read on a near-black
|
||||
page, so both brand tokens climb to a lighter blue. The accent (TEXT) climbs furthest,
|
||||
to a soft sky a link stays legible in; the fill climbs less, to a steel blue that still
|
||||
looks like a button and still carries white text. The tinted panel inverts outright,
|
||||
because a pale wash on #101013 is not a tint, it is a white box. */
|
||||
.dark {
|
||||
--color-surface: #101013;
|
||||
--color-surface-muted: #17171b;
|
||||
--color-surface-raised: #1f1f24;
|
||||
--color-surface-strong: #2c2c33;
|
||||
--color-line: #2a2a30;
|
||||
--color-line-strong: #3d3d45;
|
||||
--color-ink: #f2f2f3;
|
||||
--color-ink-soft: #c6c6cc;
|
||||
--color-ink-muted: #9a9aa3;
|
||||
--color-ink-faint: #71717a;
|
||||
|
||||
/* Both brand tokens move in the dark, and both for the same reason now: navy is too dark
|
||||
to read on a near-black page, so each climbs to a lighter blue.
|
||||
|
||||
The accent (TEXT) climbs furthest — a link has to be legible at body-text weight, so it
|
||||
goes to a soft sky. The fill climbs less: it only has to look like a button and still
|
||||
carry white text (~7:1), so it lifts to a steel blue and stops there, well below where
|
||||
the accent lands. */
|
||||
--color-accent: #9fc1ec;
|
||||
--color-primary: #2b4f80;
|
||||
--color-primary-hover: #37619b;
|
||||
@@ -180,30 +121,13 @@
|
||||
|
||||
/* The grid is drawn in ink, not in shadow, once the page is dark. */
|
||||
--grid-line: rgba(226, 232, 240, 0.05);
|
||||
|
||||
/* Chart palette re-stepped for the dark surface; choropleth inverts its lightness
|
||||
direction so a high value reads as brighter. Mirrors the Solid scaffold's .dark. */
|
||||
--color-chart-1: #3987e5;
|
||||
--color-chart-2: #199e70;
|
||||
--color-chart-3: #c98500;
|
||||
--color-chart-4: #008300;
|
||||
--color-chart-5: #9085e9;
|
||||
--color-chart-6: #e66767;
|
||||
--color-chart-7: #d55181;
|
||||
--color-chart-8: #d95926;
|
||||
--color-choropleth-1: #1b2a44;
|
||||
--color-choropleth-2: #21406c;
|
||||
--color-choropleth-3: #2c5f97;
|
||||
--color-choropleth-4: #3f80c8;
|
||||
--color-choropleth-5: #649de8;
|
||||
--color-choropleth-6: #93c2f7;
|
||||
}
|
||||
|
||||
/* The page's own background — painted before the app mounts, and behind it afterwards.
|
||||
Without this, a dark app sits in a white window. */
|
||||
/* Only the font. The page's background and text colour come from the shared layer's
|
||||
`html` rule, which paints them from --color-surface / --color-ink — the tokens the
|
||||
.dark block re-points. Setting them here would pin the page to white and leave a dark
|
||||
app sitting in a white window. */
|
||||
html {
|
||||
background-color: var(--color-surface);
|
||||
color: var(--color-ink);
|
||||
font-family: var(--font-sans);
|
||||
}
|
||||
|
||||
@@ -258,7 +182,3 @@ html {
|
||||
-webkit-mask-image: linear-gradient(to bottom, #000, #000 35%, transparent 100%);
|
||||
mask-image: linear-gradient(to bottom, #000, #000 35%, transparent 100%);
|
||||
}
|
||||
|
||||
/* (The hero glow that used to live here went with the hero. A coloured wash behind an
|
||||
oversized headline is the most recognisable gesture in framework marketing, and this
|
||||
page is not making that argument any more.) */
|
||||
|
||||
Reference in New Issue
Block a user