mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
The `Hsla` -> `Rgba` conversion sometimes results in negative (but very close to 0) color components due to floating point imprecision, causing the `.powf(constants.main_trc)` computations in the `srgb_to_y` function to evaluate to `NaN`. This propagates to `apca_contrast` which then makes `ensure_minimum_contrast` unconditionally return `black` for certain background colors. This PR addresses this by clamping the rgba components in `impl From<Hsla> for Rgba` to 0-1. Before/after: <img width="1044" height="48" alt="before" src="https://github.com/user-attachments/assets/771f809f-3959-43e9-8ed0-152ff284cef8" /> <img width="1044" height="49" alt="after" src="https://github.com/user-attachments/assets/5fd6ae25-1ef0-4334-90d1-7fc5acf48958" /> Release Notes: - Fixed an issue where ANSI colors were incorrectly adjusted to improve contrast on some background colors |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| LICENSE-GPL | ||