| 1 | use ratatui::{ |
| 2 | style::{Color, Modifier, Style}, |
| 3 | widgets::BorderType, |
| 4 | }; |
| 5 | |
| 6 | use super::{colour, hex}; |
| 7 | use crate::options::config::style::{Styles, themes::hex_colour}; |
| 8 | |
| 9 | impl Styles { |
| 10 | pub(crate) fn nord_palette() -> Self { |
| 11 | let list_colours = vec![ |
| 12 | hex!("#5e81ac"), |
| 13 | hex!("#81a1c1"), |
| 14 | hex!("#d8dee9"), |
| 15 | hex!("#b48ead"), |
| 16 | hex!("#a3be8c"), |
| 17 | hex!("#ebcb8b"), |
| 18 | hex!("#d08770"), |
| 19 | hex!("#bf616a"), |
| 20 | ]; |
| 21 | |
| 22 | let second_colours_list = vec![ |
| 23 | hex!("#8fbcbb"), |
| 24 | hex!("#81a1c1"), |
| 25 | hex!("#d8dee9"), |
| 26 | hex!("#b48ead"), |
| 27 | hex!("#a3be8c"), |
| 28 | hex!("#ebcb8b"), |
| 29 | hex!("#bf616a"), |
| 30 | ]; |
| 31 | |
| 32 | Self { |
| 33 | ram_style: hex!("#88c0d0"), |
| 34 | #[cfg(not(target_os = "windows"))] |
| 35 | cache_style: hex!("#d8dee9"), |
| 36 | swap_style: hex!("#d08770"), |
| 37 | #[cfg(feature = "zfs")] |
| 38 | arc_style: hex!("#5e81ac"), |
| 39 | #[cfg(feature = "gpu")] |
| 40 | gpu_colours: second_colours_list.clone(), |
| 41 | rx_style: hex!("#88c0d0"), |
| 42 | tx_style: hex!("#d08770"), |
| 43 | total_rx_style: hex!("#5e81ac"), |
| 44 | total_tx_style: hex!("#8fbcbb"), |
| 45 | all_cpu_colour: hex!("#88c0d0"), |
| 46 | avg_cpu_colour: hex!("#8fbcbb"), |
| 47 | cpu_colour_styles: list_colours.clone(), |
| 48 | temp_graph_colour_styles: list_colours.clone(), |
| 49 | disk_io_read_colour_styles: list_colours, |
| 50 | disk_io_write_colour_styles: second_colours_list, |
| 51 | border_style: hex!("#88c0d0"), |
| 52 | highlighted_border_style: hex!("#5e81ac"), |
| 53 | text_style: hex!("#e5e9f0"), |
| 54 | selected_text_style: hex!("#2e3440").bg(hex_colour!("#88c0d0")), |
| 55 | table_header_style: hex!("#81a1c1").add_modifier(Modifier::BOLD), |
| 56 | general_widget_style: Style::default(), |
| 57 | widget_title_style: hex!("#e5e9f0"), |
| 58 | graph_style: hex!("#e5e9f0"), |
| 59 | graph_legend_style: hex!("#e5e9f0"), |
| 60 | high_battery: hex!("#a3be8c"), |
| 61 | medium_battery: hex!("#ebcb8b"), |
| 62 | low_battery: hex!("#bf616a"), |
| 63 | invalid_query_style: colour!(Color::Red), |
| 64 | disabled_text_style: hex!("#4c566a"), |
| 65 | border_type: BorderType::Plain, |
| 66 | #[cfg(target_os = "linux")] |
| 67 | thread_text_style: hex!("#a3be8c"), |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | pub(crate) fn nord_light_palette() -> Self { |
| 72 | let list_colours = vec![ |
| 73 | hex!("#5e81ac"), |
| 74 | hex!("#88c0d0"), |
| 75 | hex!("#4c566a"), |
| 76 | hex!("#b48ead"), |
| 77 | hex!("#a3be8c"), |
| 78 | hex!("#ebcb8b"), |
| 79 | hex!("#d08770"), |
| 80 | hex!("#bf616a"), |
| 81 | ]; |
| 82 | |
| 83 | let second_colours_list = vec![ |
| 84 | hex!("#8fbcbb"), |
| 85 | hex!("#88c0d0"), |
| 86 | hex!("#4c566a"), |
| 87 | hex!("#b48ead"), |
| 88 | hex!("#a3be8c"), |
| 89 | hex!("#ebcb8b"), |
| 90 | hex!("#bf616a"), |
| 91 | ]; |
| 92 | |
| 93 | Self { |
| 94 | ram_style: hex!("#81a1c1"), |
| 95 | #[cfg(not(target_os = "windows"))] |
| 96 | cache_style: hex!("#4c566a"), |
| 97 | swap_style: hex!("#d08770"), |
| 98 | #[cfg(feature = "zfs")] |
| 99 | arc_style: hex!("#5e81ac"), |
| 100 | #[cfg(feature = "gpu")] |
| 101 | gpu_colours: second_colours_list.clone(), |
| 102 | rx_style: hex!("#81a1c1"), |
| 103 | tx_style: hex!("#d08770"), |
| 104 | total_rx_style: hex!("#5e81ac"), |
| 105 | total_tx_style: hex!("#8fbcbb"), |
| 106 | all_cpu_colour: hex!("#81a1c1"), |
| 107 | avg_cpu_colour: hex!("#8fbcbb"), |
| 108 | cpu_colour_styles: list_colours.clone(), |
| 109 | temp_graph_colour_styles: list_colours.clone(), |
| 110 | disk_io_read_colour_styles: list_colours, |
| 111 | disk_io_write_colour_styles: second_colours_list, |
| 112 | border_style: hex!("#2e3440"), |
| 113 | highlighted_border_style: hex!("#5e81ac"), |
| 114 | text_style: hex!("#2e3440"), |
| 115 | selected_text_style: hex!("#f5f5f5").bg(hex_colour!("#5e81ac")), |
| 116 | table_header_style: hex!("#5e81ac").add_modifier(Modifier::BOLD), |
| 117 | general_widget_style: Style::default(), |
| 118 | widget_title_style: hex!("#2e3440"), |
| 119 | graph_style: hex!("#2e3440"), |
| 120 | graph_legend_style: hex!("#2e3440"), |
| 121 | high_battery: hex!("#a3be8c"), |
| 122 | medium_battery: hex!("#ebcb8b"), |
| 123 | low_battery: hex!("#bf616a"), |
| 124 | invalid_query_style: colour!(Color::Red), |
| 125 | disabled_text_style: hex!("#d8dee9"), |
| 126 | border_type: BorderType::Plain, |
| 127 | #[cfg(target_os = "linux")] |
| 128 | thread_text_style: hex!("#a3be8c"), |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | #[cfg(test)] |
| 134 | mod tests { |
| 135 | #[test] |
| 136 | fn nord_palettes_valid() { |
| 137 | let _ = super::Styles::nord_palette(); |
| 138 | let _ = super::Styles::nord_light_palette(); |
| 139 | } |
| 140 | } |