diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-12-12 06:52:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-12 06:52:49 +0100 |
| commit | dfc5ffacd32a795f5d6875c47ac0bf3c27bd1c8a (patch) | |
| tree | c48b53527a7d46c3770207069fff22168dab6d9a /compiler/rustc_errors/src | |
| parent | 1ee83272fb7892957056f20c65b4da279cbcaf47 (diff) | |
| parent | 32e48fc36bcfc507d2e83fddc7f18d1c35605078 (diff) | |
| download | rust-dfc5ffacd32a795f5d6875c47ac0bf3c27bd1c8a.tar.gz rust-dfc5ffacd32a795f5d6875c47ac0bf3c27bd1c8a.zip | |
Rollup merge of #118756 - jyn514:colors, r=estebank
use bold magenta instead of bold white for highlighting according to a poll of gay people in my phone, purple is the most popular color to use for highlighting | color | percentage | | ---------- | ---------- | | bold white | 6% | | blue | 14% | | cyan | 26% | | purple | 37% | | magenta | 17% | unfortunately, purple is not supported by 16-color terminals, which rustc apparently wants to support for some reason. until we require support for full 256-color terms (e.g. by doing the same feature detection as we currently do for urls), we can't use it. instead, i have collapsed the purple votes into magenta on the theory that they're close, and also because magenta is pretty. before:  after:  other colors for comparison: blue:  cyan:  purple:  magenta without bolding:  r? ``@estebank``
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index ba9cd02a9ec..3f257fdd9cf 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) => { @@ -2719,7 +2719,7 @@ impl Style { spec.set_bold(true); } Style::Highlight => { - spec.set_bold(true); + spec.set_bold(true).set_fg(Some(Color::Magenta)); } } spec |
