You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library was created to support Jest assertions which use ANSI colors to display errors even though it's not used in an actual project yet.
👆 That makes it seem like there was a particular issue that you had with the other npm color libraries that you wanted to solve by making this one. I'm wondering what that particular issue is so that I can better understand the purpose behind this package. From the readme it would appear that the main purpose is to print colors to the console like this:
importcfrom"tinyrainbow"console.log(c.red("Hello red world!"))
And there's also a note about this package being a fork of picocolors:
A small (~ 6 kB unpacked) fork of picocolors with support for exports field.
I'm particularly interested to know how this package improves over the picocolors package.
But there are a number of other color packages that do similar (if not identical) things. What sets this one apart? 🤔
import*ascolorsfrom"colors/safe"console.log(colors.green('hello'));// outputs green textconsole.log(colors.red.underline('i like cake and pies'))// outputs red underlined textconsole.log(colors.inverse('inverse the color'));// inverses the colorconsole.log(colors.rainbow('OMG Rainbows!'));// rainbowconsole.log(colors.trap('Run the trap'));// Drops the bass
importchalkfrom'chalk';// Combine styled and normal stringsconsole.log(chalk.blue('Hello')+' World'+chalk.red('!'));// Compose multiple styles using the chainable APIconsole.log(chalk.blue.bgRed.bold('Hello world!'));// Pass in multiple argumentsconsole.log(chalk.blue('Hello','World!','Foo','bar','biz','baz'));// Nest stylesconsole.log(chalk.red('Hello',chalk.underline.bgBlue('world')+'!'));// Nest styles of the same type even (color, underline, background)console.log(chalk.green('I am a green line '+chalk.blue.underline.bold('with a blue substring')+' that becomes green again!'));// ES2015 template literalconsole.log(`CPU: ${chalk.red('90%')}RAM: ${chalk.green('40%')}DISK: ${chalk.yellow('70%')}`);// Use RGB colors in terminal emulators that support it.console.log(chalk.rgb(123,45,67).underline('Underlined reddish color'));console.log(chalk.hex('#DEADED').bold('Bold gray!'));
import{blue,bold,underline}from"colorette"console.log(` There's a ${underline(blue("house"))}, With a ${bold(blue("window"))}, And a ${blue("corvette")} And everything is blue`)console.log(bold(`I'm ${blue(`da ba ${underline("dee")} da ba`)} daa`))import{createColors}from"colorette"const{ blue }=createColors({useColor: false})console.log(blue("Blue? Nope, nah"))
importcfrom'ansi-colors';console.log(c.red('This is a red string!'));console.log(c.green('This is a red string!'));console.log(c.cyan('This is a cyan string!'));console.log(c.yellow('This is a yellow string!'));
importclcfrom"cli-color"console.log(clc.red("Text in red"));console.log(clc.red.bgWhite.underline("Underlined red text on white background."));console.log(clc.red("red")+" plain "+clc.blue("blue"));console.log(clc.red("red "+clc.blue("blue")+" red"));
This ties in with my #1 idea to re-invent this package as *the* cross-platform color package; a niche that isn't yet filled (all these are Node.js only)
...instead of repeating an oversaturated niche.
👆 but again this is an IDEA and I don't mean to sound like I'm diminishing your VALID USECASE or your code work. this is just a clarification of why (helpful for other users of this package too to know if it's what they want! also helps to know "why tinyrainbow instead of $X?")
The text was updated successfully, but these errors were encountered:
From the readme it would appear that the main purpose is to print colors to the console like this
The main purpose is to be able to generate a string that can be printed in Node.js or the chrome-browser. The string can be stored separately from the console call. The interface needs to be compatible with Jest's diff config. I like the simplicity of picocolors so I went with it. Unfortunately, it doesn't print colored outputs in the browser.
I don't really know how to explain it further. All other solutions don't satisfy the use case: be small, work in Node and Chrome, provide only non-chainable calls.
👆 That makes it seem like there was a particular issue that you had with the other npm color libraries that you wanted to solve by making this one. I'm wondering what that particular issue is so that I can better understand the purpose behind this package. From the readme it would appear that the main purpose is to print colors to the console like this:
And there's also a note about this package being a fork of picocolors:
I'm particularly interested to know how this package improves over the picocolors package.
But there are a number of other color packages that do similar (if not identical) things. What sets this one apart? 🤔
https://www.npmjs.com/package/colors
https://www.npmjs.com/package/chalk
https://github.com/jorgebucaran/colorette 🌟 this one seems like almost a carbon-copy of this package
https://github.com/doowb/ansi-colors
https://www.npmjs.com/package/cli-color
https://github.com/lukeed/kleur
https://github.com/xpl/ansicolor
This ties in with my #1 idea to re-invent this package as *the* cross-platform color package; a niche that isn't yet filled (all these are Node.js only)
...instead of repeating an oversaturated niche.
👆 but again this is an IDEA and I don't mean to sound like I'm diminishing your VALID USECASE or your code work. this is just a clarification of why (helpful for other users of this package too to know if it's what they want! also helps to know "why tinyrainbow instead of $X?")
The text was updated successfully, but these errors were encountered: