Allow setting full RGB foreground/background color
This commit is contained in:
1 parent
b56209a181
commit
3484b94435
2 files changed
+29
-1
No files matched your search
+1
-1
@@ -278,7 +278,7 @@ fn run() -> Result<(), Error> {
|
||||
println!("Connected screen {}", screen_num);
|
||||
|
||||
let mut terminal = term::Terminal::new(24, 80, 3000);
|
||||
let message = "x_advance != foo->bar(); ❤ 😍🤢\n\x1b[91;mw00t\n\x1b[37;104;m bleet\x1b[0;m.";
|
||||
let message = "x_advance != \x1b[38;2;1;0;125;145;mfoo->bar(); ❤ 😍🤢\n\x1b[91;mw00t\n\x1b[37;104;m bleet\x1b[0;m.";
|
||||
terminal.advance_bytes(message);
|
||||
|
||||
let mut window = TerminalWindow::new(&conn, screen_num, 1024, 300, terminal)?;
|
||||
|
||||
@@ -388,6 +388,34 @@ impl CSIAction {
|
||||
/// parameter stream. Returns None if we couldn't decode one of
|
||||
/// the parameter elements.
|
||||
fn parse_sgr(params: &[i64]) -> Option<(CSIAction, &[i64])> {
|
||||
if params.len() > 5 {
|
||||
// ISO-8613-6 foreground and background color specification
|
||||
// using full RGB color codes.
|
||||
if params[0] == 38 && params[1] == 2 {
|
||||
return Some((
|
||||
CSIAction::SetForegroundColor(
|
||||
color::ColorAttribute::Rgb(color::RgbColor {
|
||||
red: params[3] as u8,
|
||||
green: params[4] as u8,
|
||||
blue: params[5] as u8,
|
||||
}),
|
||||
),
|
||||
¶ms[6..],
|
||||
));
|
||||
}
|
||||
if params[0] == 48 && params[1] == 2 {
|
||||
return Some((
|
||||
CSIAction::SetBackgroundColor(
|
||||
color::ColorAttribute::Rgb(color::RgbColor {
|
||||
red: params[3] as u8,
|
||||
green: params[4] as u8,
|
||||
blue: params[5] as u8,
|
||||
}),
|
||||
),
|
||||
¶ms[6..],
|
||||
));
|
||||
}
|
||||
}
|
||||
if params.len() > 2 {
|
||||
// Some special look-ahead cases for 88 and 256 color support
|
||||
if params[0] == 38 && params[1] == 5 {
|
||||
|
||||
Reference in new issue
Block a user