Add color_reset to StyleCodes

This commit is contained in:
Richard Feldman 2022-04-20 18:13:18 -04:00
parent 928f99957a
commit e2ea66043a
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798
2 changed files with 4 additions and 0 deletions

View file

@ -61,6 +61,7 @@ mod cli_run {
.replace(ANSI_STYLE_CODES.bold, "") .replace(ANSI_STYLE_CODES.bold, "")
.replace(ANSI_STYLE_CODES.underline, "") .replace(ANSI_STYLE_CODES.underline, "")
.replace(ANSI_STYLE_CODES.reset, "") .replace(ANSI_STYLE_CODES.reset, "")
.replace(ANSI_STYLE_CODES.color_reset, "")
} }
fn check_compile_error(file: &Path, flags: &[&str], expected: &str) { fn check_compile_error(file: &Path, flags: &[&str], expected: &str) {

View file

@ -215,6 +215,7 @@ pub struct StyleCodes {
pub bold: &'static str, pub bold: &'static str,
pub underline: &'static str, pub underline: &'static str,
pub reset: &'static str, pub reset: &'static str,
pub color_reset: &'static str,
} }
pub const ANSI_STYLE_CODES: StyleCodes = StyleCodes { pub const ANSI_STYLE_CODES: StyleCodes = StyleCodes {
@ -228,6 +229,7 @@ pub const ANSI_STYLE_CODES: StyleCodes = StyleCodes {
bold: "\u{001b}[1m", bold: "\u{001b}[1m",
underline: "\u{001b}[4m", underline: "\u{001b}[4m",
reset: "\u{001b}[0m", reset: "\u{001b}[0m",
color_reset: "\u{1b}[39m",
}; };
macro_rules! html_color { macro_rules! html_color {
@ -247,6 +249,7 @@ pub const HTML_STYLE_CODES: StyleCodes = StyleCodes {
bold: "<span style='font-weight: bold'>", bold: "<span style='font-weight: bold'>",
underline: "<span style='text-decoration: underline'>", underline: "<span style='text-decoration: underline'>",
reset: "</span>", reset: "</span>",
color_reset: "</span>",
}; };
// define custom allocator struct so we can `impl RocDocAllocator` custom helpers // define custom allocator struct so we can `impl RocDocAllocator` custom helpers