Repository navigation
[RFC] support color256 decoding, "fixes" color256 encoding - #62
Closed
johnnychen94 wants to merge 1 commit into
Closed
johnnychen94 wants to merge 1 commit into
johnnychen94 wants to merge 1 commit into
Conversation
johnnychen94
commented
Jan 3, 2022
Comment on lines
+46
to
+49
| val = round(Int, clamp01nan(gray(c)) * 26) | ||
| val == 0 && return 17 # 0x000000 | ||
| val > 24 && return 232 # 0xffffff | ||
| return 232 + val |
Member
Author
There was a problem hiding this comment.
This can be implemented wrong here; just that this version passes the enc(enc(c)) = c test for those 256 colors.
t-bltg
approved these changes
Jan 3, 2022
Member
|
@johnnychen94, I'm going to rework this PR in a new one (easier for me). I remember having spent quite some time figuring out the correct rgb colors for the 6x6x6 cube in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an attempt to decode color256 codes, the decoding table comes from https://www.ditig.com/256-colors-cheat-sheet
By applying decoding to our encoded result, it seems that our previous encoding implementation is not ideal:
Graybar
From top to down: Base, original, PR. None of them are ideal but the PR version is less incorrect in the sense it doesn't convert black to white...
RGB wheel
From left to right: Base, original, PR. The PR version seems quite ideal here.
ImageInTerminal visual changes
However, the encoding visual change by checking ImageInTerminal is negligible. The reason might be that we do multiple
restrictto the image.The test fails on ImageInTerminal because the encoding strategy is changed and references are not updated. The performance is also not tweaked.