mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-25 17:57:19 +02:00
Add color for active context in context switcher
This commit is contained in:
parent
2250c20cfa
commit
9a83417067
2 changed files with 31 additions and 3 deletions
|
@ -19,12 +19,18 @@ impl Default for TColor {
|
|||
|
||||
impl TColor {
|
||||
pub fn default() -> Self {
|
||||
TColor {
|
||||
Self {
|
||||
fg: Color::Black,
|
||||
bg: Color::White,
|
||||
modifiers: vec![],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(fg: Color, bg: Color, modifiers: Vec<Modifier>) -> Self {
|
||||
Self {
|
||||
fg, bg, modifiers,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -41,6 +47,7 @@ pub struct Config {
|
|||
pub uda_selection_dim: bool,
|
||||
pub uda_selection_blink: bool,
|
||||
pub uda_calendar_months_per_row: usize,
|
||||
pub uda_style_context_active: TColor,
|
||||
}
|
||||
|
||||
trait TaskWarriorBool {
|
||||
|
@ -87,6 +94,8 @@ impl Config {
|
|||
uda_selection_dim: Self::get_uda_selection_dim(),
|
||||
uda_selection_blink: Self::get_uda_selection_blink(),
|
||||
uda_calendar_months_per_row: Self::get_uda_months_per_row(),
|
||||
uda_style_context_active: Self::get_uda_style("context.active")
|
||||
.unwrap_or(TColor::new(Color::Black, Color::Rgb(220, 220, 220), vec![])),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -94,6 +103,16 @@ impl Config {
|
|||
HashMap::new()
|
||||
}
|
||||
|
||||
fn get_uda_style(config: &str) -> Option<TColor> {
|
||||
let c = format!("uda.taskwarrior-tui.style.{}", config);
|
||||
let s = Self::get_config(&c);
|
||||
if s == "" {
|
||||
None
|
||||
} else {
|
||||
Some(Self::get_tcolor(&s))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_color_collection() -> Result<HashMap<String, TColor>, Box<dyn Error>> {
|
||||
let mut color_collection = HashMap::new();
|
||||
let output = Command::new("task").arg("rc.color=off").arg("show").output()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue