Skip to content
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

Add 24bit color support #86

Merged
merged 3 commits into from
Nov 23, 2024
Merged

Add 24bit color support #86

merged 3 commits into from
Nov 23, 2024

Conversation

xs5871
Copy link
Contributor

@xs5871 xs5871 commented Nov 6, 2024

Here's a suggestion for 24-bit color ("truecolor") support:

  • Keep the original structure of stuffing all color information into a single integer.
  • But use a 64 bit int instead.
  • If 24-bit color: store the background color in the upper half.

resolves #3

@lauft
Copy link
Member

lauft commented Nov 6, 2024

@xs5871 Thanks for the contribution, but there are some failing tests that need to be investigated.
From the test logs:

not ok 1038 - 0x0a1b2c               -> ^[[38;2;10;27;44m
# expected: 'foo'
#      got: '[38;2;10;27;44mmfoo'
not ok 1039 - 0x0a1b2c on color127   -> ^[[38;2;10;27;44m^[[48;2;126;0;126m
# expected: 'foo'
#      got: '[38;2;10;27;44m;mfoo'
not ok 1040 - red on 0x0a1b2c        -> ^[[38;2;128;0;0m^[[38;2;10;27;44m
# expected: 'foo'
#      got: '[38;2;128;0;0m;mfoo'
not ok 1041 - bold on 0x0a1b2c       -> ^[[38;2;255;0;0m^[[38;2;10;27;44m
# expected: 'foo'
#      got: '[38;2;128;0;0m;mfoo'
not ok 1042 - 0x0a1b2c on bright red -> ^[[38;2;10;27;44m^[[48;2;255;0;0m
# expected: 'foo'
#      got: '[38;2;10;27;44m;mfoo'
not ok 1043 - 0x0101010 on grey0     -> ^[[38;2;1;1;1m^[[48;2;10;10;10m
# expected: 'foo'
#      got: '[38;2;1;1;1m;mfoo'
not ok 1044 - 0x101010 on grey0      -> ^[[38;2;16;16;16m^[[48;2;240;240;240m
# expected: 'foo'
#      got: '[38;2;16;16;16m;mfoo'

@xs5871
Copy link
Contributor Author

xs5871 commented Nov 6, 2024

Got confused by the regex warnings. Those didn't show up when I originallly wrote this.

@Rahlir
Copy link
Contributor

Rahlir commented Nov 7, 2024

Uuuh, that's neat. I would just point out that if this gets merged it would be very useful to also update the documentation of the main project. Plus we need to update the documentation regarding colors anyway now that #85 was merged...

@lauft lauft self-assigned this Nov 23, 2024
@lauft
Copy link
Member

lauft commented Nov 23, 2024

@xs5871 I spotted some minor issues on a second pass of your PR:

  • Update the number of unit tests by 8 in line 34 of color.t.cpp
  • The last test should have the description 0x101010 on grey23 instead of 0x101010 on grey0

@xs5871
Copy link
Contributor Author

xs5871 commented Nov 23, 2024

I also moved the new tests up a bit. For some reason they were in the middle of semantically contiguous section.

@lauft lauft merged commit f486fc4 into GothenburgBitFactory:master Nov 23, 2024
8 checks passed
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.

Support true color
3 participants