about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorjyn <github@jyn.dev>2023-12-08 11:28:08 -0500
committerjyn <github@jyn.dev>2023-12-08 14:21:16 -0500
commit9f0c6f15ce32661e65034898155fcdaa8539201e (patch)
tree7e770ddb15250028a8a2c8429c615396db29bf7d /compiler/rustc_errors/src
parentd6fa38a9b2426487e010a6c16862132f89755e41 (diff)
downloadrust-9f0c6f15ce32661e65034898155fcdaa8539201e.tar.gz
rust-9f0c6f15ce32661e65034898155fcdaa8539201e.zip
Simplify and comment the special-casing for Windows colors
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/emitter.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index ba9cd02a9ec..62aa8e602af 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -2674,6 +2674,14 @@ fn from_stderr(color: ColorConfig) -> Destination {
     }
 }
 
+/// On Windows, BRIGHT_BLUE is hard to read on black. Use cyan instead.
+///
+/// See #36178.
+#[cfg(windows)]
+const BRIGHT_BLUE: Color = Color::Cyan;
+#[cfg(not(windows))]
+const BRIGHT_BLUE: Color = Color::Blue;
+
 impl Style {
     fn color_spec(&self, lvl: Level) -> ColorSpec {
         let mut spec = ColorSpec::new();
@@ -2688,11 +2696,7 @@ impl Style {
             Style::LineNumber => {
                 spec.set_bold(true);
                 spec.set_intense(true);
-                if cfg!(windows) {
-                    spec.set_fg(Some(Color::Cyan));
-                } else {
-                    spec.set_fg(Some(Color::Blue));
-                }
+                spec.set_fg(Some(BRIGHT_BLUE));
             }
             Style::Quotation => {}
             Style::MainHeaderMsg => {
@@ -2707,11 +2711,7 @@ impl Style {
             }
             Style::UnderlineSecondary | Style::LabelSecondary => {
                 spec.set_bold(true).set_intense(true);
-                if cfg!(windows) {
-                    spec.set_fg(Some(Color::Cyan));
-                } else {
-                    spec.set_fg(Some(Color::Blue));
-                }
+                spec.set_fg(Some(BRIGHT_BLUE));
             }
             Style::HeaderMsg | Style::NoStyle => {}
             Style::Level(lvl) => {