added row_index coloring (#391)

This commit is contained in:
Darren Schroeder 2021-12-01 09:17:50 -06:00 committed by GitHub
parent b8f1fea7fe
commit 7cf96c6597
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View file

@ -162,6 +162,7 @@ pub fn get_color_config(config: &Config) -> HashMap<String, Style> {
hm.insert("nothing".to_string(), Color::White.normal());
hm.insert("binary".to_string(), Color::White.normal());
hm.insert("cellpath".to_string(), Color::White.normal());
hm.insert("row_index".to_string(), Color::Green.bold());
for (key, value) in &config.color_config {
update_hashmap(key, value, &mut hm);
@ -369,11 +370,11 @@ fn test_hm() {
hm.insert("primitive_range".to_string(), Color::White.normal());
hm.insert("primitive_path".to_string(), Color::White.normal());
hm.insert("primitive_binary".to_string(), Color::White.normal());
hm.insert("separator_color".to_string(), Color::White.normal());
hm.insert("separator".to_string(), Color::White.normal());
hm.insert("header_align".to_string(), Color::Green.bold());
hm.insert("header_color".to_string(), Color::Green.bold());
hm.insert("header".to_string(), Color::Green.bold());
hm.insert("header_style".to_string(), Style::default());
hm.insert("index_color".to_string(), Color::Green.bold());
hm.insert("row_index".to_string(), Color::Green.bold());
hm.insert(
"leading_trailing_space_bg".to_string(),
Style::default().on(Color::Rgb(128, 128, 128)),

View file

@ -194,8 +194,8 @@ fn convert_to_table(
StyledString {
contents: y.1,
style: TextStyle {
alignment: nu_table::Alignment::Center,
color_style: Some(color_hm["header"]),
alignment: nu_table::Alignment::Right,
color_style: Some(color_hm["row_index"]),
},
}
} else {

View file

@ -640,7 +640,7 @@ impl WrappedTable {
let column_count = self.column_widths.len();
let mut output = String::new();
let sep_color = color_hm
.get("separator_color")
.get("separator")
.unwrap_or(&Style::default())
.to_owned();
@ -789,7 +789,7 @@ impl WrappedTable {
color_hm: &HashMap<String, Style>,
) -> String {
let sep_color = color_hm
.get("separator_color")
.get("separator")
.unwrap_or(&Style::default())
.to_owned();