/** * What this surface is painted with, in the design system's own names. * * One home for them. The same four colour names were written out in five files, * so a change of mind about a hairline was five edits and a chance for one of * them to disagree — and the depth the design system publishes was in none of * them. * * `@hanzo/design` ships elevation, spacing, radius and motion alongside colour, * and every one of those tokens is defined at `:root` in this build — measured * in the browser, not assumed. Nothing here read them, which is why a card was a * one-pixel outline on flat black: correct, and flat. Depth is not decoration on * a dark surface, it is the only thing separating a panel from the page behind * it. * * Names, not values. A component asking for `paint.raised` is asking for the * shadow this design system calls a raised thing, and it moves when the system * moves. A component carrying `0 4px 8px rgba(...)` is a second design system * with one user. */ export const paint = { // Colour, from @luxfi/ui's token set — the canonical Lux ladder. plain: 'var(--color-text-primary)', quiet: 'var(--color-text-secondary)', // The hairline, and the only thing that draws a surface here. The ink at a // tenth, which paints #1a1a1a on this ground — the number the reference sets // it at, and the one `card`, `sheet` and `pill` below all resolve through. line: 'var(--color-border-divider)', surface: 'var(--color-bg-primary)', body: 'var(--color-bg-body)', ink: 'var(--color-button-solid-text)', solid: 'var(--color-button-solid-bg)', subtle: 'var(--color-button-subtle-bg)', link: 'var(--color-link-primary)', // State. The only two hues this brand permits outside the achromatic ladder. good: 'var(--color-status-good)', warn: 'var(--color-status-warn)', bad: 'var(--color-status-bad)', // Refused input. Not a state hue — it is the ladder's own word for text that // is wrong. Text that is *off* had a name beside this one and it resolved to // the same value `quiet` does: the engine has no disabled knob and the brand // states no disabled role, so `--color-text-disabled` chained to // `--muted-foreground` and a step nobody could reach was drawn at the step // above it. It is `faint`, which is where the reference draws it. wrong: 'var(--color-text-error)', // Depth, from @hanzo/design's elevation layer. // // One name where there were five. A raised panel, a floating one, a lit top // edge and a radial wash are gone, because the reference draws none of them: // measured across six of its screens, every card, sheet, dialog and popover // reports `box-shadow: none` and `background-image: none`, and what separates // a surface from the page is a hairline and the room around it. // // This one is the object the reference does hang a shadow off, and it is one // object: the door's ticket, `rgba(0,0,0,0.72) 0 24px 64px -24px` under a 480 // box on a page with nothing else on it. Depth there is the whole of what // says the ticket sits above the paper rather than in it. deep: 'var(--shadow-2xl)', // The focus colour, and the shadow composed from it. Two roles, two names: // `ring` was the shadow and was being handed to `outlineColor` in three // places, where a box-shadow is not a colour and the outline silently fell // back to the text colour. ring: 'var(--ring)', halo: 'var(--ring-focus)', // Shape and rhythm. Four rungs, and which one a thing takes says what kind of // thing it is: a sheet and the blocks inside it are drawn rounder than the // controls on them, which is what keeps a stack of blocks reading as one // object. Measured on a screen that draws six corners at four sizes at once — // the list of steps 24, the sheet and the action 20, the pickers 16, the fee // row and the controls beside the heading 12 — and the four names below land // on those four numbers. // // They resolve through `--radius-*` and not through the Lux ladder directly, // because that is the name the appearance panel and every other component on // this stack read; `tokens.css` writes the Lux rungs into it, so both the // brand and the knob are satisfied by one value. round: 'var(--radius-md)', rounder: 'var(--radius-lg)', roundest: 'var(--radius-xl)', corner: 'var(--radius-2xl)', column: 'var(--container-max)', prose: 'var(--container-prose)', // The page behind everything, under the engine's own name. // // Its two neighbours are gone. `--border` was a second hairline beside `line` // and the two disagreed by a rung; `--card` was a second raised surface // beside `surface` and the two are nine values apart in the dark theme and // identical in the light one, so a surface built from both had a seam nobody // could see until they switched. One role, one name: a component on the // engine's own classes still reads `--card` and `--border` through them, and // a component reaching for a value reaches for the Lux ladder. ground: 'var(--background)', // A field, mid-interaction. live: 'var(--color-input-border-focus)', // A bar standing in for a figure that has not arrived. pending: 'var(--color-skeleton-start)', /** * The third rung, and the one this ladder did not have. * * The reference sets running text at three strengths and no more: the ink * itself, the ink at sixty-five hundredths, and the ink at thirty-eight — * 255, 166 and 97 on this ground. The first two are `plain` and `quiet` and * come from the brand's own roles; this is the third, and everything the * reference sets here was being drawn at `quiet`, so a dormant `$0` read as a * figure somebody had typed. * * What takes it, measured: the standing figure on a resting ticket and the * currency mark beside it, the percentage chips under a sum, the disclosure * under every trade card, the two legal links in the wallet sheet, the label * on a step nobody has reached, a bar standing in for a total, a mark * scattered behind a band, and the one quiet line a venue draws in the room * its register would have taken. * * Thirty-eight hundredths and not two fifths: the reference's own fraction, * read off six of its screens. One number rather than one per drawing. * `pending` is a shimmer's first stop and sits four values off the page, * which reads as nothing at all when it is asked to stand still. */ faint: 'var(--color-text-faint)', // The ground a figure is set on where it is quoted rather than read. stats: 'var(--color-stats-bg)', /** * The neutral ramp, in the order a division takes it. * * Hue is reserved for the two meanings above, so parts of a whole that carry * no meaning of their own — the third answer in a vote, the fourth line of a * treasury — are told apart by contrast rather than by colour. * * This package's own names and not the `--chart-N` five. Those belong to the * wider ecosystem: an application's theme sheet declares them at the same * `:root`, and whichever sheet the bundler puts last wins, so an abstained * vote drew amber and an unmet quorum drew blue on a brand that spends hue on * two meanings. * * Here rather than in the component that draws it. This file is the one home * for a colour name — the sentence at the top of `read/index.ts` says so — * and a set of five declared next to the drawing that happens to need them * first is where the second set gets written. */ ramp: [ 'var(--color-part-1)', 'var(--color-part-2)', 'var(--color-part-3)', 'var(--color-part-4)', 'var(--color-part-5)', ], // A soft mark on the ground behind a screen, out of focus. A gradient rather // than a blurred sprite: a circle whose colour runs out before its edge does // has no edge left to blur, so there is nothing to fetch and nothing that can // fail to load. The ladder's own colour at a fraction of itself — nineteen // parts in a hundred, which is what lifts this ground by the forty values the // reference's own marks lift theirs. haze: 'radial-gradient(circle, color-mix(in srgb, var(--color-text-primary) 19%, transparent) 0%, transparent 68%)', // A field of dots, which is what the door sets its figures on. A quarter of // the ladder's ink, drawn as a half-pixel dot; the interval it repeats at // belongs to the panel rather than to the colour. stipple: 'color-mix(in srgb, var(--color-text-primary) 25%, transparent)', solidInk: 'var(--color-button-solid-text)', // A field's own names. The engine paints an input from `--color-input-*` // rather than the surface ladder, so these are separate values for the same // roles and a caller must not reach across. inputInk: 'var(--color-input-fg)', inputGround: 'var(--color-input-bg)', inputFrozen: 'var(--color-input-bg-readonly)', inputEdge: 'var(--color-input-border)', inputNear: 'var(--color-input-border-hover)', inputBad: 'var(--color-input-border-error)', /** * A surface, the way this interface draws one. * * The page's own ground inside a hairline, and nothing else. No fill of its * own, no wash, no lit top edge, no shadow under it. * * This said the opposite for a while, and the argument was good: a border is * the cheapest way to say "this is a box" and the loudest, and a card a shade * lighter than the page, lit along its top edge and casting a little shadow, * reads as an object without drawing a frame around itself. The reference * draws the frame. Measured at 1440 on `/swap`, `/sell`, `/buy`, `/send` and * `/add`: its cards are `background: transparent` inside * `1px rgba(255,255,255,0.1)`, which on its ground is `#1a1a1a`, with no * image and no `box-shadow` on any of them. Ours filled `#0f0f0f`, laid a * diagonal wash from `#0f` to `#21` across the top, hung a `#30` highlight * along the top edge and a shadow underneath, and drew no line — five * decisions against the reference's one, and the whole reason a screen with * every part in the right place still read as a different product. * * Two consequences worth stating, because both are the point rather than a * side effect. A card is now the same colour as the page, so what separates * it is the line and the room around it, exactly as on the reference. And * anything that has to sit *above* a card can take the reference's own value * for its ground instead of a step computed off ours — see `act`. */ card: { backgroundColor: 'transparent', borderWidth: 1, borderColor: 'var(--color-border-divider)', boxShadow: 'none', backgroundImage: 'none', }, /** * A block set into a card, a shade above the page and with no line. * * The other half of the reference's surface vocabulary, and the half a card * used to be. `#0f0f0f` flat, edge to edge, no border, no wash, no shadow — * measured on the leg a crossing answers with, the rung under a sum, the * address block on the sending sheet, all three legs of the limit card, and * the row of rows inside a flyout. * * A card frames and a well recedes, and which one a thing takes is the whole * of what says whether it is a surface or something set into one. The * reference draws exactly these two and no third. */ well: { backgroundColor: 'var(--color-bg-primary)', borderWidth: 0, boxShadow: 'none', backgroundImage: 'none', }, /** * A control standing on a page's own ground rather than on a surface. * * The row across a page's toolbar: a hairline, the page behind it, cut at the * rung a control takes. Composed here because three different primitives wear * it on one row — a menu trigger, a chooser and a field — and three spellings * of one skin drift. */ pill: { borderRadius: 'var(--radius-lg)', backgroundColor: 'var(--color-bg-body)', borderColor: 'var(--color-border-divider)', borderWidth: 1, }, /** * The same surface with a pointer over it. * * A card that is itself a link has to answer the pointer. It answered with * the next shadow up, which was an answer to a question about depth on a * surface that no longer has any: a card with no shadow cannot cast a deeper * one. The line is what draws the card, so the line is what answers — up from * the divider to the ink, which is the move the header's own chain control * already makes and the only one the reference makes anywhere. */ lift: { borderColor: 'var(--color-text-primary)', }, /** * The ring a keyboard leaves on a surface drawn from a bare card. * * Twenty-one copies of this recipe were written across fifteen files, and * they disagreed: ten drew the ring in the text colour, eight in `--ring`. * `--ring` is the design system's answer — it publishes the token, holds it * to a contrast ratio and spends the whole of that budget on it — so a ring * in the text colour is a second opinion about a decision already made. * * Stated only on controls drawn from a bare surface. A primitive that carries * its own ring keeps it. */ focus: { outlineColor: 'var(--ring)', outlineStyle: 'solid', outlineWidth: 2, outlineOffset: 2, }, /** * The same object, floating over the page rather than sitting on it. * * A dialog and a popover occlude, and a reader has to be able to tell what is * in front. That was a deeper shadow with a lit edge composed into it; on the * reference it is the page's own ground behind a hairline — the panel on the * darker of the two grounds with its rows on the lighter, which is what a * `well` inside one is for. Measured on the sending sheet at 1440: `#000000` * inside `1px rgba(255,255,255,0.1)` on all four sides, and the only shadow * on it `0 3px 6px rgba(0,0,0,0.4)`, which on that ground paints nothing. * * Opaque rather than transparent, unlike `card`: this one has a page behind * it that must not read through. */ sheet: { backgroundColor: 'var(--color-bg-body)', borderWidth: 1, borderColor: 'var(--color-border-divider)', boxShadow: 'none', backgroundImage: 'none', }, /** * The ground under the one press a screen is built around. * * The ink at eight hundredths, which composes to `#141414` on this page. Ours * was `subtle` — the engine's `--secondary`, an opaque `#262626` — on the * reading that the action stands a step above whatever surface it is on, and * that reading was right about the relation and wrong by two steps about the * ground it was measured against: a card filled to `#0f0f0f` needs a lift to * be seen at all, and a card that is the page itself does not. * * Written as a fraction of the ink rather than as a value, so it composes * over the page in either ground the way the reference's does, and so the one * number is the one the reference states. */ act: 'color-mix(in srgb, var(--color-text-primary) 8%, transparent)', /** * What a dialog is laid over. * * Black at three tenths, so the screen behind reads at seventy per cent and * stays legible — which is what says the sheet is a step inside something * rather than a place of its own. Measured on the reference's sending sheet: * `rgba(0,0,0,0.6)` at `opacity: 0.5`, and no filter on it. * * One value, because there were four. Three overlays laid the page's own * ground over the page at 0.86, which occludes what it is supposed to dim — * eighteen per cent of the screen behind survived it — and two more laid * black at 0.6. A dialog opening from the header dimmed the page differently * from one opening on the card under it. * * A name and not the value. This was the one colour in the file written out * as a literal, in the file whose first paragraph is that a component * carrying its own `rgba(...)` is a second design system with one user — so * the whole set moved with the brand except the one thing laid over the * screen. */ veil: 'var(--color-veil)', } as const