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 ansi256ansi16 #93

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Richienb
Copy link

@Richienb Richienb commented Apr 21, 2021

Output in Windows Terminal:

Grid of colours with an ansi256 code and a corresponding ansi16 code

Fixes #92, Fixes #89

Signed-off-by: Richie Bendall <richiebendall@gmail.com>
Signed-off-by: Richie Bendall <richiebendall@gmail.com>
@Qix-
Copy link
Owner

Qix- commented Apr 21, 2021

Thanks - could you add tests that check the result of ansi256.ansi16() to rgb.ansi16(ansi256.rgb()) to make sure it's as expected?

Something like:

for (let i = 0; i < 8; i++) {
    assert( cc.ansi256.ansi16(i) === (i + 30) );
}

for (let i = 8; i < 16; i++) {
    assert( cc.ansi256.ansi16(i) === (i + 90) );
}

for (let i = 16; i < 256; i++) {
    assert( cc.ansi256.ansi16(i) === cc.rgb.ansi16(cc.ansi256.rgb(i)) );
}

Signed-off-by: Richie Bendall <richiebendall@gmail.com>
@Richienb
Copy link
Author

Couldn't get the third test to work but the other 2 passed fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants