Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ each must be seen against: `hairline` separates on the page and is held against
`border` is a line between two surfaces and a secondary button's outline (`--spin-control-border`,
`--control-border`), and `border_strong` is an input's edge at 3:1. `palette.toml` says the rules
that are behaviour: one filled action per view, a list's row as a plane under the pointer with
its actions drawn only then, an icon alone only with its caption.
its actions drawn only then, an icon alone only with its caption, a page's verdict on the spot - a
dark plane in either theme, `--spin-spot-*` - and a row's state as its chip, its mark on its tint.
Motion is four durations and one easing (`--spin-duration-*`, `--spin-ease`): a movement says
what something does or that it answered a hand, runs once, and is its end state under reduced
motion.
Expand Down
26 changes: 26 additions & 0 deletions cmd/palette/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ const meaningTritan = 6

func holds(p palette) ([]result, error) {
var out []result
// A state on the spot is dark's, in either theme: the spot is a dark plane in both.
darkColors, err := colors(p.Dark)
if err != nil {
return nil, fmt.Errorf("dark: %w", err)
}
for _, m := range []struct {
name string
m mode
Expand Down Expand Up @@ -120,6 +125,23 @@ func holds(p palette) ([]result, error) {
hold("text", "accent_text on the selected tint over "+s, c["accent_text"], sel, text)
hold("text", "text on the selected tint over "+s, c["text"], sel, text)
}
// A row's state chip: the state's mark on its tint, wherever a row is - its panel, under the
// pointer, selected. Its word is beside it on the row, in the text's colour.
selected := c["accent"].over(c["surface"], p.Tint.Selected)
for _, g := range []struct {
name string
c rgb
}{{"surface", c["surface"]}, {"raised", c["raised"]}, {"the selected tint over surface", selected}} {
for _, st := range []string{"success", "warning", "error", "accent_text"} {
hold("non-text", st+" (a chip's mark) on its tint over "+g.name, c[st], c[st].over(g.c, p.Tint.Badge), nonText)
}
}
// The spot: its words on it, and a state on it in dark's colour.
hold("text", "spot_text on spot", c["spot_text"], c["spot"], bodyText)
hold("text", "spot_muted (what explains, a label) on spot", c["spot_muted"], c["spot"], text)
for _, st := range []string{"success", "warning", "error"} {
hold("text", "dark's "+st+" on spot", darkColors[st], c["spot"], text)
}
hold("text", "on_accent on accent", c["on_accent"], c["accent"], text)
hold("text", "white on destructive", white, c["destructive"], text)
st := controlStates(p, c, m.name == "dark")
Expand All @@ -144,6 +166,9 @@ func holds(p palette) ([]result, error) {
// The page alone: a hairline is quieter than border because nothing asks it to show on a
// surface, and nothing here says it does.
apart("line", "hairline on page", c["hairline"], c["page"], 0)
apart("edge", "spot | page", c["spot"], c["page"], 0)
apart("line", "spot_border on spot", c["spot_border"], c["spot"], 0)
apart("line", "spot_border on page", c["spot_border"], c["page"], 0)
for _, s := range []string{"page", "surface"} {
apart("state", "selected tint over "+s+" | "+s, c["accent"].over(c[s], p.Tint.Selected), c[s], 0)
apart("hover", "hover tint over "+s+" | "+s, c["accent"].over(c[s], p.Tint.Hover), c[s], 0)
Expand Down Expand Up @@ -345,6 +370,7 @@ func colors(m mode) (map[string]rgb, error) {
"border": m.Border, "hairline": m.Hairline, "border_strong": m.BorderStrong, "text": m.Text, "muted": m.Muted,
"accent": m.Accent, "accent_text": m.AccentText, "on_accent": m.OnAccent, "label": m.Label,
"success": m.Success, "warning": m.Warning, "error": m.Error, "destructive": m.Destructive,
"spot": m.Spot, "spot_text": m.SpotText, "spot_muted": m.SpotMuted, "spot_border": m.SpotBorder,
}
return parseNamed(named)
}
Expand Down
9 changes: 7 additions & 2 deletions cmd/palette/layout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ func parseHSL(s string) (rgb, error) {
return fromHSL(h, sat/100, l/100), nil
}

// Each pair this palette holds a quiet line or a plane by fails when the palette breaks it, in
// the theme that broke it and by its own name: a check nothing can fail holds nothing.
// Each pair this palette holds a quiet line, a plane or the spot by fails when the palette breaks
// it, in the theme that broke it and by its own name: a check nothing can fail holds nothing.
func TestAQuietLineOrPlaneThatIsNotToldApartFails(t *testing.T) {
for _, tc := range []struct {
pair string
Expand All @@ -172,6 +172,11 @@ func TestAQuietLineOrPlaneThatIsNotToldApartFails(t *testing.T) {
{"a row under the pointer | its panel", func(m *mode) { m.Raised = m.Surface }},
// The action is lifted to the surface in light and to the overlay in dark.
{"a row's action under the pointer | its row", func(m *mode) { m.Surface, m.Overlay = m.Raised, m.Raised }},
// The spot: its words read on it, its rules show on it, and a state on it is dark's.
{"spot_text on spot", func(m *mode) { m.SpotText = m.Spot }},
{"spot_muted (what explains, a label) on spot", func(m *mode) { m.SpotMuted = m.Spot }},
{"spot_border on spot", func(m *mode) { m.SpotBorder = m.Spot }},
{"dark's error on spot", func(m *mode) { m.Spot = "#EE7BB0" }},
} {
for _, theme := range []string{"dark", "light"} {
t.Run(theme+" "+tc.pair, func(t *testing.T) {
Expand Down
5 changes: 5 additions & 0 deletions cmd/palette/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ type mode struct {
Label string
Success, Warning, Error string
Destructive string
// The spot, a page's verdict: its plane, its words, and its edge and rules.
Spot string
SpotText string `toml:"spot_text"`
SpotMuted string `toml:"spot_muted"`
SpotBorder string `toml:"spot_border"`
}

type terminal struct {
Expand Down
12 changes: 12 additions & 0 deletions cmd/palette/outputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ func tokensCSS(p palette, dark, light map[string]rgb) string {
{"control", st.control.hex()}, {"control-hover", st.controlHover.hex()},
{"control-border", st.outline.hex()},
{"row-hover", st.row.hex()}, {"row-action-hover", st.rowAction.hex()},
// A selected row: the accent at tint.selected over the panel its rows sit in.
{"row-selected", c["accent"].over(c["surface"], p.Tint.Selected).hex()},
// A state on the spot is dark's in either theme, since the spot is a dark plane in both.
{"spot-success", dark["success"].hex()}, {"spot-warning", dark["warning"].hex()}, {"spot-error", dark["error"].hex()},
} {
fmt.Fprintf(&b, "\t--spin-%s: %s;\n", v[0], v[1])
}
Expand Down Expand Up @@ -311,6 +315,14 @@ func dashboardCSS(p palette, dark, light map[string]rgb) string {
{"control-border", hsl(st.outline)},
{"hairline", hsl(c["hairline"])},
{"row-hover", hsl(st.row)}, {"row-action-hover", hsl(st.rowAction)},
// A selected row: the accent at tint.selected over the card its rows sit in, with an edge
// in --primary; every word on it is --foreground.
{"row-selected", hsl(c["accent"].over(card, p.Tint.Selected))},
// A page's verdict on the spot, a dark plane in either theme: its words, its edge and
// rules, and a state on it, which is dark's.
{"spot", hsl(c["spot"])}, {"spot-foreground", hsl(c["spot_text"])},
{"spot-muted", hsl(c["spot_muted"])}, {"spot-border", hsl(c["spot_border"])},
{"spot-success", hsl(dark["success"])}, {"spot-warning", hsl(dark["warning"])}, {"spot-error", hsl(dark["error"])},
{"primary", hsl(c["accent"])}, {"primary-foreground", hsl(c["on_accent"])},
// The accent as a line - a link, an action written as words, the focus ring above:
// accent_text, held at 4.5:1 on every surface. The accent itself is a fill: light's
Expand Down
16 changes: 16 additions & 0 deletions dist/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
--hairline: 217.5 21.6% 85.5%;
--row-hover: 218.8 37.8% 91.2%;
--row-action-hover: 0.0 0.0% 100.0%;
--row-selected: 200.4 45.4% 82.2%;
--spot: 220.9 39.3% 11.0%;
--spot-foreground: 210.0 40.0% 94.1%;
--spot-muted: 216.4 19.5% 66.9%;
--spot-border: 221.0 29.5% 27.3%;
--spot-success: 151.3 49.8% 53.1%;
--spot-warning: 39.9 73.1% 59.2%;
--spot-error: 332.3 77.2% 70.8%;
--primary: 200.4 88.4% 33.9%;
--primary-foreground: 0.0 0.0% 100.0%;
--link: 195.6 96.3% 21.2%;
Expand Down Expand Up @@ -66,6 +74,14 @@
--hairline: 222.0 37.5% 15.7%;
--row-hover: 221.1 39.3% 17.5%;
--row-action-hover: 221.0 35.0% 22.9%;
--row-selected: 202.3 61.3% 23.7%;
--spot: 221.1 39.3% 17.5%;
--spot-foreground: 210.0 40.0% 94.1%;
--spot-muted: 216.4 19.5% 66.9%;
--spot-border: 221.0 29.5% 27.3%;
--spot-success: 151.3 49.8% 53.1%;
--spot-warning: 39.9 73.1% 59.2%;
--spot-error: 332.3 77.2% 70.8%;
--primary: 194.5 84.7% 53.9%;
--primary-foreground: 220.0 48.8% 8.4%;
--link: 194.2 89.0% 64.5%;
Expand Down
2 changes: 1 addition & 1 deletion dist/perception.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions dist/tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
--spin-overlay: #26334F;
--spin-page: #09101F;
--spin-raised: #1B263E;
--spin-spot: #1B263E;
--spin-spot-border: #313E5A;
--spin-spot-muted: #9AA7BB;
--spin-spot-text: #EAF0F6;
--spin-success: #4CC38A;
--spin-surface: #121A2E;
--spin-text: #EAF0F6;
Expand All @@ -26,6 +30,10 @@
--spin-control-border: #313E5A;
--spin-row-hover: #1B263E;
--spin-row-action-hover: #26334F;
--spin-row-selected: #174662;
--spin-spot-success: #4CC38A;
--spin-spot-warning: #E3B04B;
--spin-spot-error: #EE7BB0;
--spin-shadow-overlay: 0 0 0 1px rgb(0 0 0 / 0.4);
--spin-success-badge: color-mix(in srgb, var(--spin-success) 12%, transparent);
--spin-warning-badge: color-mix(in srgb, var(--spin-warning) 12%, transparent);
Expand Down Expand Up @@ -56,6 +64,10 @@
--spin-overlay: #FFFFFF;
--spin-page: #F1F4F9;
--spin-raised: #E0E6F1;
--spin-spot: #111827;
--spin-spot-border: #313E5A;
--spin-spot-muted: #9AA7BB;
--spin-spot-text: #EAF0F6;
--spin-success: #0F6844;
--spin-surface: #FFFFFF;
--spin-text: #111827;
Expand All @@ -69,6 +81,10 @@
--spin-control-border: #C4CCD9;
--spin-row-hover: #E0E6F1;
--spin-row-action-hover: #FFFFFF;
--spin-row-selected: #BDD8E6;
--spin-spot-success: #4CC38A;
--spin-spot-warning: #E3B04B;
--spin-spot-error: #EE7BB0;
--spin-shadow-overlay: 0 12px 32px rgb(16 19 24 / 0.14), 0 2px 6px rgb(16 19 24 / 0.08);
--spin-success-badge: color-mix(in srgb, var(--spin-success) 12%, transparent);
--spin-warning-badge: color-mix(in srgb, var(--spin-warning) 12%, transparent);
Expand Down
8 changes: 8 additions & 0 deletions dist/tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
"overlay": "#26334F",
"page": "#09101F",
"raised": "#1B263E",
"spot": "#1B263E",
"spot_border": "#313E5A",
"spot_muted": "#9AA7BB",
"spot_text": "#EAF0F6",
"success": "#4CC38A",
"surface": "#121A2E",
"text": "#EAF0F6",
Expand Down Expand Up @@ -83,6 +87,10 @@
"overlay": "#FFFFFF",
"page": "#F1F4F9",
"raised": "#E0E6F1",
"spot": "#111827",
"spot_border": "#313E5A",
"spot_muted": "#9AA7BB",
"spot_text": "#EAF0F6",
"success": "#0F6844",
"surface": "#FFFFFF",
"text": "#111827",
Expand Down
11 changes: 7 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
.ranks > code { font: 12px var(--spin-font-mono); color: var(--spin-muted); }
.ranks > div { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .scale { grid-template-columns: 1fr; gap: 0 0; } .scale > div { margin-bottom: .6rem; } }
.badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.badges { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .5rem; }
/* A chart as Grafana draws one, and a trace as the dashboard does: the marks at the sizes the checker holds them for. */
.plots { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); gap: 1.5rem; margin-top: 1rem; align-items: start; }
.plots figure { margin: 0; }
Expand Down Expand Up @@ -320,7 +320,7 @@ <h2>Snapshots and rollback</h2>

<section id="dashboard">
<span class="label">The dashboard</span>
<div class="window" data-screen="list"></div>
<div class="window" data-screen="list" data-verdict></div>
<p class="muted" style="font-size:13px">A page of settings is one page that scrolls, each section <a href="#split">split</a>. The one fill on it is the Save of the row being edited, since the page has no other:</p>
<div class="window" data-screen="settings"></div>
<p class="muted" style="font-size:13px">A dialog is a view of its own, over the page behind its scrim, and its fill is its own one:</p>
Expand Down Expand Up @@ -416,8 +416,11 @@ <h3>Sizes</h3>
<section class="only-full" id="states">
<span class="label">States</span>
<div class="rules">
<p class="muted">A state is a badge: its shape, its word in the mono, on its own tint (<code>--spin-success-badge</code> and the rest, <code>tint.badge</code> over whatever is under it). The word holds 4.5:1 on its tint over the page, a surface and a raised fill; the shape tells it apart where the hue does not. The same badge in a table, a header and a toast.</p>
<p class="muted">A state reads as a thing, on its own tint (<code>--spin-success-badge</code> and the rest, <code>tint.badge</code> over whatever is under it), drawn two ways. In a row it is a chip: its shape on its tint, its word beside it in the text's colour. The shape holds 3:1 on its tint over a panel, a row under the pointer and a selected row (<code>--spin-row-selected</code>), on which every word is in the text's colour.</p>
<div class="badges"><span class="state-chip"><span class="chip ok"><i class="mark ok"></i></span><span>running</span></span><span class="state-chip"><span class="chip busy"><i class="mark busy"></i></span><span>starting</span></span><span class="state-chip"><span class="chip warn"><i class="mark warn"></i></span><span>waiting for a host</span></span><span class="state-chip"><span class="chip err"><i class="mark err"></i></span><span>failed</span></span><span class="state-chip"><span class="chip idle"><i class="mark idle"></i></span><span>stopped</span></span></div>
<p class="muted">In a header or a toast it is a badge: its shape and its word in the mono, in its colour, on its tint. The word holds 4.5:1 on its tint over the page, a surface and a raised fill; the shape tells it apart where the hue does not.</p>
<div class="badges"><span class="badge ok">running</span><span class="badge busy">starting</span><span class="badge warn">waiting for a host</span><span class="badge err">failed</span><span class="badge idle">stopped</span></div>
<p class="muted">A page's verdict is on the spot (<code>--spin-spot</code>, <code>-text</code>, <code>-muted</code>, <code>-border</code>): one plane a page has that is not its own, so that the sentence saying whether anything needs the person is where the eye goes. It is a dark plane in either theme - raised and bordered in dark, the mark's navy in light - so a state on it is dark's (<code>--spin-spot-success</code> and the rest). Words and figures only, never a control; <a href="#dashboard">the dashboard above</a> draws one.</p>
</div>
</section>

Expand Down Expand Up @@ -595,7 +598,7 @@ <h3>Elevation</h3>
// The workspaces, drawn twice from one fixture (lab.js): live in the dashboard's sample, and in
// Lists with a row in each state.
for (const el of document.querySelectorAll('[data-list]')) el.innerHTML = list(el.dataset);
for (const el of document.querySelectorAll('[data-screen]')) el.innerHTML = app(screens[el.dataset.screen]());
for (const el of document.querySelectorAll('[data-screen]')) el.innerHTML = app(screens[el.dataset.screen]({ verdict: 'verdict' in el.dataset }));
// The mark's two cuts at each size, from the smallest file that is not enlarged to draw it.
const grounds = [['spin-dark', 'page', 'dark · page'], ['spin-dark', 'surface', 'dark · surface'], ['spin-light', 'page', 'light · page'], ['spin-light', 'surface', 'light · surface']];
const sizes = [16, 20, 32];
Expand Down
35 changes: 34 additions & 1 deletion lab.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,36 @@
.badge.busy { color: var(--spin-accent-text); background: var(--spin-accent-text-badge); } .badge.busy::before { background: none; border: 2px solid currentColor; border-right-color: transparent; width: 6px; height: 6px; }
.badge.idle { color: var(--spin-muted); box-shadow: inset 0 0 0 1px var(--spin-border); } .badge.idle::before { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }

/* A state's mark, in whatever colour it is given: a dot is fine, a ring at rest, a diamond wants a
look, a square has failed, a broken ring is busy. */
.mark { display: inline-block; width: 8px; height: 8px; flex: none; border-radius: 50%; background: currentColor; }
.mark.warn { width: 7px; height: 7px; border-radius: 1px; transform: rotate(45deg); }
.mark.err { border-radius: 1px; }
.mark.idle { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }
.mark.busy { background: none; border: 2px solid currentColor; border-right-color: transparent; }
/* A row's state chip ([tint].badge): the state's mark on its tint, its word beside it in the
text's colour, which reads on any row, a selected one included. At rest a hairline ring. */
.state-chip { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.state-chip .word { font-family: var(--spin-font-mono); color: var(--spin-text); }
.chip { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 4px; }
.chip.ok { color: var(--spin-success); background: var(--spin-success-badge); }
.chip.warn { color: var(--spin-warning); background: var(--spin-warning-badge); }
.chip.err { color: var(--spin-error); background: var(--spin-error-badge); }
.chip.busy { color: var(--spin-accent-text); background: var(--spin-accent-text-badge); }
.chip.idle { color: var(--spin-muted); box-shadow: inset 0 0 0 1px var(--spin-border); }
/* A page's verdict on the spot ([dark].spot): the one plane of a page that is not the page's, a
dark plane in either theme - its verdict, what explains it, and the counts the page computes,
each figure over its label, a rule between. Words and figures, no control. A state on it is
dark's (--spin-spot-*). */
.spot { display: flex; align-items: stretch; margin: 16px 0 0; background: var(--spin-spot); color: var(--spin-spot-text); border: 1px solid var(--spin-spot-border); border-radius: var(--spin-radius-sm); }
.spot .say { flex: 1; min-width: 0; padding: 16px 20px; }
.spot .say p { margin: 0; display: flex; align-items: center; gap: 10px; }
.spot .say .ex { display: block; margin-top: 2px; color: var(--spin-spot-muted); }
.spot .fig { display: flex; flex-direction: column; justify-content: center; padding: 0 20px; border-left: 1px solid var(--spin-spot-border); }
.spot .fig .rank-label { display: flex; align-items: center; gap: 6px; color: var(--spin-spot-muted); white-space: nowrap; }
.spot .ok { color: var(--spin-spot-success); } .spot .warn { color: var(--spin-spot-warning); } .spot .err { color: var(--spin-spot-error); }
.spot .idle, .spot .busy { color: var(--spin-spot-muted); }

/* A dashboard page's ranks of type ([type].rank), each set whole from its six variables. The label
is in the label colour wherever it is; what explains is the body in the secondary colour. */
.rank-title { font: var(--spin-rank-title-weight) var(--spin-rank-title-size)/var(--spin-rank-title-lh) var(--spin-rank-title-font); letter-spacing: var(--spin-rank-title-tracking); text-transform: var(--spin-rank-title-case); }
Expand Down Expand Up @@ -57,7 +87,10 @@ kbd { font: 11px var(--spin-font-mono); color: var(--spin-muted); border: 1px so
.grid .n { text-align: right; } .grid .id { font-family: var(--spin-font-mono); color: var(--spin-muted); }
.grid tr { position: relative; }
.grid tr.is-hover td, .grid tbody tr:hover td, .grid tbody tr:focus-within td { background: var(--spin-row-hover); }
.grid tr.is-selected td { background: var(--spin-accent-hover); } .grid tr.is-selected td:first-child { box-shadow: inset 2px 0 0 var(--spin-accent); }
/* A selected row: the accent at tint.selected with an edge in the accent; every word on it in the
text's colour, which is what reads on its tint. */
.grid tr.is-selected td { background: var(--spin-row-selected); color: var(--spin-text); } .grid tr.is-selected td:first-child { box-shadow: inset 2px 0 0 var(--spin-accent); }
.grid tr.is-selected :is(.id, .muted) { color: var(--spin-text); }
.grid-wrap { overflow-x: auto; margin-top: 1rem; }
/* The whole row opens the thing: its name is the link, stretched over the row, and the focus ring
is the row's. */
Expand Down
Loading