Skip to content

Commit

Permalink
Make end_separator respoect separator_fg and separator_bg
Browse files Browse the repository at this point in the history
This change preserves the end separator colors when separator_fg
and separator_bg are set to "auto", and makes it use the configured
colors when they are set.

resolves greshake#2110
  • Loading branch information
edwloef committed Nov 21, 2024
1 parent 0b2da9c commit 345ceb0
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,28 @@ where
}

if let Separator::Custom(end_separator) = &config.theme.end_separator {
rendered_blocks.push(I3BarBlock {
// The separator's FG is the last block's last widget's BG
let sep_fg = if config.theme.separator_fg == Color::Auto {
prev_last_bg
} else {
config.theme.separator_fg
};

// The separator has no background color
let sep_bg = if config.theme.separator_bg == Color::Auto {
Color::None
} else {
config.theme.separator_bg
};

let separator = I3BarBlock {
full_text: end_separator.clone(),
background: Color::None,
color: prev_last_bg,
background: sep_bg,
color: sep_fg,
..Default::default()
});
};

rendered_blocks.push(separator);
}

println!("{},", serde_json::to_string(&rendered_blocks).unwrap());
Expand Down

0 comments on commit 345ceb0

Please sign in to comment.