Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use bold magenta instead of bold white for highlighting #118756

Merged
merged 3 commits into from
Dec 12, 2023

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Dec 8, 2023

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:
image

after:
image

other colors for comparison:
blue: image
cyan: image
purple: image
magenta without bolding: image

r? @estebank

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 8, 2023
}
Style::HeaderMsg | Style::NoStyle => {}
Style::Level(lvl) => {
spec = lvl.color();
spec.set_bold(true);
}
Style::Highlight => {
spec.set_bold(true);
spec.set_fg(Some(Color::Magenta));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you keep the bold? I think bold + a color is easier to read than just a color.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not a giant fan of how the bold looks, it feels too strong
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is significantly easier to read in my opinion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subjectively, it feels easier to read to me than the darker version. What do these look like in Windows?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically, the magenta in the "after" picture you linked really weakens the contrast against a black background, especially given the thin font face/lack-of-bolding.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, done.

i will check the colors on windows in a sec, give me ~15 minutes

Copy link
Member Author

@jyn514 jyn514 Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in vscode:
image

in powershell:
image

in cmd.exe:
image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is also some horrible thing called "windows powershell ISE", but rustc correctly determines that it doesn't support ANSI escape codes and just prints everything in the default red

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.
@WaffleLapkin
Copy link
Member

Ideally we'd support themes I guess, so that people could choose the colors/boldness/etc they see fit. Although that sounds somewhat annoying since rustc probably shouldn't try to find configs (do we use env for that? cargo support?).

Either way, purple pretty, so LGTM. (also I agree with @compiler-errors that without bolding the colors are too dark, at least in vscode)

@jyn514
Copy link
Member Author

jyn514 commented Dec 8, 2023

Ideally we'd support themes I guess, so that people could choose the colors/boldness/etc they see fit. Although that sounds somewhat annoying since rustc probably shouldn't try to find configs (do we use env for that? cargo support?).

@estebank has suggested a per-user rustc.toml a few times, that might be one approach. that would also let people turn off URL highlighting and such if our feature detection is wrong.

@Fishrock123
Copy link
Contributor

Please keep it bold if the color is changing

@jyn514 jyn514 changed the title use magenta instead of bold for highlighting use bold magenta instead of bold white for highlighting Dec 8, 2023
@rustbot
Copy link
Collaborator

rustbot commented Dec 8, 2023

Could not assign reviewer from: estebank.
User(s) estebank are either the PR author, already assigned, or on vacation, and there are no other candidates.
Use r? to specify someone else to assign.

@estebank
Copy link
Contributor

estebank commented Dec 8, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Dec 8, 2023

📌 Commit 96b027f has been approved by estebank

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 8, 2023
@WaffleLapkin
Copy link
Member

estebank has suggested a per-user rustc.toml a few times, that might be one approach

Yeah, this is also what I was talking/thinking about, but it feels wrong-ish. Mainly because "find all the possible places config can be" seems to be outside of compiler responsibilities.

But it also feels nice. And maybe niceness is more meaningful than purity here.

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Dec 9, 2023
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:
![image](https://github.com/rust-lang/rust/assets/23638587/9a89eee2-8b89-422e-8554-812827bb2a23)

after:
![image](https://github.com/rust-lang/rust/assets/23638587/5bf3a917-8a20-4afd-af3e-f9491d0d57f5)

other colors for comparison:
blue: ![image](https://github.com/rust-lang/rust/assets/23638587/6f199c7b-d598-4009-8ffc-6b7b1d0d1f8c)
cyan: ![image](https://github.com/rust-lang/rust/assets/23638587/a77e4fe3-563e-4aa5-ae92-745bb67287d1)
purple: ![image](https://github.com/rust-lang/rust/assets/23638587/ffe603fb-d811-4106-95a9-4dd4c955924c)
magenta without bolding: ![image](https://github.com/rust-lang/rust/assets/23638587/cf927e5f-8b25-4dc2-b8e7-32905a11a459)

r? `@estebank`
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Dec 9, 2023
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:
![image](https://github.com/rust-lang/rust/assets/23638587/9a89eee2-8b89-422e-8554-812827bb2a23)

after:
![image](https://github.com/rust-lang/rust/assets/23638587/5bf3a917-8a20-4afd-af3e-f9491d0d57f5)

other colors for comparison:
blue: ![image](https://github.com/rust-lang/rust/assets/23638587/6f199c7b-d598-4009-8ffc-6b7b1d0d1f8c)
cyan: ![image](https://github.com/rust-lang/rust/assets/23638587/a77e4fe3-563e-4aa5-ae92-745bb67287d1)
purple: ![image](https://github.com/rust-lang/rust/assets/23638587/ffe603fb-d811-4106-95a9-4dd4c955924c)
magenta without bolding: ![image](https://github.com/rust-lang/rust/assets/23638587/cf927e5f-8b25-4dc2-b8e7-32905a11a459)

r? ``@estebank``
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 9, 2023
…kingjubilee

Rollup of 8 pull requests

Successful merges:

 - rust-lang#118198 (coverage: Use `SpanMarker` to improve coverage spans for `if !` expressions)
 - rust-lang#118512 (Add tests related to normalization in implied bounds)
 - rust-lang#118610 (update target feature following LLVM API change)
 - rust-lang#118666 (coverage: Simplify the heuristic for ignoring `async fn` return spans)
 - rust-lang#118737 (Extend tidy alphabetical checking to `tests/`.)
 - rust-lang#118756 (use bold magenta instead of bold white for highlighting)
 - rust-lang#118762 (Some more minor `async gen`-related nits)
 - rust-lang#118764 (Make async generators fused by default)

r? `@ghost`
`@rustbot` modify labels: rollup
@workingjubilee
Copy link
Member

Failed in #118768 (comment)

While it's true that purple is pretty
Windows won't let you touch its tty~

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 9, 2023
this is kinda jank because it means people need both machines to bless the tests
@jyn514
Copy link
Member Author

jyn514 commented Dec 9, 2023

i pushed a change that adds separate revisions for the test, since we use different colors on unix and windows. it has the downside that to bless it, you need to have both a windows and linux machine. i can just mark the test as ignore-windows, but then we won't have any tests for the colors we output on windows :/

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 9, 2023
@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Dec 11, 2023

📌 Commit 32e48fc has been approved by estebank

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 11, 2023
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Dec 12, 2023
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:
![image](https://github.com/rust-lang/rust/assets/23638587/9a89eee2-8b89-422e-8554-812827bb2a23)

after:
![image](https://github.com/rust-lang/rust/assets/23638587/5bf3a917-8a20-4afd-af3e-f9491d0d57f5)

other colors for comparison:
blue: ![image](https://github.com/rust-lang/rust/assets/23638587/6f199c7b-d598-4009-8ffc-6b7b1d0d1f8c)
cyan: ![image](https://github.com/rust-lang/rust/assets/23638587/a77e4fe3-563e-4aa5-ae92-745bb67287d1)
purple: ![image](https://github.com/rust-lang/rust/assets/23638587/ffe603fb-d811-4106-95a9-4dd4c955924c)
magenta without bolding: ![image](https://github.com/rust-lang/rust/assets/23638587/cf927e5f-8b25-4dc2-b8e7-32905a11a459)

r? `@estebank`
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 12, 2023
…mpiler-errors

Rollup of 7 pull requests

Successful merges:

 - rust-lang#118445 (Let `reuse` look inside git submodules)
 - rust-lang#118534 (codegen: panic when trying to compute size/align of extern type)
 - rust-lang#118756 (use bold magenta instead of bold white for highlighting)
 - rust-lang#118797 (End locals' live range before suspending coroutine)
 - rust-lang#118840 (remove some redundant clones)
 - rust-lang#118844 (Monomorphize args while building Instance body in StableMIR)
 - rust-lang#118848 (Add myself back to review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 12, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#118445 (Let `reuse` look inside git submodules)
 - rust-lang#118756 (use bold magenta instead of bold white for highlighting)
 - rust-lang#118797 (End locals' live range before suspending coroutine)
 - rust-lang#118840 (remove some redundant clones)
 - rust-lang#118844 (Monomorphize args while building Instance body in StableMIR)
 - rust-lang#118846 (Fix BinOp `ty()` assertion and `fn_sig()` for closures)
 - rust-lang#118848 (Add myself back to review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit dfc5ffa into rust-lang:master Dec 12, 2023
11 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Dec 12, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 12, 2023
Rollup merge of rust-lang#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:
![image](https://github.com/rust-lang/rust/assets/23638587/9a89eee2-8b89-422e-8554-812827bb2a23)

after:
![image](https://github.com/rust-lang/rust/assets/23638587/5bf3a917-8a20-4afd-af3e-f9491d0d57f5)

other colors for comparison:
blue: ![image](https://github.com/rust-lang/rust/assets/23638587/6f199c7b-d598-4009-8ffc-6b7b1d0d1f8c)
cyan: ![image](https://github.com/rust-lang/rust/assets/23638587/a77e4fe3-563e-4aa5-ae92-745bb67287d1)
purple: ![image](https://github.com/rust-lang/rust/assets/23638587/ffe603fb-d811-4106-95a9-4dd4c955924c)
magenta without bolding: ![image](https://github.com/rust-lang/rust/assets/23638587/cf927e5f-8b25-4dc2-b8e7-32905a11a459)

r? ``@estebank``
@jyn514 jyn514 deleted the colors branch December 12, 2023 08:58
@jyn514
Copy link
Member Author

jyn514 commented Dec 12, 2023

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.

@whentze mentioned this about terminal colors:

if you want "small amount of colors, user-themable" then you use 16 color or if you want specific colors then you should use 24-bit RGB imo
at this point, 24-bit color is probably more widely supported than 256 color (st for example has the former but not the latter)

"small amount of colors, user-themeable" is exactly what we want, and we don't use specific colors anywhere else in rustc, so i have changed my mind and don't think we should add detection for 256-color terms. the color difference between purple and magenta is usually small in any case.

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Dec 16, 2023
…ilstrieb

use `if cfg!` instead of `#[cfg]`

this pr is specifically for waffle because i love it <3

fixes rust-lang#118756 (comment)

r? `@WaffleLapkin`
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 16, 2023
Rollup merge of rust-lang#118993 - jyn514:cfg-color, r=WaffleLapkin,Nilstrieb

use `if cfg!` instead of `#[cfg]`

this pr is specifically for waffle because i love it <3

fixes rust-lang#118756 (comment)

r? `@WaffleLapkin`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants