grad.lab

Gradients without the gray middle. Shadows that look real.

Made by musaabk.devالعربية
sRGB CSS default
OKLCH this tool

Your gradient with a layered shadow
One shadow what most code does

Code


        

Questions

Why does the middle of my CSS gradient turn gray?

With hex, rgb() or named colors, browsers mix a gradient in sRGB, as the CSS Color 4 spec requires for these older color formats. That averages the red, green and blue numbers, and opposite colors such as blue and yellow average to gray. OKLCH mixes lightness, colorfulness and hue instead, so the middle keeps its color.

Why is the code a long list of colors instead of in oklch?

The short form with in oklch is in the code too, as a comment. But when the mix passes through colors a screen cannot show, browsers can bring them back in different ways. The list of colors worked out in advance looks the same in every browser, and the same as in the tool.

Why does OKLCH lose some color too?

Color lost compares the dullest point of the gradient with the duller end. From blue to yellow, OKLCH passes through cyan, and screens cannot show a very strong cyan, so a little color is lost even here. sRGB loses much more because it passes through gray.

What is a layered shadow?

Several shadows on one element. A real shadow is dark and sharp near the object and wide and faint further away. Each layer reaches further and blurs more than the one before, and together they add up to the Darkness you pick.

Does the Tailwind code work?

Yes. It uses arbitrary values in square brackets, bg-[...] and shadow-[...], with underscores in place of spaces. Tailwind turns the underscores back into spaces when it builds your CSS, as its docs describe.

Is anything uploaded?

No. Everything runs in this browser tab, and nothing is sent anywhere.