File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
crates/terminal-colorsaurus/examples Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 1
1
//! This example shows how to detect if the terminal uses
2
2
//! a dark-on-light or a light-on-dark theme.
3
3
4
- use terminal_colorsaurus:: { color_palette, ColorScheme , Error } ;
4
+ #![ allow( clippy:: use_debug) ]
5
+
6
+ use terminal_colorsaurus:: { color_palette, Error } ;
5
7
6
8
fn main ( ) -> Result < ( ) , display:: DisplayAsDebug < Error > > {
7
9
let colors = color_palette ( ) ?;
8
-
9
- let theme = match colors. color_scheme ( ) {
10
- ColorScheme :: Dark => "dark" ,
11
- ColorScheme :: Light => "light" ,
12
- } ;
10
+ let theme = colors. color_scheme ( ) ;
13
11
14
12
println ! (
15
- "{theme}, fg: {}, bg: {}" ,
13
+ "{theme:? }, fg: {}, bg: {}" ,
16
14
colors. foreground. perceived_lightness( ) ,
17
15
colors. background. perceived_lightness( )
18
16
) ;
You can’t perform that action at this time.
0 commit comments