-
-
Notifications
You must be signed in to change notification settings - Fork 13
Recolouring support #129
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
base: main
Are you sure you want to change the base?
Recolouring support #129
Conversation
f81a594 to
c4c2119
Compare
faacad2 to
a8b8fae
Compare
|
The associated REPL PR: JuliaLang/julia#59958 |
96b8ccf to
5da5a96
Compare
391cfb7 to
9b31697
Compare
When making terminal-friendly interfaces, it is easy to run into the limits of 4-bit ANSI colouring. This is easily seen when trying to show selections or highlighting, and a shaded background is required. Without knowing if the terminal is light or dark, and what shades its ANSI colours are, it is not possible to pick an appropriate colour. To generate appropriate colours, some form of blending is required. Instead of encouraging packages to just pick a colour, or do ad-hoc blending themselves, it makes sense for us to provide a single colour blending function that does a good job: here, by transforming the sRGB colour into OKLab space to do the blending in, and then back to sRGB at the end. This extra work pays off in markedly better results. While terminal colour detection and retheming is left for later, this work together with the base colours lays the foundation for consistently appropriate colouring.
This will make it easier to reapply modifications after recolouring.
These were never supposed to make the cut in the first place.
|
I'm about to start pushing some unrelated changes that build on this work. Once I've sorted out what goes in what patches, and the commit order, I'll adjust this PR to be scoped to just recolouring again and put the remaining changes in a separate PR. For now, here are the just-recolouring changes: https://github.com/JuliaLang/StyledStrings.jl/compare/9bb8ffdd8c2858cced7b6b6fcee85be41c9a1867..7e5812fb50191628079735bc30eaf2fde5a9dfa1 |
TODO: elaborate on the justification and methodology.
The road to appropriate colours across the wide range of colour schemes and light/dark variability of the terminals people use, and for when 4-bit ANSI colours aren't sufficient.