egui/crates/egui_demo_lib/tests/snapshots
Emil Ernerfeldt 3f731ec794
Fix semi-transparent colors appearing too bright (#5824)
The bug was in `Color32::from_rgba_unmultiplied` and by extension
affects:

* `Color32::from_rgba_unmultiplied`
* `hex_color!`
* `HexColor`
* `ColorImage::from_rgba_unmultiplied`
* All images with transparency (png, webp, …)
* `Color32::from_white_alpha`

The bug caused translucent colors to appear too bright.

## More
Color is hard.

When I started out egui I thought "linear space is objectively better,
for everything!" and then I've been slowly walking that back for various
reasons:

* sRGB textures not available everywhere
* gamma-space is more _perceptually_ even, so it makes sense to use for
anti-aliasing
* other applications do everything in gamma space, so that's what people
expect (this PR)

Similarly, pre-multiplied alpha _makes sense_ for blending colors. It
also enables additive colors, which is nice. But it does complicate
things. Especially when mixed with sRGB/gamma (As @karhu [points
out](https://github.com/emilk/egui/pull/5824#issuecomment-2738099254)).

## Related
* Closes https://github.com/emilk/egui/issues/5751
* Closes https://github.com/emilk/egui/issues/5771 ? (probably; hard to
tell without a repro)
* But not https://github.com/emilk/egui/issues/5810

## TODO
* [x] I broke the RGBA u8 color picker. Fix it

---------

Co-authored-by: Andreas Reich <andreas@rerun.io>
2025-03-21 10:45:25 +01:00
..
demos Fix semi-transparent colors appearing too bright (#5824) 2025-03-21 10:45:25 +01:00
rendering_test Fix semi-transparent colors appearing too bright (#5824) 2025-03-21 10:45:25 +01:00
tessellation_test Make the ends of vline/hline sharper (#5676) 2025-02-04 15:31:51 +01:00
modals_1.png Fix minor glitch in rendering of selected windows (#5678) 2025-02-04 16:05:36 +01:00
modals_2.png Fix minor glitch in rendering of selected windows (#5678) 2025-02-04 16:05:36 +01:00
modals_3.png Fix minor glitch in rendering of selected windows (#5678) 2025-02-04 16:05:36 +01:00
modals_backdrop_should_prevent_focusing_lower_area.png Fix minor glitch in rendering of selected windows (#5678) 2025-02-04 16:05:36 +01:00
tessellation_test.png Improve tessellation quality (#5669) 2025-02-04 11:30:12 +01:00
widget_gallery.png Fix semi-transparent colors appearing too bright (#5824) 2025-03-21 10:45:25 +01:00