feat: Add support truecolor, #352#354
Open
webdiscus wants to merge 4 commits intocli-table:masterfrom
Open
Conversation
- replace @colors/colors with smaller, fater ansis which supports truecolor - add a syntax for using hex color in style option - add doumentation to the README how to use colors in tables - add tests for using colors - add missing test coverage script to package.json
webdiscus
commented
Feb 8, 2025
| "string-width": "^4.2.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@colors/colors": "1.5.0", |
Author
There was a problem hiding this comment.
The @colors/colors package is still required for test the legacy cli-table package in the verify-legacy-compatibility-test.js file, therefore it should be in devDependencies
webdiscus
commented
Feb 8, 2025
| for (let i = this[styleProperty].length - 1; i >= 0; i--) { | ||
| colors = colors[this[styleProperty][i]]; | ||
| let style = this[styleProperty][i]; | ||
| let isHex = style.startsWith('hex'); |
Author
There was a problem hiding this comment.
Add support for new truecolor syntax using hex code, e.g.: hex(#FFD700) and bgHex(#FFD700).
webdiscus
commented
Feb 8, 2025
| }); | ||
|
|
||
| it('length of "hello" in zebra is 5', function () { | ||
| expect(strlen(colors.zebra('hello'))).toEqual(5); |
Author
There was a problem hiding this comment.
replace the @colors/colors specifically style with standard bold.
Open
Author
|
Ansis works on Node.js since |
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.
I'm the author of ansis.
This PR replaces the outdated @colors/colors (last update 2 years ago) package with smaller and faster - ansis, which supports truecolor.
Changes:
For example:
style: { border: ['hex(#FFD700)'], head: ['hex(#FFA500)', 'bgHex(#3d239d)'] }test:coveragescript to package.json