Add overline style and remove keyword, hsl, hsv, hwb and ansi color spaces (#433)
This commit is contained in:
parent
0fba91b037
commit
4cf2e40e07
8 changed files with 63 additions and 128 deletions
|
|
@ -1,11 +1,10 @@
|
|||
import chalk from '../index.js';
|
||||
import chalk from '../source/index.js';
|
||||
import convertColor from 'color-convert';
|
||||
import updateLog from 'log-update';
|
||||
import delay from 'yoctodelay';
|
||||
|
||||
const ignoreChars = /[^!-~]/g;
|
||||
|
||||
const delay = milliseconds => new Promise(resolve => {
|
||||
setTimeout(resolve, milliseconds);
|
||||
});
|
||||
|
||||
function rainbow(string, offset) {
|
||||
if (!string || string.length === 0) {
|
||||
return string;
|
||||
|
|
@ -19,7 +18,7 @@ function rainbow(string, offset) {
|
|||
if (ignoreChars.test(character)) {
|
||||
characters.push(character);
|
||||
} else {
|
||||
characters.push(chalk.hsl(hue, 100, 50)(character));
|
||||
characters.push(chalk.hex(convertColor.hsl.hex(hue, 100, 50))(character));
|
||||
hue = (hue + hueStep) % 360;
|
||||
}
|
||||
}
|
||||
|
|
@ -28,9 +27,8 @@ function rainbow(string, offset) {
|
|||
}
|
||||
|
||||
async function animateString(string) {
|
||||
console.log();
|
||||
for (let index = 0; index < 360 * 5; index++) {
|
||||
console.log('\u001B[1F\u001B[G', rainbow(string, index));
|
||||
updateLog(rainbow(string, index));
|
||||
await delay(2); // eslint-disable-line no-await-in-loop
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import styles from 'ansi-styles';
|
||||
import chalk from '../index.js';
|
||||
import chalk from '../source/index.js';
|
||||
|
||||
// Generates screenshot
|
||||
for (const key of Object.keys(styles)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue