AiLounge Tools

Color & CSS Style Tools

Convert HEX/RGB/HSL, compute WCAG contrast, and generate controlled gradient and box-shadow CSS entirely in your browser. No uploads.Processed locally · no uploads

Controlled CSS linear-gradient generator

Accepts only 0/90/180 degrees plus validated colours and integer percentages, serializes linear-gradient() with a fixed grammar; preview and copied text match.

Run in browser

Inputs and parameters

Real example

angle=90, color0=#176b50 @0%, color1=#ffffff @50%, color2=#e8f3ec @100%
→ background-image: linear-gradient(90deg, #176b50 0%, #ffffff 50%, #e8f3ec 100%);

Limits and failure handling

Linear gradients at 0/90/180 only, 2–5 stops, strictly increasing integer 0..100% positions; no radial/conic/repeating gradients, easing stops, CSS variables or arbitrary raw CSS. Generated output is capped at 512 bytes.

FAQ

Can I generate 45 degrees or radial gradients?

No, this release supports linear gradients at 0/90/180 only; other angles raise INVALID_ANGLE rather than being silently rewritten.

Why must the preview and copied text match?

Both come from the same serializeGradient() pure function; tests include exact CSS snapshots and a parseGradientCss() round trip so the copied value conforms to the fixed grammar.

What if I paste malicious CSS?

url(, </style>, expression(, @import, braces or semicolons trigger UNSAFE_CSS; the input is never concatenated into a style rule.