Skip to content

Commit 6f22b4a

Browse files
committed
Replace owo_colors::style() with owo_colors::Style::new()
1 parent ec41869 commit 6f22b4a

File tree

4 files changed

+54
-53
lines changed

4 files changed

+54
-53
lines changed

color-eyre/examples/theme.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
use color_eyre::{config::Theme, eyre::Report, owo_colors::style, Section};
1+
use color_eyre::{config::Theme, eyre::Report, Section};
2+
use owo_colors::Style;
23

34
/// To experiment with theme values, edit `theme()` below and execute `cargo run --example theme`
45
fn theme() -> Theme {
56
Theme::dark()
67
// ^ use `new` to derive from a blank theme, or `light` to derive from a light theme.
78
// Now configure your theme (see the docs for all options):
8-
.line_number(style().blue())
9-
.help_info_suggestion(style().red())
9+
.line_number(Style::new().blue())
10+
.help_info_suggestion(Style::new().red())
1011
}
1112

1213
#[derive(Debug, thiserror::Error)]

color-eyre/src/config.rs

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::{
88
};
99
use fmt::Display;
1010
use indenter::{indented, Format};
11-
use owo_colors::{style, Style};
11+
use owo_colors::Style;
1212
use std::env;
1313
use std::fmt::Write as _;
1414
use std::{fmt, path::PathBuf, sync::Arc};
@@ -57,24 +57,24 @@ impl Theme {
5757
/// Returns a theme for dark backgrounds. This is the default
5858
pub fn dark() -> Self {
5959
Self {
60-
file: style().purple(),
61-
line_number: style().purple(),
62-
active_line: style().white().bold(),
63-
error: style().bright_red(),
64-
help_info_note: style().bright_cyan(),
65-
help_info_warning: style().bright_yellow(),
66-
help_info_suggestion: style().bright_cyan(),
67-
help_info_error: style().bright_red(),
68-
dependency_code: style().green(),
69-
crate_code: style().bright_red(),
70-
code_hash: style().bright_black(),
71-
panic_header: style().red(),
72-
panic_message: style().cyan(),
73-
panic_file: style().purple(),
74-
panic_line_number: style().purple(),
75-
hidden_frames: style().bright_cyan(),
76-
spantrace_target: style().bright_red(),
77-
spantrace_fields: style().bright_cyan(),
60+
file: Style::new().purple(),
61+
line_number: Style::new().purple(),
62+
active_line: Style::new().white().bold(),
63+
error: Style::new().bright_red(),
64+
help_info_note: Style::new().bright_cyan(),
65+
help_info_warning: Style::new().bright_yellow(),
66+
help_info_suggestion: Style::new().bright_cyan(),
67+
help_info_error: Style::new().bright_red(),
68+
dependency_code: Style::new().green(),
69+
crate_code: Style::new().bright_red(),
70+
code_hash: Style::new().bright_black(),
71+
panic_header: Style::new().red(),
72+
panic_message: Style::new().cyan(),
73+
panic_file: Style::new().purple(),
74+
panic_line_number: Style::new().purple(),
75+
hidden_frames: Style::new().bright_cyan(),
76+
spantrace_target: Style::new().bright_red(),
77+
spantrace_fields: Style::new().bright_cyan(),
7878
}
7979
}
8080

@@ -83,24 +83,24 @@ impl Theme {
8383
/// Returns a theme for light backgrounds
8484
pub fn light() -> Self {
8585
Self {
86-
file: style().purple(),
87-
line_number: style().purple(),
88-
spantrace_target: style().red(),
89-
spantrace_fields: style().blue(),
90-
active_line: style().bold(),
91-
error: style().red(),
92-
help_info_note: style().blue(),
93-
help_info_warning: style().bright_red(),
94-
help_info_suggestion: style().blue(),
95-
help_info_error: style().red(),
96-
dependency_code: style().green(),
97-
crate_code: style().red(),
98-
code_hash: style().bright_black(),
99-
panic_header: style().red(),
100-
panic_message: style().blue(),
101-
panic_file: style().purple(),
102-
panic_line_number: style().purple(),
103-
hidden_frames: style().blue(),
86+
file: Style::new().purple(),
87+
line_number: Style::new().purple(),
88+
spantrace_target: Style::new().red(),
89+
spantrace_fields: Style::new().blue(),
90+
active_line: Style::new().bold(),
91+
error: Style::new().red(),
92+
help_info_note: Style::new().blue(),
93+
help_info_warning: Style::new().bright_red(),
94+
help_info_suggestion: Style::new().blue(),
95+
help_info_error: Style::new().red(),
96+
dependency_code: Style::new().green(),
97+
crate_code: Style::new().red(),
98+
code_hash: Style::new().bright_black(),
99+
panic_header: Style::new().red(),
100+
panic_message: Style::new().blue(),
101+
panic_file: Style::new().purple(),
102+
panic_line_number: Style::new().purple(),
103+
hidden_frames: Style::new().blue(),
104104
}
105105
}
106106

color-eyre/tests/theme.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ fn setup() {
293293
use owo_colors::style;
294294
let styles = color_eyre::config::Styles::dark()
295295
// ^ or, instead of `dark`, use `new` for blank styles or `light` if you what to derive from a light theme. Now configure your styles (see the docs for all options):
296-
.line_number(style().blue())
297-
.help_info_suggestion(style().red());
296+
.line_number(Style::new().blue())
297+
.help_info_suggestion(Style::new().red());
298298
299299
color_eyre::config::HookBuilder::new()
300300
.styles(styles)

color-spantrace/src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
)]
8888
use anstream::AutoStream;
8989
use once_cell::sync::OnceCell;
90-
use owo_colors::{style, OwoColorize, Style};
90+
use owo_colors::{OwoColorize, Style};
9191
use std::env;
9292
use std::fmt;
9393
use std::fs::File;
@@ -115,23 +115,23 @@ impl Theme {
115115
/// A theme for a dark background. This is the default
116116
pub fn dark() -> Self {
117117
Self {
118-
file: style().purple(),
119-
line_number: style().purple(),
120-
active_line: style().white().bold(),
121-
target: style().bright_red(),
122-
fields: style().bright_cyan(),
118+
file: Style::new().purple(),
119+
line_number: Style::new().purple(),
120+
active_line: Style::new().white().bold(),
121+
target: Style::new().bright_red(),
122+
fields: Style::new().bright_cyan(),
123123
}
124124
}
125125

126126
// XXX same as with `light` in `color_eyre`
127127
/// A theme for a light background
128128
pub fn light() -> Self {
129129
Self {
130-
file: style().purple(),
131-
line_number: style().purple(),
132-
target: style().red(),
133-
fields: style().blue(),
134-
active_line: style().bold(),
130+
file: Style::new().purple(),
131+
line_number: Style::new().purple(),
132+
target: Style::new().red(),
133+
fields: Style::new().blue(),
134+
active_line: Style::new().bold(),
135135
}
136136
}
137137

0 commit comments

Comments
 (0)