Skip to content

Instantly share code, notes, and snippets.

@watous
Last active December 20, 2024 21:45
Show Gist options
  • Save watous/ffd299a322657673bfd0b5d3c4e14e19 to your computer and use it in GitHub Desktop.
Save watous/ffd299a322657673bfd0b5d3c4e14e19 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@donhatch
Copy link

Nice triangle! I think it'll look even better (and it'll interact with subsequent filter operations such as feColorMatrix better) if you add to the style:

linearGradient { color-interpolation: linearRGB; }

RGB-triangle-linearRGB

@watous
Copy link
Author

watous commented Dec 20, 2024

@donhatch Now that I look at it again I think it actually needs some fixing. The rotations of gradients don't work as I expected.

As for your suggestion, it's quite possible that it will look better. But I think the purpose of this triangle was to be linear in the numbers, e.g. to have the color (255/3, 255/3, 255/3) in the center, which works with sRGB I guess (?).

@donhatch
Copy link

"(?)" is right! I do not claim to understand what it's thinking-- multiple spooky layers of gamma correction and anticorrection everywhere, I suppose. But you're right, in the end sRGB seems to make it come out with #555555 in the center (and e.g. #800080 in the middle of the magenta edge), which seems like what we want, whereas linearRGB seems to make them come out gamma-adjusted to be somewhat brighter than that in the end.

@watous
Copy link
Author

watous commented Dec 20, 2024

I have at least fixed the gradients.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment