-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
less colors and more contrast in terminal #6525
Conversation
red: "\u{001b}[1;31m", | ||
green: "\u{001b}[1;32m", | ||
yellow: "\u{001b}[1;33m", | ||
cyan: "\u{001b}[1;36m", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1;
to use the increased visibility variants.
let (failed, passed) = roc_repl_expect::run::run_toplevel_expects( | ||
let (failed_count, passed_count) = roc_repl_expect::run::run_toplevel_expects( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More self-evident names
println!( | ||
"\x1B[{}m{}\x1B[39m {} and \x1B[{}m{}\x1B[39m {} found in {} ms.", | ||
if problems.errors == 0 { | ||
32 // green | ||
} else { | ||
33 // yellow | ||
}, | ||
problems.errors, | ||
if problems.errors == 1 { | ||
"error" | ||
} else { | ||
"errors" | ||
}, | ||
if problems.warnings == 0 { | ||
32 // green | ||
} else { | ||
33 // yellow | ||
}, | ||
problems.warnings, | ||
if problems.warnings == 1 { | ||
"warning" | ||
} else { | ||
"warnings" | ||
}, | ||
total_time.as_millis(), | ||
); | ||
|
||
problems.print_to_stdout(total_time); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was duplicated in print_to_stdout
.
pub fn strip_colors(str: &str) -> String { | ||
use roc_reporting::report::ANSI_STYLE_CODES; | ||
|
||
str.replace(ANSI_STYLE_CODES.red, "") | ||
.replace(ANSI_STYLE_CODES.green, "") | ||
.replace(ANSI_STYLE_CODES.yellow, "") | ||
.replace(ANSI_STYLE_CODES.blue, "") | ||
.replace(ANSI_STYLE_CODES.magenta, "") | ||
.replace(ANSI_STYLE_CODES.cyan, "") | ||
.replace(ANSI_STYLE_CODES.white, "") | ||
.replace(ANSI_STYLE_CODES.bold, "") | ||
.replace(ANSI_STYLE_CODES.underline, "") | ||
.replace(ANSI_STYLE_CODES.reset, "") | ||
.replace(ANSI_STYLE_CODES.color_reset, "") | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was moved.
Very cool! Two thoughts:
|
This is what is looks like on Windows. Looks good to me. ❤️ p.s. I'm not sure what is going on with that debug statement in rustyline... |
Thanks for checking that @lukewilliamboswell :) @rtfeldman I've changed the color of the underline to match roc repl. |
Great stuff, thanks for improving this @Anton-4! 😍 |
update repl_basic_test because of #6525
I checked how our terminal colors looked on macos. ubuntu, nixOS and raspberryOS. The colors we internally call blue and magenta regularly did not meet the AA wcag standard so I removed them and used other colors instead. I also changed the colors we still use to their "improved visibility variants". Other popular languages and command line tools often use these variants as well.
after (left) and before (right) on raspberryOS:
Closes #6512