mirror of
https://github.com/wez/wezterm.git
synced 2024-11-10 15:04:32 +03:00
add support for the true color escapes that don't specify colorspace
refs: https://github.com/wez/wezterm/issues/785
This commit is contained in:
parent
965e413c52
commit
3d83a805ec
@ -2099,6 +2099,9 @@ impl<'a> CSIParser<'a> {
|
||||
&[Some(38), Some(2), _colorspace, Some(r), Some(g), Some(b)] => one!(
|
||||
Sgr::Foreground(RgbColor::new(r as u8, g as u8, b as u8).into())
|
||||
),
|
||||
&[Some(38), Some(2), Some(r), Some(g), Some(b)] => one!(
|
||||
Sgr::Foreground(RgbColor::new(r as u8, g as u8, b as u8).into())
|
||||
),
|
||||
&[Some(38), Some(5), Some(idx)] => {
|
||||
one!(Sgr::Foreground(ColorSpec::PaletteIndex(idx as u8)))
|
||||
}
|
||||
@ -2106,6 +2109,9 @@ impl<'a> CSIParser<'a> {
|
||||
&[Some(48), Some(2), _colorspace, Some(r), Some(g), Some(b)] => one!(
|
||||
Sgr::Background(RgbColor::new(r as u8, g as u8, b as u8).into())
|
||||
),
|
||||
&[Some(48), Some(2), Some(r), Some(g), Some(b)] => one!(
|
||||
Sgr::Background(RgbColor::new(r as u8, g as u8, b as u8).into())
|
||||
),
|
||||
&[Some(48), Some(5), Some(idx)] => {
|
||||
one!(Sgr::Background(ColorSpec::PaletteIndex(idx as u8)))
|
||||
}
|
||||
@ -2113,6 +2119,9 @@ impl<'a> CSIParser<'a> {
|
||||
&[Some(58), Some(2), _colorspace, Some(r), Some(g), Some(b)] => one!(
|
||||
Sgr::UnderlineColor(RgbColor::new(r as u8, g as u8, b as u8).into())
|
||||
),
|
||||
&[Some(58), Some(2), Some(r), Some(g), Some(b)] => one!(
|
||||
Sgr::UnderlineColor(RgbColor::new(r as u8, g as u8, b as u8).into())
|
||||
),
|
||||
&[Some(58), Some(5), Some(idx)] => {
|
||||
one!(Sgr::UnderlineColor(ColorSpec::PaletteIndex(idx as u8)))
|
||||
}
|
||||
|
@ -520,6 +520,18 @@ mod test {
|
||||
);
|
||||
|
||||
assert_eq!(encode(&actions), "\u{1b}[38:2::128:64:192mw");
|
||||
|
||||
let actions = p.parse_as_vec(b"\x1b[38:2:0:255:0mw");
|
||||
assert_eq!(
|
||||
vec![
|
||||
Action::CSI(CSI::Sgr(Sgr::Foreground(ColorSpec::TrueColor(
|
||||
RgbColor::new(0, 255, 0)
|
||||
)))),
|
||||
Action::Print('w'),
|
||||
],
|
||||
actions
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user