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

Support 8-bit palette grayscale values #73

Open
ian-h-chamberlain opened this issue Dec 22, 2022 · 0 comments
Open

Support 8-bit palette grayscale values #73

ian-h-chamberlain opened this issue Dec 22, 2022 · 0 comments

Comments

@ian-h-chamberlain
Copy link

According to the Wikipedia article linked in the README (and from a quick test in my terminal), valid values for the 8-bit color mode include the range [232,255] for grayscale values, but it seems the library doesn't support this. use_classes: true seems to still work as expected, so it really just seems to be the conversion from palette color to RGB that is not supported:

var anser = require("anser")

const txt = "\u001b[38;5;255mHello\u001b[39m \u001b[48;5;235mWorld\u001b[49m";

console.log(anser.ansiToHtml(txt));
// <span style="color:rgb(undefined, undefined, undefined)">Hello</span> <span style="background-color:rgb(undefined, undefined, undefined)">World</span>

console.log(anser.ansiToHtml(txt, { use_classes: true }));
// <span class="ansi-palette-255-fg">Hello</span> <span class="ansi-palette-235-bg">World</span>

Converting to JSON instead produces similar results.

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

No branches or pull requests

1 participant