| 1 | use concat_stringrust-analyzer cargo concat-string 1.0.1 crate/::concat_stringrust-analyzer cargo concat-string 1.0.1 concat_string!; |
| 2 | 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#; |
| 3 | use unicode_segmentationrust-analyzer cargo unicode-segmentation 1.13.3 crate/::UnicodeSegmentationrust-analyzer cargo unicode-segmentation 1.13.3 UnicodeSegmentation#; |
| 4 | |
| 5 | /// Convert a hex string to a colour. |
| 6 | pub(superrust-analyzer cargo bottom 0.14.9 options/config/style/) fn try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().(hex: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 7 | fn hex_component_to_intrust-analyzer cargo bottom 0.14.9 options/config/style/utils/hex_component_to_int().(hex: &str, first: &str, second: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<u8, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 8 | u8::from_str_radixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]from_str_radix().(&concat_stringrust-analyzer cargo concat-string 1.0.1 concat_string!!(first, second), 16) |
| 9 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("'{hex}' is an invalid hex colour, could not decode.")) |
| 10 | } |
| 11 | |
| 12 | fn invalid_hex_formatrust-analyzer cargo bottom 0.14.9 options/config/style/utils/invalid_hex_format().(hex: &str) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 13 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 14 | "'{hex}' is an invalid hex colour. It must be either a 7 character hex string of the form '#12ab3c' or a 3 character hex string of the form '#1a2'.", |
| 15 | ) |
| 16 | } |
| 17 | |
| 18 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().hex.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('#') { |
| 19 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(invalid_hex_formatrust-analyzer cargo bottom 0.14.9 options/config/style/utils/invalid_hex_format().(hex)); |
| 20 | } |
| 21 | |
| 22 | let components: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str> = hex.graphemesrust-analyzer cargo unicode-segmentation 1.13.3 impl#[str][UnicodeSegmentation]graphemes().(true).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 23 | if components.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().7 { |
| 24 | // A 6-long hex. |
| 25 | let r = hex_component_to_intrust-analyzer cargo bottom 0.14.9 options/config/style/utils/hex_component_to_int().(hex, components[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., components[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 26 | let g = hex_component_to_intrust-analyzer cargo bottom 0.14.9 options/config/style/utils/hex_component_to_int().(hex, components[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().3]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., components[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().4]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 27 | let b = hex_component_to_intrust-analyzer cargo bottom 0.14.9 options/config/style/utils/hex_component_to_int().(hex, components[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().5]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., components[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().6]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 28 | |
| 29 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(r, g, b)) |
| 30 | } else if components.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().4 { |
| 31 | // A 3-long hex. |
| 32 | let r = hex_component_to_intrust-analyzer cargo bottom 0.14.9 options/config/style/utils/hex_component_to_int().(hex, components[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., components[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 33 | let g = hex_component_to_intrust-analyzer cargo bottom 0.14.9 options/config/style/utils/hex_component_to_int().(hex, components[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., components[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 34 | let b = hex_component_to_intrust-analyzer cargo bottom 0.14.9 options/config/style/utils/hex_component_to_int().(hex, components[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().3]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., components[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().3]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 35 | |
| 36 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(r, g, b)) |
| 37 | } else { |
| 38 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(invalid_hex_formatrust-analyzer cargo bottom 0.14.9 options/config/style/utils/invalid_hex_format().(hex)) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | pub fn str_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/str_to_colour().(input_val: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 43 | if input_val.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().1 { |
| 44 | if input_val.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('#') { |
| 45 | try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().(input_val) |
| 46 | } else if input_val.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().(',') { |
| 47 | convert_rgb_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_rgb_to_colour().(input_val) |
| 48 | } else { |
| 49 | convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().(input_val) |
| 50 | } |
| 51 | } else { |
| 52 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("Value '{input_val}' is not valid.",)) |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | fn convert_rgb_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_rgb_to_colour().(rgb_str: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 57 | let rgb_list = rgb_str.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().(',').collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str>>(); |
| 58 | if rgb_list.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().3 { |
| 59 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 60 | "Value '{rgb_str}' is an invalid RGB colour. It must be a comma separated value with 3 integers from 0 to 255 (ie: '255, 0, 155').", |
| 61 | )); |
| 62 | } |
| 63 | |
| 64 | let rgb = rgb_list |
| 65 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 66 | .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|val| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().val)).to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().().trimrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim().().parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u8>().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()) |
| 67 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(); |
| 68 | |
| 69 | if rgb.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().3 { |
| 70 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(rgb[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., rgb[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., rgb[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().)) |
| 71 | } else { |
| 72 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 73 | "Value '{rgb_str}' contained invalid RGB values. It must be a comma separated value with 3 integers from 0 to 255 (ie: '255, 0, 155').", |
| 74 | )) |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | fn convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().(colour_name: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 79 | match colour_name.to_lowercaserust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]to_lowercase().().trimrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim().() { |
| 80 | "reset" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Resetrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Reset#), |
| 81 | "black" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Blackrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Black#), |
| 82 | "red" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Redrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Red#), |
| 83 | "green" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Greenrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Green#), |
| 84 | "yellow" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Yellowrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Yellow#), |
| 85 | "blue" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Bluerust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Blue#), |
| 86 | "magenta" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Magentarust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Magenta#), |
| 87 | "cyan" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Cyanrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Cyan#), |
| 88 | "gray" | "grey" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Grayrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Gray#), |
| 89 | "darkgray" | "darkgrey" | "dark gray" | "dark grey" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::DarkGrayrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#DarkGray#), |
| 90 | "lightred" | "light red" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::LightRedrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#LightRed#), |
| 91 | "lightgreen" | "light green" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::LightGreenrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#LightGreen#), |
| 92 | "lightyellow" | "light yellow" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::LightYellowrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#LightYellow#), |
| 93 | "lightblue" | "light blue" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::LightBluerust-analyzer cargo ratatui-core 0.1.2 style/color/Color#LightBlue#), |
| 94 | "lightmagenta" | "light magenta" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::LightMagentarust-analyzer cargo ratatui-core 0.1.2 style/color/Color#LightMagenta#), |
| 95 | "lightcyan" | "light cyan" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::LightCyanrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#LightCyan#), |
| 96 | "white" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Whiterust-analyzer cargo ratatui-core 0.1.2 style/color/Color#White#), |
| 97 | _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 98 | "'{colour_name}' is an invalid named colour. |
| 99 | |
| 100 | The following are supported named colours: |
| 101 | +--------+-------------+---------------------+ |
| 102 | | Reset | Magenta | Light Yellow | |
| 103 | +--------+-------------+---------------------+ |
| 104 | | Black | Cyan | Light Blue | |
| 105 | +--------+-------------+---------------------+ |
| 106 | | Red | Gray/Grey | Light Magenta | |
| 107 | +--------+-------------+---------------------+ |
| 108 | | Green | Light Cyan | Dark Gray/Dark Grey | |
| 109 | +--------+-------------+---------------------+ |
| 110 | | Yellow | Light Red | White | |
| 111 | +--------+-------------+---------------------+ |
| 112 | | Blue | Light Green | | |
| 113 | +--------+-------------+---------------------+ |
| 114 | |
| 115 | Alternatively, hex colours or RGB colour codes are valid.\n" |
| 116 | )), |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | macro_rules! optrust-analyzer cargo bottom 0.14.9 options/config/style/utils/opt! { |
| 121 | ($($e: tt)+) => { |
| 122 | (|| { $($e)+ })() |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | macro_rules! set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style! { |
| 127 | ($palette_field:expr, $config_location:expr, $field:tt) => { |
| 128 | if let Some(style) = &(opt!($config_location.as_ref()?.$field.as_ref())) { |
| 129 | match &style { |
| 130 | TextStyleConfig::Colour(colour) => { |
| 131 | $palette_field = $palette_field.fg( |
| 132 | crate::options::config::style::utils::str_to_colour(&colour.0).map_err( |
| 133 | |err| match stringify!($config_location).split_once(".") { |
| 134 | Some((_, loc)) => crate::options::OptionError::config(format!( |
| 135 | "Please update 'styles.{loc}.{}' in your config file. {err}", |
| 136 | stringify!($field) |
| 137 | )), |
| 138 | None => crate::options::OptionError::config(format!( |
| 139 | "Please update 'styles.{}' in your config file. {err}", |
| 140 | stringify!($field) |
| 141 | )), |
| 142 | }, |
| 143 | )?, |
| 144 | ); |
| 145 | } |
| 146 | TextStyleConfig::TextStyle { |
| 147 | colour, |
| 148 | bg_colour, |
| 149 | bold, |
| 150 | italics, |
| 151 | } => { |
| 152 | if let Some(fg) = &colour { |
| 153 | $palette_field = $palette_field |
| 154 | .fg(crate::options::config::style::utils::str_to_colour( |
| 155 | &fg.0, |
| 156 | ) |
| 157 | .map_err(|err| { |
| 158 | match stringify!($config_location).split_once(".") { |
| 159 | Some((_, loc)) => crate::options::OptionError::config(format!( |
| 160 | "Please update 'styles.{loc}.{}' in your config file. {err}", |
| 161 | stringify!($field) |
| 162 | )), |
| 163 | None => crate::options::OptionError::config(format!( |
| 164 | "Please update 'styles.{}' in your config file. {err}", |
| 165 | stringify!($field) |
| 166 | )), |
| 167 | } |
| 168 | })?); |
| 169 | } |
| 170 | |
| 171 | if let Some(bg) = &bg_colour { |
| 172 | $palette_field = $palette_field |
| 173 | .bg(crate::options::config::style::utils::str_to_colour( |
| 174 | &bg.0, |
| 175 | ) |
| 176 | .map_err(|err| { |
| 177 | match stringify!($config_location).split_once(".") { |
| 178 | Some((_, loc)) => crate::options::OptionError::config(format!( |
| 179 | "Please update 'styles.{loc}.{}' in your config file. {err}", |
| 180 | stringify!($field) |
| 181 | )), |
| 182 | None => crate::options::OptionError::config(format!( |
| 183 | "Please update 'styles.{}' in your config file. {err}", |
| 184 | stringify!($field) |
| 185 | )), |
| 186 | } |
| 187 | })?); |
| 188 | } |
| 189 | |
| 190 | if let Some(bold) = &bold { |
| 191 | if *bold { |
| 192 | $palette_field = |
| 193 | $palette_field.add_modifier(ratatui::style::Modifier::BOLD); |
| 194 | } else { |
| 195 | $palette_field = |
| 196 | $palette_field.remove_modifier(ratatui::style::Modifier::BOLD); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | if let Some(italics) = &italics { |
| 201 | if *italics { |
| 202 | $palette_field = |
| 203 | $palette_field.add_modifier(ratatui::style::Modifier::ITALIC); |
| 204 | } else { |
| 205 | $palette_field = |
| 206 | $palette_field.remove_modifier(ratatui::style::Modifier::ITALIC); |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | }; |
| 213 | } |
| 214 | |
| 215 | macro_rules! set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour! { |
| 216 | ($palette_field:expr, $config_location:expr, $field:tt) => { |
| 217 | if let Some(colour) = &(opt!($config_location.as_ref()?.$field.as_ref())) { |
| 218 | $palette_field = $palette_field.fg( |
| 219 | crate::options::config::style::utils::str_to_colour(&colour.0).map_err(|err| { |
| 220 | match stringify!($config_location).split_once(".") { |
| 221 | Some((_, loc)) => crate::options::OptionError::config(format!( |
| 222 | "Please update 'styles.{loc}.{}' in your config file. {err}", |
| 223 | stringify!($field) |
| 224 | )), |
| 225 | None => crate::options::OptionError::config(format!( |
| 226 | "Please update 'styles.{}' in your config file. {err}", |
| 227 | stringify!($field) |
| 228 | )), |
| 229 | } |
| 230 | })?, |
| 231 | ); |
| 232 | } |
| 233 | }; |
| 234 | } |
| 235 | |
| 236 | macro_rules! set_bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_bg_colour! { |
| 237 | ($palette_field:expr, $config_location:expr, $field:tt) => { |
| 238 | if let Some(colour) = &(opt!($config_location.as_ref()?.$field.as_ref())) { |
| 239 | $palette_field = $palette_field.bg( |
| 240 | crate::options::config::style::utils::str_to_colour(&colour.0).map_err(|err| { |
| 241 | match stringify!($config_location).split_once(".") { |
| 242 | Some((_, loc)) => crate::options::OptionError::config(format!( |
| 243 | "Please update 'styles.{loc}.{}' in your config file. {err}", |
| 244 | stringify!($field) |
| 245 | )), |
| 246 | None => crate::options::OptionError::config(format!( |
| 247 | "Please update 'styles.{}' in your config file. {err}", |
| 248 | stringify!($field) |
| 249 | )), |
| 250 | } |
| 251 | })?, |
| 252 | ); |
| 253 | } |
| 254 | }; |
| 255 | } |
| 256 | |
| 257 | /// Set `palette_field` to the value in `config_location` for `field`. |
| 258 | macro_rules! set_colour_listrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour_list! { |
| 259 | ($palette_field:expr, $config_location:expr, $field:tt) => { |
| 260 | if let Some(colour_list) = &(opt!($config_location.as_ref()?.$field.as_ref())) { |
| 261 | $palette_field = colour_list |
| 262 | .iter() |
| 263 | .map(|s| { |
| 264 | Ok(Style::default() |
| 265 | .fg(crate::options::config::style::utils::str_to_colour(&s.0)?)) |
| 266 | }) |
| 267 | .collect::<Result<Vec<Style>, String>>() |
| 268 | .map_err(|err| match stringify!($config_location).split_once(".") { |
| 269 | Some((_, loc)) => crate::options::OptionError::config(format!( |
| 270 | "Please update 'styles.{loc}.{}' in your config file. {err}", |
| 271 | stringify!($field) |
| 272 | )), |
| 273 | None => crate::options::OptionError::config(format!( |
| 274 | "Please update 'styles.{}' in your config file. {err}", |
| 275 | stringify!($field) |
| 276 | )), |
| 277 | })?; |
| 278 | } |
| 279 | }; |
| 280 | } |
| 281 | |
| 282 | pub(superrust-analyzer cargo bottom 0.14.9 options/config/style/) use optrust-analyzer cargo bottom 0.14.9 options/config/style/utils/opt!; |
| 283 | pub(superrust-analyzer cargo bottom 0.14.9 options/config/style/) use set_bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_bg_colour!; |
| 284 | pub(superrust-analyzer cargo bottom 0.14.9 options/config/style/) use set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!; |
| 285 | pub(superrust-analyzer cargo bottom 0.14.9 options/config/style/) use set_colour_listrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour_list!; |
| 286 | pub(superrust-analyzer cargo bottom 0.14.9 options/config/style/) use set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!; |
| 287 | |
| 288 | #[cfg(test)] |
| 289 | mod testrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/ { |
| 290 | |
| 291 | use ratatuirust-analyzer cargo ratatui 0.30.2 crate/::stylerust-analyzer cargo ratatui-core 0.1.2 style/::{Modifierrust-analyzer cargo ratatui-core 0.1.2 style/Modifier#, Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#}; |
| 292 | |
| 293 | use superrust-analyzer cargo bottom 0.14.9 options/config/style/utils/::*; |
| 294 | 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/::stylerust-analyzer cargo bottom 0.14.9 options/config/style/::{ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#, TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#}; |
| 295 | |
| 296 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 297 | fn general_str_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/general_str_to_colour().() { |
| 298 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Redrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Red#); |
| 299 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(str_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/str_to_colour().("r ed").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 300 | |
| 301 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(str_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/str_to_colour().("#ffffff").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(255, 255, 255)); |
| 302 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(str_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/str_to_colour().("#fff fff").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 303 | |
| 304 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 305 | str_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/str_to_colour().("255, 255, 255").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 306 | Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(255, 255, 255) |
| 307 | ); |
| 308 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(str_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/str_to_colour().("255, 256, 255").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 309 | } |
| 310 | |
| 311 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 312 | fn invalid_colour_namesrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/invalid_colour_names().() { |
| 313 | // Test invalid spacing in single word. |
| 314 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().("bl ack").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 315 | |
| 316 | // Test invalid spacing in dual word. |
| 317 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().("darkg ray").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 318 | |
| 319 | // Test completely invalid colour. |
| 320 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().("darkreset").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 321 | } |
| 322 | |
| 323 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 324 | fn valid_colour_namesrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/valid_colour_names().() { |
| 325 | // Standard colour should work |
| 326 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().("red"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Redrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Red#)); |
| 327 | |
| 328 | // Capitalizing should be fine. |
| 329 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().("RED"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Redrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Red#)); |
| 330 | |
| 331 | // Spacing shouldn't be an issue now. |
| 332 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().(" red "), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Redrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Red#)); |
| 333 | |
| 334 | // The following are all equivalent. |
| 335 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().("darkgray"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::DarkGrayrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#DarkGray#)); |
| 336 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().("darkgrey"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::DarkGrayrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#DarkGray#)); |
| 337 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().("dark grey"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::DarkGrayrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#DarkGray#)); |
| 338 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().("dark gray"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::DarkGrayrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#DarkGray#)); |
| 339 | |
| 340 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().("grey"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Grayrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Gray#)); |
| 341 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().("gray"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Grayrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Gray#)); |
| 342 | |
| 343 | // One more test with spacing. |
| 344 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 345 | convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().(" lightmagenta "), |
| 346 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::LightMagentarust-analyzer cargo ratatui-core 0.1.2 style/color/Color#LightMagenta#) |
| 347 | ); |
| 348 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 349 | convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().("light magenta"), |
| 350 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::LightMagentarust-analyzer cargo ratatui-core 0.1.2 style/color/Color#LightMagenta#) |
| 351 | ); |
| 352 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 353 | convert_name_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_name_to_colour().(" light magenta "), |
| 354 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::LightMagentarust-analyzer cargo ratatui-core 0.1.2 style/color/Color#LightMagenta#) |
| 355 | ); |
| 356 | } |
| 357 | |
| 358 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 359 | fn valid_hex_coloursrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/valid_hex_colours().() { |
| 360 | // Check hex with 6 characters. |
| 361 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 362 | try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#ffffff").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 363 | Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(255, 255, 255) |
| 364 | ); |
| 365 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#000000").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(0, 0, 0)); |
| 366 | try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#111111").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 367 | try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#11ff11").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 368 | try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#1f1f1f").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 369 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 370 | try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#123abc").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 371 | Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(18, 58, 188) |
| 372 | ); |
| 373 | |
| 374 | // Check hex with 3 characters. |
| 375 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 376 | try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#fff").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 377 | Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(255, 255, 255) |
| 378 | ); |
| 379 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#000").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(0, 0, 0)); |
| 380 | try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#111").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 381 | try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#1f1").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 382 | try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#f1f").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 383 | try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#ff1").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 384 | try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#1ab").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 385 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#1ab").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(17, 170, 187)); |
| 386 | } |
| 387 | |
| 388 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 389 | fn invalid_hex_coloursrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/invalid_hex_colours().() { |
| 390 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("ffffff").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 391 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("111111").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 392 | |
| 393 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("fff").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 394 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("111").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 395 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("fffffff").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 396 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("1234567").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 397 | |
| 398 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#fffffff").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 399 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#1234567").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 400 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#ff").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 401 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#12").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 402 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 403 | |
| 404 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#pppppp").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 405 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#00000p").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 406 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#ppp").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 407 | |
| 408 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#一").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 409 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#一二").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 410 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#一二三").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 411 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#一二三四").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 412 | |
| 413 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#f一f").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 414 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#ff一11").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 415 | |
| 416 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#🇨🇦").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 417 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#🇨🇦🇨🇦").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 418 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#🇨🇦🇨🇦🇨🇦").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 419 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#🇨🇦🇨🇦🇨🇦🇨🇦").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 420 | |
| 421 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_hex_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/try_hex_to_colour().("#हिन्दी").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 422 | } |
| 423 | |
| 424 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 425 | fn test_rgb_coloursrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/test_rgb_colours().() { |
| 426 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 427 | convert_rgb_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_rgb_to_colour().("0, 0, 0").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 428 | Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(0, 0, 0) |
| 429 | ); |
| 430 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 431 | convert_rgb_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_rgb_to_colour().("255, 255, 255").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 432 | Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(255, 255, 255) |
| 433 | ); |
| 434 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(convert_rgb_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_rgb_to_colour().("255, 256, 255").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 435 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(convert_rgb_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_rgb_to_colour().("256, 0, 256").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 436 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(convert_rgb_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_rgb_to_colour().("1, -1, 1").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 437 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(convert_rgb_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_rgb_to_colour().("1, -100000, 1").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 438 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(convert_rgb_to_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/convert_rgb_to_colour().("1, -100000, 100000").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 439 | } |
| 440 | |
| 441 | struct DummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig# { |
| 442 | innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<InnerDummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#>, |
| 443 | } |
| 444 | |
| 445 | struct InnerDummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig# { |
| 446 | color_arust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_a.: 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#>, |
| 447 | color_brust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_b.: 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#>, |
| 448 | color_crust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_c.: 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#>, |
| 449 | color_drust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_d.: 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#>, |
| 450 | many_colorsrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#many_colors.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#>>, |
| 451 | text_arust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_a.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#>, |
| 452 | text_brust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_b.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#>, |
| 453 | text_crust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_c.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#>, |
| 454 | text_drust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_d.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#>, |
| 455 | text_erust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_e.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#>, |
| 456 | bad_colorrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#bad_color.: 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#>, |
| 457 | bad_listrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#bad_list.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#>>, |
| 458 | bad_text_arust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#bad_text_a.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#>, |
| 459 | bad_text_brust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#bad_text_b.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#>, |
| 460 | } |
| 461 | |
| 462 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for InnerDummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig# { |
| 463 | fn defaultrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/impl#[InnerDummyConfig][Default]default().() -> Selfrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/impl#[InnerDummyConfig][Default] { |
| 464 | Selfrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/impl#[InnerDummyConfig][Default] { |
| 465 | color_arust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_a.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 466 | color_brust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_b.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("red".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())), |
| 467 | color_crust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_c.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("255, 255, 255".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())), |
| 468 | color_drust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_d.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("#000000".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())), |
| 469 | many_colorsrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#many_colors.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("red".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()), ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("blue".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())]), |
| 470 | text_arust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_a.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#::Colourrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#Colour#(ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("green".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))), |
| 471 | text_brust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_b.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#::TextStylerust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle# { |
| 472 | colourrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#colour.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 473 | bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#bg_colour.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 474 | boldrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#bold.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 475 | italicsrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#italics.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 476 | }), |
| 477 | text_crust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_c.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#::TextStylerust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle# { |
| 478 | colourrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#colour.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("magenta".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())), |
| 479 | bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#bg_colour.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("255, 255, 255".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())), |
| 480 | boldrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#bold.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), |
| 481 | italicsrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#italics.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), |
| 482 | }), |
| 483 | text_drust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_d.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#::TextStylerust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle# { |
| 484 | colourrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#colour.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("#fff".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())), |
| 485 | bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#bg_colour.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("1, 1, 1".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())), |
| 486 | boldrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#bold.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), |
| 487 | italicsrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#italics.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), |
| 488 | }), |
| 489 | text_erust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_e.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 490 | bad_colorrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#bad_color.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("asdf".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())), |
| 491 | bad_listrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#bad_list.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 492 | ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("red".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()), |
| 493 | ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("asdf".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()), |
| 494 | ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("ghi".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()), |
| 495 | ]), |
| 496 | bad_text_arust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#bad_text_a.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#::TextStylerust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle# { |
| 497 | colourrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#colour.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("asdf".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())), |
| 498 | bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#bg_colour.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 499 | boldrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#bold.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 500 | italicsrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#italics.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 501 | }), |
| 502 | bad_text_brust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#bad_text_b.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(TextStyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#::TextStylerust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle# { |
| 503 | colourrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#colour.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 504 | bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#bg_colour.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ColourStrrust-analyzer cargo bottom 0.14.9 options/config/style/ColourStr#("asdf".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())), |
| 505 | boldrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#bold.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 506 | italicsrust-analyzer cargo bottom 0.14.9 options/config/style/TextStyleConfig#TextStyle#italics.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 507 | }), |
| 508 | } |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 513 | fn test_set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/test_set_colour().() -> anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Resultrust-analyzer cargo anyhow 1.0.104 Result#<()> { |
| 514 | let mut s = 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#::Blackrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Black#); |
| 515 | let dummy = DummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig# { |
| 516 | innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(InnerDummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#::defaultrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/impl#[InnerDummyConfig][Default]default().()), |
| 517 | }; |
| 518 | |
| 519 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., color_arust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_a.); |
| 520 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Blackrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Black#); |
| 521 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.bgrust-analyzer cargo ratatui-core 0.1.2 style/Style#bg., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 522 | |
| 523 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., color_brust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_b.); |
| 524 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Redrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Red#); |
| 525 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.bgrust-analyzer cargo ratatui-core 0.1.2 style/Style#bg., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 526 | |
| 527 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., color_crust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_c.); |
| 528 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(255, 255, 255)); |
| 529 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.bgrust-analyzer cargo ratatui-core 0.1.2 style/Style#bg., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 530 | |
| 531 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., color_drust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_d.); |
| 532 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(0, 0, 0)); |
| 533 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.bgrust-analyzer cargo ratatui-core 0.1.2 style/Style#bg., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 534 | |
| 535 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 536 | } |
| 537 | |
| 538 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 539 | fn test_set_bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/test_set_bg_colour().() -> anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Resultrust-analyzer cargo anyhow 1.0.104 Result#<()> { |
| 540 | let mut s = Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#::defaultrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style][Default]default().().bgrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]bg().(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Blackrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Black#); |
| 541 | let dummy = DummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig# { |
| 542 | innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(InnerDummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#::defaultrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/impl#[InnerDummyConfig][Default]default().()), |
| 543 | }; |
| 544 | |
| 545 | set_bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_bg_colour!!(s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., color_arust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_a.); |
| 546 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.fgrust-analyzer cargo ratatui-core 0.1.2 style/Style#fg., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 547 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Blackrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Black#); |
| 548 | |
| 549 | set_bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_bg_colour!!(s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., color_brust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_b.); |
| 550 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.fgrust-analyzer cargo ratatui-core 0.1.2 style/Style#fg., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 551 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Redrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Red#); |
| 552 | |
| 553 | set_bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_bg_colour!!(s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., color_crust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_c.); |
| 554 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.fgrust-analyzer cargo ratatui-core 0.1.2 style/Style#fg., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 555 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(255, 255, 255)); |
| 556 | |
| 557 | set_bg_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_bg_colour!!(s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., color_drust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#color_d.); |
| 558 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.fgrust-analyzer cargo ratatui-core 0.1.2 style/Style#fg., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 559 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(0, 0, 0)); |
| 560 | |
| 561 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 562 | } |
| 563 | |
| 564 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 565 | fn test_bad_set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/test_bad_set_colour().() { |
| 566 | let mut _s = 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#::Blackrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Black#); |
| 567 | let dummy = DummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig# { |
| 568 | innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(InnerDummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#::defaultrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/impl#[InnerDummyConfig][Default]default().()), |
| 569 | }; |
| 570 | |
| 571 | (move || -> anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Resultrust-analyzer cargo anyhow 1.0.104 Result#<()> { |
| 572 | set_colourrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour!!(_s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., bad_colorrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#bad_color.); |
| 573 | |
| 574 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 575 | })() |
| 576 | .unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(); |
| 577 | } |
| 578 | |
| 579 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 580 | fn test_set_multi_coloursrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/test_set_multi_colours().() -> anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Resultrust-analyzer cargo anyhow 1.0.104 Result#<()> { |
| 581 | let mut s: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 582 | let dummy = DummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig# { |
| 583 | innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(InnerDummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#::defaultrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/impl#[InnerDummyConfig][Default]default().()), |
| 584 | }; |
| 585 | |
| 586 | set_colour_listrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour_list!!(s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., many_colorsrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#many_colors.); |
| 587 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 2); |
| 588 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..fgrust-analyzer cargo ratatui-core 0.1.2 style/Style#fg., Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Redrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Red#)); |
| 589 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..fgrust-analyzer cargo ratatui-core 0.1.2 style/Style#fg., Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Bluerust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Blue#)); |
| 590 | |
| 591 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 592 | } |
| 593 | |
| 594 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 595 | fn test_bad_set_listrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/test_bad_set_list().() { |
| 596 | let dummy = DummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig# { |
| 597 | innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(InnerDummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#::defaultrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/impl#[InnerDummyConfig][Default]default().()), |
| 598 | }; |
| 599 | |
| 600 | (move || -> anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Resultrust-analyzer cargo anyhow 1.0.104 Result#<()> { |
| 601 | let mut _s: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#>; |
| 602 | set_colour_listrust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_colour_list!!(_s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., bad_listrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#bad_list.); |
| 603 | |
| 604 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 605 | })() |
| 606 | .unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(); |
| 607 | } |
| 608 | |
| 609 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 610 | fn test_set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/test_set_style().() -> anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Resultrust-analyzer cargo anyhow 1.0.104 Result#<()> { |
| 611 | let mut s = 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#::Blackrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Black#); |
| 612 | let dummy = DummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig# { |
| 613 | innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(InnerDummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#::defaultrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/impl#[InnerDummyConfig][Default]default().()), |
| 614 | }; |
| 615 | |
| 616 | set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!!(s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., text_erust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_e.); |
| 617 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Blackrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Black#); |
| 618 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.bgrust-analyzer cargo ratatui-core 0.1.2 style/Style#bg., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 619 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(s.add_modifierrust-analyzer cargo ratatui-core 0.1.2 style/Style#add_modifier..is_emptyrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]is_empty().()); |
| 620 | |
| 621 | set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!!(s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., text_arust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_a.); |
| 622 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Greenrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Green#); |
| 623 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.bgrust-analyzer cargo ratatui-core 0.1.2 style/Style#bg., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 624 | |
| 625 | set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!!(s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., text_brust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_b.); |
| 626 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Greenrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Green#); |
| 627 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.bgrust-analyzer cargo ratatui-core 0.1.2 style/Style#bg., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 628 | |
| 629 | set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!!(s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., text_crust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_c.); |
| 630 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Magentarust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Magenta#); |
| 631 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(255, 255, 255)); |
| 632 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(s.add_modifierrust-analyzer cargo ratatui-core 0.1.2 style/Style#add_modifier..containsrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]contains().(Modifierrust-analyzer cargo ratatui-core 0.1.2 style/Modifier#::BOLDrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]BOLD.)); |
| 633 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().s.add_modifierrust-analyzer cargo ratatui-core 0.1.2 style/Style#add_modifier..containsrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]contains().(Modifierrust-analyzer cargo ratatui-core 0.1.2 style/Modifier#::ITALICrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]ITALIC.)); |
| 634 | |
| 635 | set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!!(s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., text_drust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#text_d.); |
| 636 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(255, 255, 255)); |
| 637 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s.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().(), Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Rgbrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Rgb#(1, 1, 1)); |
| 638 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().s.add_modifierrust-analyzer cargo ratatui-core 0.1.2 style/Style#add_modifier..containsrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]contains().(Modifierrust-analyzer cargo ratatui-core 0.1.2 style/Modifier#::BOLDrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]BOLD.)); |
| 639 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(s.add_modifierrust-analyzer cargo ratatui-core 0.1.2 style/Style#add_modifier..containsrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]contains().(Modifierrust-analyzer cargo ratatui-core 0.1.2 style/Modifier#::ITALICrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]ITALIC.)); |
| 640 | |
| 641 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 642 | } |
| 643 | |
| 644 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 645 | fn test_bad_text_1rust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/test_bad_text_1().() { |
| 646 | let mut _s = 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#::Blackrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Black#); |
| 647 | let dummy = DummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig# { |
| 648 | innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(InnerDummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#::defaultrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/impl#[InnerDummyConfig][Default]default().()), |
| 649 | }; |
| 650 | |
| 651 | (move || -> anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Resultrust-analyzer cargo anyhow 1.0.104 Result#<()> { |
| 652 | set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!!(_s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., bad_text_arust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#bad_text_a.); |
| 653 | |
| 654 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 655 | })() |
| 656 | .unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(); |
| 657 | } |
| 658 | |
| 659 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 660 | fn test_bad_text_2rust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/test_bad_text_2().() { |
| 661 | let mut _s = 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#::Blackrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Black#); |
| 662 | let dummy = DummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig# { |
| 663 | innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(InnerDummyConfigrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#::defaultrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/impl#[InnerDummyConfig][Default]default().()), |
| 664 | }; |
| 665 | (move || -> anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Resultrust-analyzer cargo anyhow 1.0.104 Result#<()> { |
| 666 | set_stylerust-analyzer cargo bottom 0.14.9 options/config/style/utils/set_style!!(_s, &dummy.innerrust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/DummyConfig#inner., bad_text_brust-analyzer cargo bottom 0.14.9 options/config/style/utils/test/InnerDummyConfig#bad_text_b.); |
| 667 | |
| 668 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 669 | })() |
| 670 | .unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(); |
| 671 | } |
| 672 | } |