-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
print_with_color doesn't print with the correct colors #8096
Comments
Ah, just found the |
More digging, it looks like the reason is that FactCheck doesn't use the bold versions of the colors, but Julia's color codes do. In my color scheme (solarized), the bold versions of the colors are actually different colors. This seems like perhaps more of an issue with the color scheme than Julia, as Julia can't expect to know what color scheme might be messing with the colors. I'll go ahead and close. Sorry for the noise. |
@ssfrr I just noticed this same issue and reading on this I find it strange that the entire julia prompt forces bold fonts considering how difficult handling bold fonts appears to be. |
Given the way the 16 ANSI colors are defined, it seems reasonable to assume that "bright red" would be a lot like "red", but "brighter". I've personally come to think that Solarized's use of the bright colors to be completely different colors, some of which are almost invisible on the background color, is a Bad Thing. Terminal color handling is confusing enough without changing around the meanings of colors, and the subtle combinations of terminal color schemes and application color schemes that are required to make Solarized work properly are to me an indication that it's more trouble than it's worth (though it is a pretty colorscheme). I don't think that handling bold/bright colors needs to be that confusing unless colorscheme designers insist on abusing them. |
Ranting aside though, given that we basically don't have any idea how the colors will show up on someone's screen, I don't see a reason to use the bold/bright versions of colors unless it's actually to contrast against the non-bold version. So it doesn't seem like it would hurt to stick with the non-bold versions in the REPL. I'm guessing this is @Keno's area? |
@ssfrr Yeah, the more I think about it I believe Julia should stick with the non-bold fonts... |
Apart from code reuse, this should work cross-platform. Downside: you need to run tests with julia --color to get the coloured output Upshot: Now more garbled escape codes in test logs on PkgEvaluator @ssfrr I know you looked at this in JuliaLang/julia#8096, so tagging you in case this interests you
Is it possible to print text with genral colors defined in the package file Colors/src/names_data.jl ? for color in [:red, :green, :blue, :magenta]
print_with_color(color, "Hello in $(color)\n")
end works well on my computer (linux, using zsh shell) whereas print_with_color(:orange, "Hello \n") prints Hello in a standard black color. |
Test code:
When I put it in a script and run it I get all three in the default color. When I run it from the REPL I get an orangish, and 2 variations on my default color.
I'm guessing that it's using my terminal's color scheme, but it looks like it's possible to print green and red in my terminal, because FactCheck.jl is able to do it:
Here's the relevant FactCheck code:
The text was updated successfully, but these errors were encountered: