gpui: Fix blending of colors in HighlightStyle::highlight (#37666)

Whilst looking into adding support for RainbowBrackes, we stumbled upon
this: Whereas for all properties during this blending, we take the value
of `other` if it is set, for the color we actually take `self.color`
instead of `other.color` if `self.color` is at full opacity.
`Hsla::blend` returns the latter color if it is at full opacity, which
seems wrong for this case. Hence, this PR swaps these.

Will not merge before the next release, to ensure that we don't break
something somewhere unexpected.

Release Notes:

- N/A
This commit is contained in:
Finn Evers
2025-09-10 18:56:49 +02:00
committed by GitHub
parent 611b96627b
commit 6441099a67
6 changed files with 180 additions and 111 deletions
+4 -4
View File
@@ -635,13 +635,13 @@ impl HighlightedTextBuilder {
self.text.push_str(chunk.text);
let end = self.text.len();
if let Some(mut highlight_style) = chunk
if let Some(highlight_style) = chunk
.syntax_highlight_id
.and_then(|id| id.style(syntax_theme))
{
if let Some(override_style) = override_style {
highlight_style.highlight(override_style);
}
let highlight_style = override_style.map_or(highlight_style, |override_style| {
highlight_style.highlight(override_style)
});
self.highlights.push((start..end, highlight_style));
} else if let Some(override_style) = override_style {
self.highlights.push((start..end, override_style));