fix: report effective OSC 11 background

This commit is contained in:
Igor Matuszewski 2026-06-19 18:52:18 +02:00 committed by Ashley Wulber
parent fde0f34137
commit 18d45bc88f
2 changed files with 14 additions and 1 deletions

View file

@ -386,6 +386,19 @@ impl Terminal {
&self.colors
}
pub fn effective_color(&self, index: usize) -> Rgb {
if index == NamedColor::Background as usize {
self.colors[index].unwrap_or_else(|| {
// Allow using an unset background
let [r, g, b, _] =
cosmic_text::Color(WINDOW_BG_COLOR.load(Ordering::SeqCst)).as_rgba();
Rgb { r, g, b }
})
} else {
self.colors[index].unwrap_or_default()
}
}
pub fn default_attrs(&self) -> &Attrs<'static> {
&self.default_attrs
}