Theory: How Web Color Works (In Full)
1) The screen is RGB light.
Every pixel is a tiny lamp mixing Red, Green, and Blue. So browsers ultimately render everything as RGB values.
- rgb(255,0,0) is full red
- rgb(0,255,0) is full green
- rgb(0,0,255) is full blue
2) Why multiple formats exist.
- HEX is compact and common in design systems.
- RGB(A) matches the screen, good for alpha overlays.
- HSL(A) is easiest for theming: rotate hue, keep saturation/lightness.
Professional theming often uses HSL tokens + derived colors.
#ff0000 red #00ff00 green #0000ff blue #ffffff white #000000 black Shorthand: #f00 == #ff0000 #0f0 == #00ff00 #00f == #0000ff
Hue 0..360 (color wheel) Saturation 0..100% (vividness) Lightness 0..100% (brightness) Example: hsl(28 90% 55%) (a saffron-like accent)
Alpha (transparency): use rgba(r,g,b,a) or hsl(h s l / a). Low alpha is how you get “glow”, glass panels, and soft backgrounds without destroying readability.
Palette Generator: One Hue → Full UI Palette
This is the most useful real-world trick: keep a few variables and derive the entire palette using var() + calc(). The swatches update live.
In real apps: buttons, links, badges, charts, and highlights all use the same tokens. Change hue once → entire UI stays consistent.
Converters: HEX ⇄ RGB ⇄ HSL (With Live Preview)
Use these converters to understand how formats relate. Convert HEX to RGB, RGB to HEX, and view HSL. Also see a pure CSS trick: inverse color using calc(255 - var(--r)).
Tip: RGBA is best for overlays: rgba(r,g,b,0.15) makes clean glow/panel effects.
The same color can be described in different formats. Designers love HEX, developers love RGB, and theme systems love HSL.
Gradient Builder (Copy the CSS)
Gradients are multiple colors blended across space. Use angle + stops, then copy the CSS into your site.
Pro trick: add a low-alpha glow layer above gradients for depth without hurting readability.
Combine gradients + alpha + blur for modern UI.
Contrast Tester (Readability)
Good-looking color is not enough. Text must be readable. This tool checks contrast between your accent and black/white text.
Interactive Practice: Embedded Editor + Open-in-New-Tab Tools
Select an example, then either copy it, open it as a standalone preview, or open it in the editor in a new tab.
Note: The editor is hosted on a different page. This page can open it in a new tab and also store your example code in localStorage under: pp_open_example_html. If the editor supports auto-loading, it can read that key. Either way, you can always paste the code (you already copied it).