Skip to content
opsinjs
Edit this page

Foundations

Accent

Three accent themes, normal, vibes and stryk, each with the same nine accents for action, selection, focus and accent text, and never for a result.

opsinjs has three kinds of colour. Status says how much attention something needs and category says what kind of measurement it is; both are fixed, and Colour owns them. The accent is the product's own colour, and it is the one you choose. An accent theme decides how loudly it is spent, and an accent decides its hue.

Theme
Density
Text
Status
Accent theme
Accent
accent-themes-a-settings-card · base base · style base-lyraOpen under the product theme
accent-themes-a-settings-card.tsx
"use client"

import { useState } from "react"

import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import { Progress } from "@/components/ui/progress"
import { Switch } from "@/components/ui/switch"

export default function AccentThemesASettingsCard() {
  const [remind, setRemind] = useState(true)
  const [summary, setSummary] = useState(true)

  return (
    <section
      aria-labelledby="accent-settings-heading"
      className="flex w-full max-w-md flex-col gap-opsin-4 rounded-opsin-lg border border-edge bg-card p-opsin-5 shadow-card [corner-shape:var(--opsin-corner-shape)]"
    >
      <h2 id="accent-settings-heading" className="m-0 text-opsin-title3">
        Example reminders
      </h2>
      <Switch
        label="Remind me about the example reading"
        checked={remind}
        onCheckedChange={setRemind}
      />
      <Checkbox
        label="Send the example summary to my email"
        checked={summary}
        onCheckedChange={setSummary}
      />
      <Progress label="Example set-up" value={60} />
      <div className="flex flex-wrap items-center gap-opsin-2">
        <Button variant="primary">Save example settings</Button>
        <Button variant="quiet">Not now</Button>
      </div>
    </section>
  )
}

Change the theme and the accent with the picker above any preview. The choice follows you to every preview and every showcase screen on this site.

Three themes

ThemeThe filled actionThe selected stateFloorsDefault accent
Normal, the defaultInk, a near-black capsule by day and a near-white one by nightThe accentStandardCobalt
VibesThe accent at full chroma, casting a glowThe accentStandardVolt
StrykThe accent, deep by day and light by nightThe accentEnhancedGraphite

Normal keeps the ink and paper look and spends the accent as light: what is selected, what has focus, and a quiet action set in words.

Vibes makes the accent the action. Deep accents carry a white label. Volt, jade and sky are bright and carry an ink label, with an ink rim by day where the fill alone would not separate from the page; by night a deep fill takes a light rim for the same reason.

Stryk is high contrast. The page is pure white or pure black, every boundary and edge is full ink, shadows and translucency go, and the focus ring widens to 3px. Every label clears WCAG 2.2 AAA, 7:1, and APCA Lc 85, and every boundary and ring clears 4.5:1 and Lc 60. Stryk applies whenever the reader's system asks for more contrast, whatever theme the product chose, and keeps the accent they picked.

Nine accents

Every theme defines the same nine, so changing the theme never changes the accent.

AccentHue
Cobalt250
Sky212
Jade152
Volt122
Rose354
Orchid326
Violet300
Iris278
Graphitenone, the monochrome accent
Theme
Density
Text
Status
Accent theme
Accent
accent-themes-the-palette · base base · style base-lyraOpen under the product theme
accent-themes-the-palette.tsx
import { ACCENTS, ACCENT_THEMES } from "@/lib/generated/accents"

export default function AccentThemesThePalette() {
  return (
    <div className="flex w-full max-w-2xl flex-col gap-opsin-5">
      {ACCENT_THEMES.map((theme) => (
        <section key={theme.id} aria-labelledby={`palette-${theme.id}`} className="flex flex-col gap-opsin-2">
          <h3 id={`palette-${theme.id}`} className="m-0 text-opsin-headline">
            {theme.label}
          </h3>
          <ul className="m-0 grid list-none grid-cols-[repeat(auto-fill,minmax(min(100%,11rem),1fr))] gap-opsin-2 p-0">
            {ACCENTS.map((accent) => (
              <li
                key={accent.id}
                data-accent-theme={theme.id}
                data-accent={accent.id}
                className="flex min-w-0 items-center gap-opsin-2 rounded-opsin-md border border-edge bg-card px-opsin-3 py-opsin-2 [corner-shape:var(--opsin-corner-shape)]"
              >
                <span
                  aria-hidden="true"
                  className="block h-opsin-5 w-opsin-10 shrink-0 rounded-full border border-primary-edge bg-primary shadow-[0_6px_16px_-8px_var(--brand-glow)]"
                />
                <span
                  aria-hidden="true"
                  className="block size-opsin-4 shrink-0 rounded-full border border-brand-edge bg-brand"
                />
                <span className="min-w-0 text-opsin-subheadline-emphasis wrap-break-word [color:var(--brand-ink)]">
                  {accent.label}
                </span>
              </li>
            ))}
          </ul>
        </section>
      ))}
    </div>
  )
}

Choosing one

Set the theme and the accent on <html>. With neither, a page renders normal and cobalt.

<html data-accent-theme="vibes" data-accent="volt">

Any element can start a scope of its own, and .dark may sit on the same element, above it or inside it. Set both attributes on one element: a theme on one element and an accent on another do not combine.

Each pairing is also a theme item that layers on the default one:

npx shadcn@latest add https://opsinjs.pensievelabs.org/r/themes/opsinjs-default.json
npx shadcn@latest add https://opsinjs.pensievelabs.org/r/themes/opsinjs-vibes-volt.json

A theme item sets :root and .dark only, so it fixes one pairing. Switching at runtime needs the attribute blocks in app/tokens.generated.css.

Roles

RoleTokenRead by
--primary, --primary-foreground--opsin-accent-action, -action-foregroundButton primary
--state-primary-hover, -press--opsin-accent-action-hover, -pressThe same, under a pointer and pressed
--brand, --brand-foreground--opsin-accent-fill, -fill-foregroundSwitch, Checkbox, RadioGroup, Slider, Progress, ScaleInput
--primary-edge, --brand-edge-action-edge, -fill-edgeThe rim a bright fill needs, transparent otherwise
--brand-ink--opsin-accent-inkButton quiet, a card's quiet action, the Tabs indicator
--ring--opsin-accent-ringEvery focus ring
--brand-glow--opsin-accent-glowThe light a vibes action throws

Rules

  1. An accent never fills a surface that reports a result and never carries a status or a category. On a status surface, such as an AlertBanner, a control takes that level's own ink instead.
  2. Every accent hue keeps at least 25 degrees from the status hues 27, 45, 82 and 178, so red, orange, amber and the steady teal stay with status. Graphite has no hue.
  3. Every pair is measured. scripts/build-tokens.mts refuses to write an accent below its floor, so a failing accent fails the build, and Accent contrast publishes every figure.
  4. A control drawn as words is set in the accent ink and never underlined. An underline marks a link inside running text.
  5. A custom accent is a fork of tokens/accent.json, measured the same way, never a colour set in a component.
Not written yet.

Stryk has not been used by a reader with low vision, and no accent theme has been checked by eye under forced colours, where the platform replaces every accent with its own pair.