Palette lab

Compare spot inks across five tints and copy the CSS for your pick.

Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

bunx --bun shadcn@latest add https://www.cyberspec.dev/r/palette-lab.json

Usage

import { Cyber } from "@/components/ui/cyber"
import Recipe from "@/components/recipes/palette-lab"

export default function App() {
  return (
    <Cyber>
      <Recipe />
    </Cyber>
  )
}

Source

"use client"

import "./recipe-layout.css"
import { useState } from "react"
import { CodeBlock } from "@/components/ui/code-block"
import { SegmentedControl } from "@/components/ui/segmented-control"

const inks = { Flare: "#FF594A", Ion: "#5EF6FF", Iris: "#BB9CFF" }
const tints = [100, 80, 60, 40, 20]
type Ink = keyof typeof inks

export default function PaletteLab() {
  const [ink, setInk] = useState<Ink>("Flare")
  const color = inks[ink]

  return (
    <div className="sink-stack">
      <div role="img" aria-label={`${ink} ink mixed with the panel color, from full strength to twenty percent`} style={{ display: "flex", minHeight: 84 }}>
        {tints.map((tint) => (
          <span key={tint} style={{ flex: tint === 100 ? 2 : 1, backgroundColor: `color-mix(in srgb, ${color} ${tint}%, var(--cy-panel))` }} />
        ))}
      </div>
      <SegmentedControl<Ink> label="Spot ink" options={["Flare", "Ion", "Iris"]} value={ink} onValueChange={(next) => next && setInk(next)} fill />
      <CodeBlock filename="ink.css" language="css" numbers={false} code={`:root { --spot-ink: ${color}; }`} />
    </div>
  )
}

Components in this recipe

  • Segmented control — A row of segments with an indicator that slides to the choice.
  • Code block — Highlighted code with line numbers, a filename tab and a copy key. No highlighting dependency.

Resources

View as Markdown