Build an OKLCH Tint and Shade Scale Generator in a Single HTML File

A ready-to-paste prompt that builds an offline color tool turning one brand color into an even 50–900 OKLCH ramp with contrast badges and CSS or JSON token export.

You getone complete HTML file in a single code block, then 3 short ideas to extend it.

The prompt

Prompt
You are a senior product designer who also writes clean, dependable front-end code. Build Rampwright, a single-page tint and shade scale generator that turns one brand color into a perceptually even 50–900 ramp. Convert the input hex to OKLCH. Give ten steps (50, 100, then 200 through 900) fixed lightness targets, keep the hue, and taper chroma toward the light and dark ends. Lower chroma by binary search until every step fits the sRGB gamut. Rules:
1. Controls: a native color picker synced with a hex text field that flags invalid input, a token name field, a vibrancy slider, a checkbox that locks the exact brand hex at its nearest step, and six sample brand color chips.
2. Show a full-width strip of the ramp and a responsive card grid. Each card shows the step, hex, oklch() value, and WCAG contrast ratios against white and black, with AAA, AA, AA Large or Fail badges.
3. Add export tabs for CSS variables in OKLCH, CSS variables in hex, and JSON design tokens using $type and $value. Include a copy button with a select-text fallback and a polite live status message.
4. Add a small UI preview card styled only with ramp steps.
5. Use a neutral off-white layout, system fonts, a clear type scale and visible focus rings. Fit 360–1280px with no external resources or storage.
Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.

Example output

One HTML file. Save it and open it in any browser.Open full screen

Example: Rampwright, an OKLCH tint and shade scale generator.

Pick a brand color with the picker, type a hex code, or tap a sample chip such as Ember or Plum. The tool builds ten steps from 50 to 900, and each card shows its hex, its oklch() value and its contrast against white and black. Drag Vibrancy to adjust saturation, or tick Lock to keep your exact hex at its nearest step. Then switch export tabs and copy CSS variables or JSON tokens.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Fixed OKLCH lightness targets give evenly spaced steps, so 400 to 500 looks like the same jump as 700 to 800.
  • Binary-search chroma clipping keeps every swatch inside sRGB, so the hex values match what the browser actually renders.
  • Contrast badges on every step show at a glance which shades are safe for text on white or black backgrounds.

Paste the prompt into ChatGPT, Claude or Gemini. Save the returned code as rampwright.html and open it in any browser, or run it in the chat's preview or canvas panel. It works fully offline.

Common edits

  • Change the lightness targets to make the ramp brighter or darker, or add a 950 step for dark-mode surfaces.
  • Add a second ramp for a neutral gray that borrows a little of the brand hue, and export both in the same token file.

Prompt details

By
Prompts-GPT editors
Published
How prompts are written and checked

Did this prompt work?

Keep exploring

More in Design