use owo_colors::{
OwoColorize,
Style,
};
pub struct Styles {
pub prefix: Style,
pub type_name: Style,
pub type_name_trivia: Style,
pub nodes_label: Style,
pub nodes_label_trivia: Style,
pub field_name: Style,
pub field_value: Style,
pub alt_value: Style,
pub align_alt: bool,
pub debug_name: Style,
pub debug_value: Style,
pub trivia: Style,
pub trivia_len_tag: Style,
pub trivia_node: Style,
pub trivia_leaf: Style,
pub trivia_field: Style,
pub trivia_nodes: Style,
pub icon_root: Style,
pub icon_node: Style,
pub icon_fragment: Style,
pub icon_leaf: Style,
pub lines: Style,
pub line_numbers: Style,
pub hide_lines: bool,
pub hide_line_numbers: bool,
pub show_debug: bool,
pub max_debug_pad: usize,
pub new_line_after_node: bool,
pub verbose: bool,
}
impl Styles {
pub fn new() -> Self {
Self {
prefix: Style::new().remove_all_effects().white().dimmed(),
type_name: Style::new().remove_all_effects().yellow(),
type_name_trivia: Style::new().remove_all_effects().yellow().dimmed(),
nodes_label: Style::new().remove_all_effects().magenta().dimmed(),
nodes_label_trivia: Style::new().remove_all_effects().magenta().dimmed(),
field_name: Style::new().remove_all_effects().purple().dimmed(),
field_value: Style::new()
.remove_all_effects()
.white()
.dimmed()
.italic(),
alt_value: Style::new().remove_all_effects().bright_white(),
align_alt: true,
debug_name: Style::new().remove_all_effects().yellow().dimmed(),
debug_value: Style::new().remove_all_effects().white(),
trivia: Style::new().remove_all_effects().purple().dimmed(),
trivia_len_tag: Style::new().remove_all_effects().magenta(),
trivia_node: Style::new().remove_all_effects().magenta().dimmed(),
trivia_leaf: Style::new().remove_all_effects().magenta().dimmed(),
trivia_field: Style::new().remove_all_effects().magenta().dimmed(),
trivia_nodes: Style::new().remove_all_effects().magenta().dimmed(),
icon_root: Style::new().remove_all_effects().magenta().dimmed(),
icon_node: Style::new().remove_all_effects().yellow().dimmed(),
icon_fragment: Style::new().remove_all_effects().magenta().dimmed(),
icon_leaf: Style::new().remove_all_effects().magenta().dimmed(),
lines: Style::new().remove_all_effects().magenta().dimmed(),
line_numbers: Style::new().remove_all_effects().dimmed(),
hide_lines: false,
hide_line_numbers: false,
show_debug: true,
max_debug_pad: 240,
new_line_after_node: true,
verbose: true,
}
}
pub fn compact() -> Styles {
Self {
max_debug_pad: 80,
..Default::default()
}
}
}
impl Default for Styles {
fn default() -> Self {
Self::new()
}
}