Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 424cbfd

Browse files
committed
feat(renderer): Expose default styles
1 parent 28b0a61 commit 424cbfd

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

src/renderer/mod.rs

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,38 @@ const BRIGHT_BLUE: Style = if USE_WINDOWS_COLORS {
4444
} else {
4545
AnsiColor::BrightBlue.on_default()
4646
};
47-
const DEFAULT_ERROR_STYLE: Style = AnsiColor::BrightRed.on_default().effects(Effects::BOLD);
48-
const DEFAULT_WARNING_STYLE: Style = if USE_WINDOWS_COLORS {
47+
/// [`Renderer::error`] applied by [`Renderer::styled`]
48+
pub const DEFAULT_ERROR_STYLE: Style = AnsiColor::BrightRed.on_default().effects(Effects::BOLD);
49+
/// [`Renderer::warning`] applied by [`Renderer::styled`]
50+
pub const DEFAULT_WARNING_STYLE: Style = if USE_WINDOWS_COLORS {
4951
AnsiColor::BrightYellow.on_default()
5052
} else {
5153
AnsiColor::Yellow.on_default()
5254
}
5355
.effects(Effects::BOLD);
54-
const DEFAULT_INFO_STYLE: Style = BRIGHT_BLUE.effects(Effects::BOLD);
55-
const DEFAULT_NOTE_STYLE: Style = AnsiColor::BrightGreen.on_default().effects(Effects::BOLD);
56-
const DEFAULT_HELP_STYLE: Style = AnsiColor::BrightCyan.on_default().effects(Effects::BOLD);
57-
const DEFAULT_LINE_NUM_STYLE: Style = BRIGHT_BLUE.effects(Effects::BOLD);
58-
const DEFAULT_EMPHASIS_STYLE: Style = if USE_WINDOWS_COLORS {
56+
/// [`Renderer::info`] applied by [`Renderer::styled`]
57+
pub const DEFAULT_INFO_STYLE: Style = BRIGHT_BLUE.effects(Effects::BOLD);
58+
/// [`Renderer::note`] applied by [`Renderer::styled`]
59+
pub const DEFAULT_NOTE_STYLE: Style = AnsiColor::BrightGreen.on_default().effects(Effects::BOLD);
60+
/// [`Renderer::help`] applied by [`Renderer::styled`]
61+
pub const DEFAULT_HELP_STYLE: Style = AnsiColor::BrightCyan.on_default().effects(Effects::BOLD);
62+
/// [`Renderer::line_num`] applied by [`Renderer::styled`]
63+
pub const DEFAULT_LINE_NUM_STYLE: Style = BRIGHT_BLUE.effects(Effects::BOLD);
64+
/// [`Renderer::emphasis`] applied by [`Renderer::styled`]
65+
pub const DEFAULT_EMPHASIS_STYLE: Style = if USE_WINDOWS_COLORS {
5966
AnsiColor::BrightWhite.on_default()
6067
} else {
6168
Style::new()
6269
}
6370
.effects(Effects::BOLD);
64-
const DEFAULT_NONE_STYLE: Style = Style::new();
65-
const DEFAULT_CONTEXT_STYLE: Style = BRIGHT_BLUE.effects(Effects::BOLD);
66-
const DEFAULT_ADDITION_STYLE: Style = AnsiColor::BrightGreen.on_default();
67-
const DEFAULT_REMOVAL_STYLE: Style = AnsiColor::BrightRed.on_default();
71+
/// [`Renderer::none`] applied by [`Renderer::styled`]
72+
pub const DEFAULT_NONE_STYLE: Style = Style::new();
73+
/// [`Renderer::context`] applied by [`Renderer::styled`]
74+
pub const DEFAULT_CONTEXT_STYLE: Style = BRIGHT_BLUE.effects(Effects::BOLD);
75+
/// [`Renderer::addition`] applied by [`Renderer::styled`]
76+
pub const DEFAULT_ADDITION_STYLE: Style = AnsiColor::BrightGreen.on_default();
77+
/// [`Renderer::removal`] applied by [`Renderer::styled`]
78+
pub const DEFAULT_REMOVAL_STYLE: Style = AnsiColor::BrightRed.on_default();
6879

6980
/// The [Renderer] for a [`Report`]
7081
///

0 commit comments

Comments
 (0)