Skip to content

Conversation

@tznind
Copy link

@tznind tznind commented Dec 4, 2022

Hey, I've done a bit of work on true color. Changes include

  • Merging TrueColorAttribute into Attribute
  • Writing a mapping from RBG to ConsoleColor using HSV nearest
  • Added an Image senario
  • Refactor tests to more easily add text cases and cover +/- 5 when

One thing is that if true color is enabled in Driver then the true color RGB values are always used. This means that if different OS/console map the console colors to different RGB that difference will not be apparent. Worth discussing further anyway.

I have merged develop into my branch so you should see an easier to read diff if you sync your branch.

sauron

I think some more work can be done on the mapping. I did start with just

distance = (R1-R2)^2 + (G1-G2)^2 + (B1-B2)^2

But this seemed to be a bit meh so I experimented with HSL distance instead. But Hue for black/grey/white are undefined which makes it a bigger pain.

The current algorithm pushes anything that's not 100% black to a color so I will have to tinker and try to fix that.

The PR adds a dependency to UICatalog only (not the main library) on ImageSharp which is the de-facto standard imaging library for .net (as well as the one that Spectre.Console are wrapping for imaging work).

@tznind
Copy link
Author

tznind commented Dec 4, 2022

Update:

Ok I think HSV for mapping is not working out so well and RGB just works better. have removed it in
bb81bc9

For reference here is a comparison:

image

@tznind
Copy link
Author

tznind commented Jun 24, 2023

@veeman are you still interested in working on true color support and trying to get your feature branch true-color-support into Terminal.Gui?

If so then please let me know how you feel about the changes in this PR to that feature.

If not then I can retarget this at the main Terminal.Gui repo as a new PR and work on it there.

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