mirror of
https://github.com/nushell/nushell.git
synced 2024-12-22 15:13:01 +01:00
added row_index coloring (#391)
This commit is contained in:
parent
b8f1fea7fe
commit
7cf96c6597
@ -162,6 +162,7 @@ pub fn get_color_config(config: &Config) -> HashMap<String, Style> {
|
|||||||
hm.insert("nothing".to_string(), Color::White.normal());
|
hm.insert("nothing".to_string(), Color::White.normal());
|
||||||
hm.insert("binary".to_string(), Color::White.normal());
|
hm.insert("binary".to_string(), Color::White.normal());
|
||||||
hm.insert("cellpath".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 {
|
for (key, value) in &config.color_config {
|
||||||
update_hashmap(key, value, &mut hm);
|
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_range".to_string(), Color::White.normal());
|
||||||
hm.insert("primitive_path".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("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_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("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(
|
hm.insert(
|
||||||
"leading_trailing_space_bg".to_string(),
|
"leading_trailing_space_bg".to_string(),
|
||||||
Style::default().on(Color::Rgb(128, 128, 128)),
|
Style::default().on(Color::Rgb(128, 128, 128)),
|
||||||
|
@ -194,8 +194,8 @@ fn convert_to_table(
|
|||||||
StyledString {
|
StyledString {
|
||||||
contents: y.1,
|
contents: y.1,
|
||||||
style: TextStyle {
|
style: TextStyle {
|
||||||
alignment: nu_table::Alignment::Center,
|
alignment: nu_table::Alignment::Right,
|
||||||
color_style: Some(color_hm["header"]),
|
color_style: Some(color_hm["row_index"]),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -640,7 +640,7 @@ impl WrappedTable {
|
|||||||
let column_count = self.column_widths.len();
|
let column_count = self.column_widths.len();
|
||||||
let mut output = String::new();
|
let mut output = String::new();
|
||||||
let sep_color = color_hm
|
let sep_color = color_hm
|
||||||
.get("separator_color")
|
.get("separator")
|
||||||
.unwrap_or(&Style::default())
|
.unwrap_or(&Style::default())
|
||||||
.to_owned();
|
.to_owned();
|
||||||
|
|
||||||
@ -789,7 +789,7 @@ impl WrappedTable {
|
|||||||
color_hm: &HashMap<String, Style>,
|
color_hm: &HashMap<String, Style>,
|
||||||
) -> String {
|
) -> String {
|
||||||
let sep_color = color_hm
|
let sep_color = color_hm
|
||||||
.get("separator_color")
|
.get("separator")
|
||||||
.unwrap_or(&Style::default())
|
.unwrap_or(&Style::default())
|
||||||
.to_owned();
|
.to_owned();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user