Color & Contrast
Convert colors between HEX, RGB, HSL, and OKLCH, and check WCAG 2.1 contrast against light and dark backgrounds.
Runs entirely in your browser — nothing you paste is uploaded.
Normal text needs 4.5 : 1 (AA) or 7 : 1 (AAA). Large text and UI borders need 3 : 1.
:root {
--color-brand: #3B82F6;
--color-brand-rgb: 59 130 246;
--color-brand-hsl: hsl(217, 91%, 60%);
--color-brand-oklch: oklch(62.3% 0.188 259.8);
}@theme {
--color-brand: #3B82F6;
}
text-brand bg-brand border-brand
text-[#3B82F6] bg-[#3B82F6]WCAG contrast reference
quick reference- 4.5 : 1
- Minimum for normal body text at AA level, up to 24px regular or 18.66px bold.
- 3 : 1
- AA minimum for large text and for UI component borders and icons.
- 7 : 1
- AAA level for any text size; 4.5 : 1 is AAA for large text.
- (L1 + 0.05) / (L2 + 0.05)
- The contrast formula, where L is relative luminance with gamma correction.
- #RRGGBBAA
- Eight-digit hex adds an alpha channel; CSS rgb() uses 0-255 and a 0-1 alpha.
- OKLCH
- Perceptually uniform lightness and chroma, so equal steps look equal and hues keep contrast.
Related React syntax guides
All React guidesReact Profiler API: Measuring Render Timings and Identifying Wasted Re-Renders
actualDuration versus baseDuration, phase names that tell you who triggered a commit, and how to ship the numbers without flooding a backend.
ReactReact with TypeScript: Generic Components, PropsWithChildren, and Event Types
Generic props that infer from data, PropsWithChildren instead of React.FC, and element-scoped event types that keep currentTarget typed.
ReactReact useTransition and useDeferredValue: Non-Blocking Concurrent UI Updates
Transitions let React throw away background work when typing arrives. Which hook defers what, and why a controlled input must never be transitioned.
ReactReact.lazy and Code Splitting: Route Chunks, Preloading, and Suspense
Where the split points belong, how to preload on intent, and how to recover when a stale chunk 404s after a deployment.