From 19e083b5d06baa0f1d88712f58b34262bdf4e7c4 Mon Sep 17 00:00:00 2001 From: A-Walrus Date: Fri, 23 Aug 2024 15:01:47 +0300 Subject: [PATCH] Add colors --- src/terminal_box.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/terminal_box.rs b/src/terminal_box.rs index 431f49e..d6b3814 100644 --- a/src/terminal_box.rs +++ b/src/terminal_box.rs @@ -4,7 +4,7 @@ use alacritty_terminal::{ index::{Column as TermColumn, Point as TermPoint, Side as TermSide}, selection::{Selection, SelectionType}, term::{cell::Flags, TermMode}, - vte::ansi::CursorShape, + vte::ansi::{CursorShape, NamedColor}, }; use cosmic::widget::menu::key_bind::KeyBind; use cosmic::{ @@ -593,7 +593,10 @@ where let cursor = terminal.term.lock().renderable_content().cursor; let col = cursor.point.column.0; let line = cursor.point.line.0; - let color = Color::WHITE; // TODO + let color = terminal.term.lock().colors()[NamedColor::Cursor] + .or(terminal.colors()[NamedColor::Cursor]) + .map(|rgb| Color::from_rgb8(rgb.r, rgb.g, rgb.b)) + .unwrap_or(Color::WHITE); // TODO default color from theme? let width = terminal.size().cell_width; let height = terminal.size().cell_height; let top_left = view_position