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
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
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
Did this prompt work?
Keep exploring
More like this
Build a Color Blindness Simulator That Previews a Palette on a Dashboard Card
A single HTML file that redraws a realistic dashboard card under protanopia, deuteranopia, tritanopia and grayscale and flags color pairs that become hard to tell apart.
Build a Drag-to-Arrange Brand Mood Board with Color, Texture and Type Tiles
A prompt that produces a single HTML mood board of color, texture and type tiles built from CSS and SVG, rearrangeable by mouse, touch and keyboard.
Build a Draggable Color Harmony Wheel With Live UI Preview in One HTML File
A ready-to-paste prompt that builds a draggable canvas color wheel. It plots complementary, triadic and analogous schemes live and previews each one on a mini website mockup.
Build a Live Accessible Color Palette Builder with a WCAG Contrast Matrix
Get a single HTML palette builder that tests every text-on-background pair, shows AA/AAA badges live, and suggests the nearest passing shade for failures.
Accessible Color Palette and Type Pairing With Contrast-Checked Text Pairs
Builds a brand palette with a neutral ramp and semantic colors, text and background pairs with WCAG contrast ratios, two font pairings, a type scale and CSS variables ready to paste.
Build a Button and Form Field States Reference Sheet in a Single HTML File
Get a polished, single-file reference sheet that shows button and text field states side by side, with a live playground and contrast ratios computed from design tokens.
- Build a Light/Dark Mode Toggle Demo Page with Smooth Theme Switching
- Build a Modular Type Scale Specimen with Adjustable Ratio and Base Size
- Build a Multi-Step Onboarding Wizard with Stepper and Inline Validation
- Build a Playful Animated 404 Error Page with SVG Art and Site Search
- Build a Responsive Navigation Bar With Mega Menu and Mobile Drawer in HTML
- Build a Responsive Three-Tier Pricing Section with Monthly/Yearly Toggle