| 1 | //! Config options around styling. |
| 2 | |
| 3 | mod batteryrust-analyzer cargo bottom 0.14.9 options/config/style/battery/; |
| 4 | mod bordersrust-analyzer cargo bottom 0.14.9 options/config/style/borders/; |
| 5 | mod cpurust-analyzer cargo bottom 0.14.9 options/config/style/cpu/; |
| 6 | mod disk_io_graphrust-analyzer cargo bottom 0.14.9 options/config/style/disk_io_graph/; |
| 7 | mod graphsrust-analyzer cargo bottom 0.14.9 options/config/style/graphs/; |
| 8 | mod memoryrust-analyzer cargo bottom 0.14.9 options/config/style/memory/; |
| 9 | mod networkrust-analyzer cargo bottom 0.14.9 options/config/style/network/; |
| 10 | mod tablesrust-analyzer cargo bottom 0.14.9 options/config/style/tables/; |
| 11 | mod temp_graphrust-analyzer cargo bottom 0.14.9 options/config/style/temp_graph/; |
| 12 | mod themesrust-analyzer cargo bottom 0.14.9 options/config/style/themes/; |
| 13 | mod utilsrust-analyzer cargo bottom 0.14.9 options/config/style/utils/; |
| 14 | mod widgetsrust-analyzer cargo bottom 0.14.9 options/config/style/widgets/; |
| 15 | |
| 16 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#; |
| 17 | |
| 18 | use batteryrust-analyzer cargo bottom 0.14.9 options/config/style/battery/::BatteryStylerust-analyzer cargo bottom 0.14.9 options/config/style/battery/BatteryStyle#; |
| 19 | use cpurust-analyzer cargo bottom 0.14.9 options/config/style/cpu/::CpuStylerust-analyzer cargo bottom 0.14.9 options/config/style/cpu/CpuStyle#; |
| 20 | use disk_io_graphrust-analyzer cargo bottom 0.14.9 options/config/style/disk_io_graph/::DiskIoGraphStylerust-analyzer cargo bottom 0.14.9 options/config/style/disk_io_graph/DiskIoGraphStyle#; |
| 21 | use graphsrust-analyzer cargo bottom 0.14.9 options/config/style/graphs/::GraphStylerust-analyzer cargo bottom 0.14.9 options/config/style/graphs/GraphStyle#; |
| 22 | use memoryrust-analyzer cargo bottom 0.14.9 options/config/style/memory/::MemoryStylerust-analyzer cargo bottom 0.14.9 options/config/style/memory/MemoryStyle#; |
| 23 | use networkrust-analyzer cargo bottom 0.14.9 options/config/style/network/::NetworkStylerust-analyzer cargo bottom 0.14.9 options/config/style/network/NetworkStyle#; |
| 24 | use ratatuirust-analyzer cargo ratatui 0.30.2 crate/::{stylerust-analyzer cargo ratatui-core 0.1.2 style/::Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, widgetsrust-analyzer cargo ratatui 0.30.2 widgets/::BorderTyperust-analyzer cargo ratatui-widgets 0.3.2 borders/BorderType#}; |
| 25 | use serderust-analyzer cargo serde 1.0.228 crate/::{Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#, Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#}; |
| 26 | use tablesrust-analyzer cargo bottom 0.14.9 options/config/style/tables/::TableStylerust-analyzer cargo bottom 0.14.9 options/config/style/tables/TableStyle#; |
| 27 | use temp_graphrust-analyzer cargo bottom 0.14.9 options/config/style/temp_graph/::TempGraphStylerust-analyzer cargo bottom 0.14.9 options/config/style/temp_graph/TempGraphStyle#; |
| 28 | use utilsrust-analyzer cargo bottom 0.14.9 options/config/style/utils/::{optrust-analyzer cargo bottom 0.14.9 options/config/style/utils/opt!, set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!, set_colour_listrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour_list!, set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!}; |
| 29 | use widgetsrust-analyzer cargo bottom 0.14.9 options/config/style/widgets/::WidgetStylerust-analyzer cargo bottom 0.14.9 options/config/style/widgets/WidgetStyle#; |
| 30 | |
| 31 | use superrust-analyzer cargo bottom 0.14.9 options/config/::Configrust-analyzer cargo bottom 0.14.9 options/config/Config#; |
| 32 | use craterust-analyzer cargo bottom 0.14.9 crate/::optionsrust-analyzer cargo bottom 0.14.9 options/::{ |
| 33 | OptionErrorrust-analyzer cargo bottom 0.14.9 options/error/OptionError#, OptionResultrust-analyzer cargo bottom 0.14.9 options/error/OptionResult#, argsrust-analyzer cargo bottom 0.14.9 options/args/::BottomArgsrust-analyzer cargo bottom 0.14.9 options/args/BottomArgs#, configrust-analyzer cargo bottom 0.14.9 options/config/::stylerust-analyzer cargo bottom 0.14.9 options/config/style/::utilsrust-analyzer cargo bottom 0.14.9 options/config/style/utils/::set_bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_bg_colour!, |
| 34 | }; |
| 35 | |
| 36 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)] |
| 37 | #[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))] |
| 38 | #[cfg_attr(test, derive(PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:))] |
| 39 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) struct ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#(Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str>); |
| 40 | |
| 41 | /// A style for text. |
| 42 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)] |
| 43 | #[serde(untagged)] |
| 44 | #[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))] |
| 45 | #[cfg_attr(test, serde(deny_unknown_fields), derive(PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:))] |
| 46 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) enum TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig# { |
| 47 | Colourrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#Colour#(ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#), |
| 48 | TextStylerust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle# { |
| 49 | /// A built-in ANSI colour, RGB hex, or RGB colour code. |
| 50 | #[serde(alias = "color")] |
| 51 | colourrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#colour.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#>, |
| 52 | |
| 53 | /// A built-in ANSI colour, RGB hex, or RGB colour code. |
| 54 | #[serde(alias = "bg_color")] |
| 55 | bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#bg_colour.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#>, |
| 56 | |
| 57 | /// Whether to make this text bolded or not. If not set, |
| 58 | /// will default to built-in defaults. |
| 59 | boldrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#bold.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 60 | |
| 61 | /// Whether to make this text italicized or not. If not set, |
| 62 | /// will default to built-in defaults. |
| 63 | italicsrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#italics.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 64 | }, |
| 65 | } |
| 66 | |
| 67 | /// Style-related configs. |
| 68 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)] |
| 69 | #[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))] |
| 70 | #[cfg_attr(test, serde(deny_unknown_fields), derive(PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:))] |
| 71 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) struct StyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig# { |
| 72 | /// A built-in theme. |
| 73 | /// |
| 74 | /// If this is and a custom colour are both set, in the config file, |
| 75 | /// the custom colour scheme will be prioritized first. If a theme |
| 76 | /// is set in the command-line args, however, it will always be |
| 77 | /// prioritized first. |
| 78 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) themerust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#theme.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str>>, |
| 79 | |
| 80 | /// Styling for the CPU widget. |
| 81 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) cpurust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#cpu.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<CpuStylerust-analyzer cargo bottom 0.14.9 options/config/style/cpu/CpuStyle#>, |
| 82 | |
| 83 | /// Styling for the memory widget. |
| 84 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) memoryrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#memory.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<MemoryStylerust-analyzer cargo bottom 0.14.9 options/config/style/memory/MemoryStyle#>, |
| 85 | |
| 86 | /// Styling for the network widget. |
| 87 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) networkrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#network.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<NetworkStylerust-analyzer cargo bottom 0.14.9 options/config/style/network/NetworkStyle#>, |
| 88 | |
| 89 | /// Styling for the disk I/O graph widget. |
| 90 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) disk_io_graphrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#disk_io_graph.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DiskIoGraphStylerust-analyzer cargo bottom 0.14.9 options/config/style/disk_io_graph/DiskIoGraphStyle#>, |
| 91 | |
| 92 | /// Styling for the temperature graph widget. |
| 93 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) temp_graphrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#temp_graph.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TempGraphStylerust-analyzer cargo bottom 0.14.9 options/config/style/temp_graph/TempGraphStyle#>, |
| 94 | |
| 95 | /// Styling for the battery widget. |
| 96 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) batteryrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#battery.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<BatteryStylerust-analyzer cargo bottom 0.14.9 options/config/style/battery/BatteryStyle#>, |
| 97 | |
| 98 | /// Styling for table widgets. |
| 99 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) tablesrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#tables.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TableStylerust-analyzer cargo bottom 0.14.9 options/config/style/tables/TableStyle#>, |
| 100 | |
| 101 | /// Styling for graph widgets. |
| 102 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) graphsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#graphs.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<GraphStylerust-analyzer cargo bottom 0.14.9 options/config/style/graphs/GraphStyle#>, |
| 103 | |
| 104 | /// Styling for general widgets. |
| 105 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) widgetsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#widgets.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<WidgetStylerust-analyzer cargo bottom 0.14.9 options/config/style/widgets/WidgetStyle#>, |
| 106 | } |
| 107 | |
| 108 | /// The actual internal representation of the configured styles. |
| 109 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 110 | pub struct Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles# { |
| 111 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) ram_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#ram_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 112 | #[cfg(not(target_os = "windows"))] |
| 113 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) cache_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#cache_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 114 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) swap_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#swap_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 115 | #[cfg(feature = "zfs")] |
| 116 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) arc_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#arc_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 117 | #[cfg(feature = "gpu")] |
| 118 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) gpu_coloursrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#gpu_colours.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#>, |
| 119 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) rx_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#rx_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 120 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) tx_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#tx_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 121 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) total_rx_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#total_rx_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 122 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) total_tx_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#total_tx_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 123 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) all_cpu_colourrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#all_cpu_colour.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 124 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) avg_cpu_colourrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#avg_cpu_colour.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 125 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) cpu_colour_stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#cpu_colour_styles.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#>, |
| 126 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) temp_graph_colour_stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#temp_graph_colour_styles.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#>, |
| 127 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) disk_io_read_colour_stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#disk_io_read_colour_styles.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#>, |
| 128 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) disk_io_write_colour_stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#disk_io_write_colour_styles.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#>, |
| 129 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) border_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#border_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 130 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) highlighted_border_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#highlighted_border_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 131 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#text_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 132 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) selected_text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#selected_text_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 133 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) table_header_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#table_header_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 134 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) widget_title_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#widget_title_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 135 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) general_widget_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#general_widget_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 136 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) graph_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#graph_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 137 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) graph_legend_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#graph_legend_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 138 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) high_batteryrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#high_battery.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 139 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) medium_batteryrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#medium_battery.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 140 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) low_batteryrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#low_battery.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 141 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) invalid_query_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#invalid_query_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 142 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) disabled_text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#disabled_text_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 143 | #[cfg(target_os = "linux")] |
| 144 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) thread_text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#thread_text_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 145 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) border_typerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#border_type.: BorderTyperust-analyzer cargo ratatui-widgets 0.3.2 borders/BorderType#, |
| 146 | } |
| 147 | |
| 148 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles# { |
| 149 | fn defaultrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles][Default]default().() -> Selfrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles][Default] { |
| 150 | Selfrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles][Default]::default_paletterust-analyzer cargo bottom 0.14.9 options/config/style/themes/default/impl#[Styles]default_palette().() |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | impl Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles# { |
| 155 | pub fn newrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]new().(args: &BottomArgsrust-analyzer cargo bottom 0.14.9 options/args/BottomArgs#, config: &Configrust-analyzer cargo bottom 0.14.9 options/config/Config#) -> anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Resultrust-analyzer cargo anyhow 1.0.104 Result#<Selfrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]> { |
| 156 | let mut palette = match &args.stylerust-analyzer cargo bottom 0.14.9 options/args/BottomArgs#style..themerust-analyzer cargo bottom 0.14.9 options/args/StyleArgs#theme. { |
| 157 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(theme) => Selfrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]::from_themerust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]from_theme().(theme)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 158 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => match config.stylesrust-analyzer cargo bottom 0.14.9 options/config/Config#styles..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|s| s.themerust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#theme..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()) { |
| 159 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(theme) => Selfrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]::from_themerust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]from_theme().(theme)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 160 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Selfrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]::defaultrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles][Default]default().(), |
| 161 | }, |
| 162 | }; |
| 163 | |
| 164 | // Apply theme from config on top. |
| 165 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(config_style) = &config.stylesrust-analyzer cargo bottom 0.14.9 options/config/Config#styles. { |
| 166 | palette.set_styles_from_configrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]set_styles_from_config().(config_style)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 167 | } |
| 168 | |
| 169 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(palette) |
| 170 | } |
| 171 | |
| 172 | fn from_themerust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]from_theme().(theme: &str) -> anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Resultrust-analyzer cargo anyhow 1.0.104 Result#<Selfrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]> { |
| 173 | let lower_case = theme.to_lowercaserust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]to_lowercase().(); |
| 174 | match lower_case.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().() { |
| 175 | "default" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]::default_paletterust-analyzer cargo bottom 0.14.9 options/config/style/themes/default/impl#[Styles]default_palette().()), |
| 176 | "default-light" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]::default_light_paletterust-analyzer cargo bottom 0.14.9 options/config/style/themes/default/impl#[Styles]default_light_palette().()), |
| 177 | "gruvbox" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]::gruvbox_paletterust-analyzer cargo bottom 0.14.9 options/config/style/themes/gruvbox/impl#[Styles]gruvbox_palette().()), |
| 178 | "gruvbox-light" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]::gruvbox_light_paletterust-analyzer cargo bottom 0.14.9 options/config/style/themes/gruvbox/impl#[Styles]gruvbox_light_palette().()), |
| 179 | "nord" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]::nord_paletterust-analyzer cargo bottom 0.14.9 options/config/style/themes/nord/impl#[Styles]nord_palette().()), |
| 180 | "nord-light" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]::nord_light_paletterust-analyzer cargo bottom 0.14.9 options/config/style/themes/nord/impl#[Styles]nord_light_palette().()), |
| 181 | _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(OptionErrorrust-analyzer cargo bottom 0.14.9 options/error/OptionError#::otherrust-analyzer cargo bottom 0.14.9 options/error/impl#[OptionError]other().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 182 | "'{theme}' is an invalid built-in colour scheme." |
| 183 | )) |
| 184 | .intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()), |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | fn set_styles_from_configrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]set_styles_from_config().(&mut self, config: &StyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#) -> OptionResultrust-analyzer cargo bottom 0.14.9 options/error/OptionResult#<()> { |
| 189 | // CPU |
| 190 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.avg_cpu_colourrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#avg_cpu_colour., config.cpurust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#cpu., avg_entry_colourrust-analyzer cargo bottom 0.14.9 options/config/style/cpu/CpuStyle#avg_entry_colour.); |
| 191 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.all_cpu_colourrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#all_cpu_colour., config.cpurust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#cpu., all_entry_colourrust-analyzer cargo bottom 0.14.9 options/config/style/cpu/CpuStyle#all_entry_colour.); |
| 192 | set_colour_listrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour_list!!(self.cpu_colour_stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#cpu_colour_styles., config.cpurust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#cpu., cpu_core_coloursrust-analyzer cargo bottom 0.14.9 options/config/style/cpu/CpuStyle#cpu_core_colours.); |
| 193 | |
| 194 | // Temperature graph |
| 195 | set_colour_listrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour_list!!( |
| 196 | self.temp_graph_colour_stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#temp_graph_colour_styles., |
| 197 | config.temp_graphrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#temp_graph., |
| 198 | temp_graph_colour_stylesrust-analyzer cargo bottom 0.14.9 options/config/style/temp_graph/TempGraphStyle#temp_graph_colour_styles. |
| 199 | ); |
| 200 | |
| 201 | // Disk I/O graph |
| 202 | set_colour_listrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour_list!!( |
| 203 | self.disk_io_read_colour_stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#disk_io_read_colour_styles., |
| 204 | config.disk_io_graphrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#disk_io_graph., |
| 205 | read_coloursrust-analyzer cargo bottom 0.14.9 options/config/style/disk_io_graph/DiskIoGraphStyle#read_colours. |
| 206 | ); |
| 207 | set_colour_listrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour_list!!( |
| 208 | self.disk_io_write_colour_stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#disk_io_write_colour_styles., |
| 209 | config.disk_io_graphrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#disk_io_graph., |
| 210 | write_coloursrust-analyzer cargo bottom 0.14.9 options/config/style/disk_io_graph/DiskIoGraphStyle#write_colours. |
| 211 | ); |
| 212 | |
| 213 | // Memory |
| 214 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.ram_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#ram_style., config.memoryrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#memory., ram_colourrust-analyzer cargo bottom 0.14.9 options/config/style/memory/MemoryStyle#ram_colour.); |
| 215 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.swap_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#swap_style., config.memoryrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#memory., swap_colourrust-analyzer cargo bottom 0.14.9 options/config/style/memory/MemoryStyle#swap_colour.); |
| 216 | |
| 217 | #[cfg(not(target_os = "windows"))] |
| 218 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.cache_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#cache_style., config.memoryrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#memory., cache_colourrust-analyzer cargo bottom 0.14.9 options/config/style/memory/MemoryStyle#cache_colour.); |
| 219 | |
| 220 | #[cfg(feature = "zfs")] |
| 221 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.arc_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#arc_style., config.memoryrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#memory., arc_colourrust-analyzer cargo bottom 0.14.9 options/config/style/memory/MemoryStyle#arc_colour.); |
| 222 | |
| 223 | #[cfg(feature = "gpu")] |
| 224 | set_colour_listrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour_list!!(self.gpu_coloursrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#gpu_colours., config.memoryrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#memory., gpu_coloursrust-analyzer cargo bottom 0.14.9 options/config/style/memory/MemoryStyle#gpu_colours.); |
| 225 | |
| 226 | // Network |
| 227 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.rx_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#rx_style., config.networkrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#network., rx_colourrust-analyzer cargo bottom 0.14.9 options/config/style/network/NetworkStyle#rx_colour.); |
| 228 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.tx_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#tx_style., config.networkrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#network., tx_colourrust-analyzer cargo bottom 0.14.9 options/config/style/network/NetworkStyle#tx_colour.); |
| 229 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.total_rx_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#total_rx_style., config.networkrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#network., rx_total_colourrust-analyzer cargo bottom 0.14.9 options/config/style/network/NetworkStyle#rx_total_colour.); |
| 230 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.total_tx_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#total_tx_style., config.networkrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#network., tx_total_colourrust-analyzer cargo bottom 0.14.9 options/config/style/network/NetworkStyle#tx_total_colour.); |
| 231 | |
| 232 | // Battery |
| 233 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.high_batteryrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#high_battery., config.batteryrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#battery., high_battery_colourrust-analyzer cargo bottom 0.14.9 options/config/style/battery/BatteryStyle#high_battery_colour.); |
| 234 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.medium_batteryrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#medium_battery., config.batteryrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#battery., medium_battery_colourrust-analyzer cargo bottom 0.14.9 options/config/style/battery/BatteryStyle#medium_battery_colour.); |
| 235 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.low_batteryrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#low_battery., config.batteryrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#battery., low_battery_colourrust-analyzer cargo bottom 0.14.9 options/config/style/battery/BatteryStyle#low_battery_colour.); |
| 236 | |
| 237 | // Tables |
| 238 | set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!!(self.table_header_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#table_header_style., config.tablesrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#tables., headersrust-analyzer cargo bottom 0.14.9 options/config/style/tables/TableStyle#headers.); |
| 239 | |
| 240 | // Widget graphs |
| 241 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.graph_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#graph_style., config.graphsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#graphs., graph_colourrust-analyzer cargo bottom 0.14.9 options/config/style/graphs/GraphStyle#graph_colour.); |
| 242 | set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!!(self.graph_legend_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#graph_legend_style., config.graphsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#graphs., legend_textrust-analyzer cargo bottom 0.14.9 options/config/style/graphs/GraphStyle#legend_text.); |
| 243 | |
| 244 | // General widget text. |
| 245 | set_bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_bg_colour!!(self.general_widget_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#general_widget_style., config.widgetsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#widgets., bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/widgets/WidgetStyle#bg_colour.); |
| 246 | set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!!(self.widget_title_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#widget_title_style., config.widgetsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#widgets., widget_titlerust-analyzer cargo bottom 0.14.9 options/config/style/widgets/WidgetStyle#widget_title.); |
| 247 | set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!!(self.text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#text_style., config.widgetsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#widgets., textrust-analyzer cargo bottom 0.14.9 options/config/style/widgets/WidgetStyle#text.); |
| 248 | set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!!(self.selected_text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#selected_text_style., config.widgetsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#widgets., selected_textrust-analyzer cargo bottom 0.14.9 options/config/style/widgets/WidgetStyle#selected_text.); |
| 249 | set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!!(self.disabled_text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#disabled_text_style., config.widgetsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#widgets., disabled_textrust-analyzer cargo bottom 0.14.9 options/config/style/widgets/WidgetStyle#disabled_text.); |
| 250 | |
| 251 | #[cfg(target_os = "linux")] |
| 252 | { |
| 253 | set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!!(self.thread_text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#thread_text_style., config.widgetsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#widgets., thread_textrust-analyzer cargo bottom 0.14.9 options/config/style/widgets/WidgetStyle#thread_text.); |
| 254 | } |
| 255 | |
| 256 | // Widget borders |
| 257 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(self.border_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#border_style., config.widgetsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#widgets., border_colourrust-analyzer cargo bottom 0.14.9 options/config/style/widgets/WidgetStyle#border_colour.); |
| 258 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!( |
| 259 | self.highlighted_border_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#highlighted_border_style., |
| 260 | config.widgetsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#widgets., |
| 261 | selected_border_colourrust-analyzer cargo bottom 0.14.9 options/config/style/widgets/WidgetStyle#selected_border_colour. |
| 262 | ); |
| 263 | |
| 264 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(widgets) = &config.widgetsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#widgets. |
| 265 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(widget_borders) = widgets.widget_border_typerust-analyzer cargo bottom 0.14.9 options/config/style/widgets/WidgetStyle#widget_border_type. |
| 266 | { |
| 267 | self.border_typerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#border_type. = widget_borders.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 268 | } |
| 269 | |
| 270 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | #[cfg(test)] |
| 275 | mod testrust-analyzer cargo bottom 0.14.9 options/config/style/test/ { |
| 276 | |
| 277 | use ratatuirust-analyzer cargo ratatui 0.30.2 crate/::stylerust-analyzer cargo ratatui-core 0.1.2 style/::{Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#, Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#}; |
| 278 | |
| 279 | use superrust-analyzer cargo bottom 0.14.9 options/config/style/::Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#; |
| 280 | use craterust-analyzer cargo bottom 0.14.9 crate/::optionsrust-analyzer cargo bottom 0.14.9 options/::configrust-analyzer cargo bottom 0.14.9 options/config/::{Configrust-analyzer cargo bottom 0.14.9 options/config/Config#, stylerust-analyzer cargo bottom 0.14.9 options/config/style/::utilsrust-analyzer cargo bottom 0.14.9 options/config/style/utils/::str_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/str_to_colour().}; |
| 281 | |
| 282 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 283 | fn color_spelling_aliases_workrust-analyzer cargo bottom 0.14.9 options/config/style/test/color_spelling_aliases_work().() { |
| 284 | // Parse all_styling_color.toml (which uses the "color" alias spelling throughout) |
| 285 | // and assert every field was actually parsed. |
| 286 | let toml_str = include_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/include_str!!("../../../tests/valid_configs/all_styling_color.toml"); |
| 287 | let config = toml_editrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 crate/::derust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/::from_strrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/from_str().::<Configrust-analyzer cargo bottom 0.14.9 options/config/Config#>(toml_str) |
| 288 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("config file should parse") |
| 289 | .stylesrust-analyzer cargo bottom 0.14.9 options/config/Config#styles. |
| 290 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("styles section should be present"); |
| 291 | |
| 292 | let cpu = config.cpurust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#cpu..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 293 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(cpu.all_entry_colourrust-analyzer cargo bottom 0.14.9 options/config/style/cpu/CpuStyle#all_entry_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 294 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(cpu.avg_entry_colourrust-analyzer cargo bottom 0.14.9 options/config/style/cpu/CpuStyle#avg_entry_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 295 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(cpu.cpu_core_coloursrust-analyzer cargo bottom 0.14.9 options/config/style/cpu/CpuStyle#cpu_core_colours..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 296 | |
| 297 | let temp = config.temp_graphrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#temp_graph..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 298 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(temp.temp_graph_colour_stylesrust-analyzer cargo bottom 0.14.9 options/config/style/temp_graph/TempGraphStyle#temp_graph_colour_styles..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 299 | |
| 300 | let mem = config.memoryrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#memory..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 301 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(mem.ram_colourrust-analyzer cargo bottom 0.14.9 options/config/style/memory/MemoryStyle#ram_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 302 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(mem.cache_colourrust-analyzer cargo bottom 0.14.9 options/config/style/memory/MemoryStyle#cache_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 303 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(mem.swap_colourrust-analyzer cargo bottom 0.14.9 options/config/style/memory/MemoryStyle#swap_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 304 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(mem.arc_colourrust-analyzer cargo bottom 0.14.9 options/config/style/memory/MemoryStyle#arc_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 305 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(mem.gpu_coloursrust-analyzer cargo bottom 0.14.9 options/config/style/memory/MemoryStyle#gpu_colours..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 306 | |
| 307 | let net = config.networkrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#network..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 308 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(net.rx_colourrust-analyzer cargo bottom 0.14.9 options/config/style/network/NetworkStyle#rx_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 309 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(net.tx_colourrust-analyzer cargo bottom 0.14.9 options/config/style/network/NetworkStyle#tx_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 310 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(net.rx_total_colourrust-analyzer cargo bottom 0.14.9 options/config/style/network/NetworkStyle#rx_total_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 311 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(net.tx_total_colourrust-analyzer cargo bottom 0.14.9 options/config/style/network/NetworkStyle#tx_total_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 312 | |
| 313 | let bat = config.batteryrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#battery..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 314 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(bat.high_battery_colourrust-analyzer cargo bottom 0.14.9 options/config/style/battery/BatteryStyle#high_battery_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 315 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(bat.medium_battery_colourrust-analyzer cargo bottom 0.14.9 options/config/style/battery/BatteryStyle#medium_battery_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 316 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(bat.low_battery_colourrust-analyzer cargo bottom 0.14.9 options/config/style/battery/BatteryStyle#low_battery_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 317 | |
| 318 | let graphs = config.graphsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#graphs..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 319 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(graphs.graph_colourrust-analyzer cargo bottom 0.14.9 options/config/style/graphs/GraphStyle#graph_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 320 | |
| 321 | let widgets = config.widgetsrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#widgets..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 322 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(widgets.border_colourrust-analyzer cargo bottom 0.14.9 options/config/style/widgets/WidgetStyle#border_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 323 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(widgets.selected_border_colourrust-analyzer cargo bottom 0.14.9 options/config/style/widgets/WidgetStyle#selected_border_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 324 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(widgets.bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/widgets/WidgetStyle#bg_colour..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()); |
| 325 | } |
| 326 | |
| 327 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 328 | fn default_selected_colour_worksrust-analyzer cargo bottom 0.14.9 options/config/style/test/default_selected_colour_works().() { |
| 329 | let mut colours = Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#::defaultrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles][Default]default().(); |
| 330 | let original_selected_text_colour = |
| 331 | Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#::default_paletterust-analyzer cargo bottom 0.14.9 options/config/style/themes/default/impl#[Styles]default_palette().().selected_text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#selected_text_style..fgrust-analyzer cargo ratatui-core 0.1.2 style/Style#fg..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 332 | let original_selected_bg_colour = Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#::default_paletterust-analyzer cargo bottom 0.14.9 options/config/style/themes/default/impl#[Styles]default_palette().().selected_text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#selected_text_style..bgrust-analyzer cargo ratatui-core 0.1.2 style/Style#bg..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 333 | |
| 334 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 335 | colours.selected_text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#selected_text_style., |
| 336 | Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#::defaultrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style][Default]default().() |
| 337 | .fgrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]fg().(original_selected_text_colour) |
| 338 | .bgrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]bg().(original_selected_bg_colour), |
| 339 | ); |
| 340 | |
| 341 | colours.selected_text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#selected_text_style. = colours |
| 342 | .selected_text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#selected_text_style. |
| 343 | .fgrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]fg().(str_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/str_to_colour().("magenta").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()) |
| 344 | .bgrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]bg().(str_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/str_to_colour().("red").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 345 | |
| 346 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 347 | colours.selected_text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#selected_text_style., |
| 348 | Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#::defaultrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style][Default]default().().fgrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]fg().(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Magentarust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Magenta#).bgrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]bg().(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Redrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Red#), |
| 349 | ); |
| 350 | } |
| 351 | |
| 352 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 353 | fn built_in_colour_schemes_workrust-analyzer cargo bottom 0.14.9 options/config/style/test/built_in_colour_schemes_work().() { |
| 354 | Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#::from_themerust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]from_theme().("default").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 355 | Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#::from_themerust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]from_theme().("default-light").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 356 | Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#::from_themerust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]from_theme().("gruvbox").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 357 | Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#::from_themerust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]from_theme().("gruvbox-light").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 358 | Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#::from_themerust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]from_theme().("nord").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 359 | Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#::from_themerust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles]from_theme().("nord-light").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 360 | } |
| 361 | } |