-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat: Add support truecolor, #352 #354
base: master
Are you sure you want to change the base?
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
@@ -16,6 +16,7 @@ | |||
"string-width": "^4.2.0" | |||
}, | |||
"devDependencies": { | |||
"@colors/colors": "1.5.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add support for new truecolor syntax using hex code, e.g.: hex(#FFD700)
and bgHex(#FFD700)
.
@@ -17,8 +17,8 @@ describe('utils', function () { | |||
expect(strlen(colors.red('hello'))).toEqual(5); | |||
}); | |||
|
|||
it('length of "hello" in zebra is 5', function () { | |||
expect(strlen(colors.zebra('hello'))).toEqual(5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace the @colors/colors
specifically style with standard bold
.
Ansis works on Node.js since |
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:coverage
script to package.json