satori icon indicating copy to clipboard operation
satori copied to clipboard

Transparent linear gradient rendered incorrectly

Open bdlowery opened this issue 1 year ago • 6 comments

Bug report

Description / Observed Behavior

When using a linear gradient with transparent, it's not actually transparent, it's just black.

Expected Behavior

This css - backgroundImage: 'linear-gradient(transparent, transparent, white)', should render from transparent directly to white. Instead it renders from dark gray to white.

This is the expected behavior: https://codepen.io/bdlowery/pen/dyrrjgW

Reproduction

Reproduction link

bdlowery avatar Feb 19 '24 08:02 bdlowery

Ran into this as well — a workaround like 'linear-gradient(to bottom, #ffffff00, #ffffff00, white)' got me closer to what I wanted.

nateeo avatar Feb 29 '24 00:02 nateeo

Ran into this as well — a workaround like 'linear-gradient(to bottom, #ffffff00, #ffffff00, white)' got me closer to what I wanted.

It makes it better but it lightens it up more than ideal.

natedunn avatar Apr 03 '24 03:04 natedunn

I thought this wasn't spec, but it is actually spec nowadays: transparent depends on the neighbouring colors in the gradient:

https://www.w3.org/TR/css-images-3/#example-77596609

gersomvg avatar Aug 14 '24 15:08 gersomvg

You can even see in the tabs what the expected behavior should be.

HTML tab shows the expected behavior.

CleanShot 2024-08-20 at 00 08 41 CleanShot 2024-08-20 at 00 08 38

bdlowery avatar Aug 20 '24 06:08 bdlowery