Skip to content

Conversation

@tecosaur
Copy link
Member

@tecosaur tecosaur commented Oct 26, 2025

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.

  • Colour blending
  • Retheming hook
  • Light/dark support

@tecosaur tecosaur force-pushed the recolouring branch 2 times, most recently from f81a594 to c4c2119 Compare October 26, 2025 05:53
@tecosaur tecosaur changed the title Introduce colour blending utility Introduce recolouring support Oct 26, 2025
@tecosaur tecosaur changed the title Introduce recolouring support Recolouring support Oct 26, 2025
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.
@tecosaur tecosaur force-pushed the recolouring branch 2 times, most recently from 10f1840 to 523372c Compare October 26, 2025 06:30
@tecosaur tecosaur force-pushed the recolouring branch 4 times, most recently from faacad2 to a8b8fae Compare October 26, 2025 09:28
@tecosaur
Copy link
Member Author

The associated REPL PR: JuliaLang/julia#59958

These were never supposed to make the cut in the first place.
@tecosaur tecosaur force-pushed the recolouring branch 6 times, most recently from 5465fcb to fdbd6ec Compare October 27, 2025 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant