egui/crates
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
..
ecolor Fix semi-transparent colors appearing too bright (#5824) 2025-03-21 10:45:25 +01:00
eframe Bump accesskit to 0.18 and make it a workspace dependency (#5783) 2025-03-20 11:00:12 +01:00
egui Fix semi-transparent colors appearing too bright (#5824) 2025-03-21 10:45:25 +01:00
egui-wgpu Release 0.31.1 - text_edit and kittest fixes 2025-03-05 08:37:34 +01:00
egui-winit macOS: Add `movable_by_window_background` option to viewport (#5412) 2025-03-20 11:05:22 +01:00
egui_demo_app Fix semi-transparent colors appearing too bright (#5824) 2025-03-21 10:45:25 +01:00
egui_demo_lib Fix semi-transparent colors appearing too bright (#5824) 2025-03-21 10:45:25 +01:00
egui_extras [egui_extra] Allow loading multi-mime formats using the image_loader (#5769) 2025-03-20 11:02:24 +01:00
egui_glow Release 0.31.1 - text_edit and kittest fixes 2025-03-05 08:37:34 +01:00
egui_kittest Fix disabled `DragValue` eating focus, causing focus to reset (#5826) 2025-03-20 10:45:16 +01:00
egui_plot Move `egui_plot` to its own repo (#4828) 2024-07-15 18:45:19 +02:00
egui_web Fix typos (#2866) 2023-04-18 15:52:45 +02:00
emath Add `Popup` and `Tooltip`, unifying the previous behaviours (#5713) 2025-02-18 15:53:07 +01:00
epaint impl AsRef<[u8]> for FontData (#5757) 2025-03-20 11:03:17 +01:00
epaint_default_fonts Release 0.31.1 - text_edit and kittest fixes 2025-03-05 08:37:34 +01:00