-
Notifications
You must be signed in to change notification settings - Fork 47
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
'Render' colours in REPL #514
Comments
I think this is a good idea, but the similar feature is available in ImageInTerminal.jl. For example, if you want to copy and paste the output into a GitHub issue, the current "plain" text is more beneficial. Also, the conversion to ANSI 256 (240) colors will be supported in Colors v0.13. (cf. issue #473) cc: @johnnychen94 |
I agree with you. So, I think the key issue is how to avoid annoying troubles. As you said, the issue of loss of information (i.e. copy-pasting issue) will not be a trouble as long as the color swatches and text are written together. In the case of "sideways", why not also add one line to display both? The main trouble here is unintentional output of ANSI escape codes in environments that do not support color display. At least, we would need to follow the Another trouble is compatibility with
|
This doesn't do anything for 256-colors, but other than that I think I've come up with a model that should resolve all the other concerns. When
|
I like the new ANSI color + value view. ImageInTerminal and perhaps UnicodePlots (cc: @t-bltg) could also benefit from this proposal if the color encoder is implemented here (or maybe https://github.com/KristofferC/Crayons.jl). There are two things to note from my ImageInTerminal maintenance experience:
The The ANSI color + value view only makes sense if we're looking at a very small image. |
I don't have a clear opinion on whether |
Sixel stuff should definitely be left to ImageInTerminal, and I think it would be nice if Colours.jl had some swatch-ing. Beyond that, I have no strong opinions. Let me know what you'd like me to put in a PR, and I'll make one. |
IMO, it would be a good idea to submit a PR to add a swatch using ANSI escape codes for "single" In that PR, you could design the logic and API to determine whether or not to add a swatch, and whether it uses 24-bit colors or 256 colors. |
Perhaps it might be useful to define a function like: print_swatch([io,] color::Union{Color, AbstractArray{<:Color}}; width=2, mode=:auto) to replace: print(colorcode(c, true), " \e[0m ") |
You could use Term to build a widget to visualize colors too. See: https://fedeclaudi.github.io/Term.jl/stable/basics/colors/ Playing around with things I was able to make this: It should be very easy to crate the kind of visualizations you're after. |
Currently, there are already multiple means of displaying colors on the terminal. In view of this, wouldn't it be a hindrance to customize the |
As I see it, it would be nice for Colors.jl to do something a bit nicer OOTB, and with
is now fully handled by This doesn't preclude other packages from doing even fancier colour rendering at all, they can implement custom |
Generally they cannot. That is my concern. |
Hmmm? You absolutely can, just not during precompilation.
If there's really a need to be able to turn it off, then that does seem like a reasonable approach 👍. |
Hello, I was having trouble imagining what various colours looked like in the REPL so I cooked up a little code to show me the colours. Should there be interest, I'd be happy to turn this into a PR.
Result
Code
The text was updated successfully, but these errors were encountered: