fix(color): only colour 7 swaps with the background; true colours draw as authored

Every near-white colour turned black on a light background (and near-black
white on a dark one), including true colours. A 255,255,255 solid used as a
white mask became a black block. Now only colour 7 swaps: true colours and
ACI 255 resolve a hair off pure white/black and keep their value on screen
and in plots.

Discussion #1500

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-09-29 06:16:18 +03:00
1 parent ac2a1e1166
commit 60f35e2b1d
7 files changed
+83 -30

No files matched your search

+7 -2
View File
@@ -1126,9 +1126,14 @@ pub fn line_total_width(
pub fn resolve_inline_color(c: &InlineColor) -> Option<[f32; 3]> {
match c {
InlineColor::Aci(idx) => aci_to_rgb(*idx).map(|(r, g, b)| {
[r as f32 / 255.0, g as f32 / 255.0, b as f32 / 255.0]
let rgb = [r as f32 / 255.0, g as f32 / 255.0, b as f32 / 255.0];
if *idx == 7 {
rgb
} else {
crate::scene::convert::tess_util::authored_rgb(rgb)
}
}),
InlineColor::True(rgb) => Some(*rgb),
InlineColor::True(rgb) => Some(crate::scene::convert::tess_util::authored_rgb(*rgb)),
}
}