Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yoctocolors

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yoctocolors - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

7

index.js

@@ -0,3 +1,8 @@

import tty from 'node:tty';
// TODO: Use a better method when it's added to Node.js (https://github.com/nodejs/node/pull/40240)
const hasColors = tty.WriteStream.prototype.hasColors();
// Intentionally not using template literal for performance.
const format = (startCode, endCode) => string => '\u001B[' + startCode + 'm' + string + '\u001B[' + endCode + 'm';
const format = (startCode, endCode) => hasColors ? string => '\u001B[' + startCode + 'm' + string + '\u001B[' + endCode + 'm' : string => string;

@@ -4,0 +9,0 @@ export const reset = format(0, 0);

{
"name": "yoctocolors",
"version": "0.1.1",
"version": "0.2.0",
"description": "The smallest and fastest command-line coloring package on the internet. Trust me.",

@@ -49,3 +49,8 @@ "license": "MIT",

"xo": "^0.44.0"
},
"ava": {
"environmentVariables": {
"FORCE_COLOR": "1"
}
}
}

@@ -32,3 +32,3 @@ <sup>yoctocolors 🌈</sup>

*This package does not do color support detection. Check out [`supports-color`](https://github.com/chalk/supports-color) if you need that.*
*This package supports [basic color detection](https://nodejs.org/api/tty.html#writestreamhascolorscount-env). Colors can be forcefully enabled by setting the `FORCE_COLOR` environment variable to `1` and can be forcefully disabled by setting `NO_COLOR` or `NODE_DISABLE_COLORS` to any value. [More info.](https://nodejs.org/api/tty.html#writestreamgetcolordepthenv)*

@@ -88,4 +88,15 @@ ## Styles

## Why?
## FAQ
### Why?
See [this discussion](https://github.com/babel/babel/pull/13783).
### What is yocto?
[It's the smallest official unit prefix in the metric system.](https://en.wikipedia.org/wiki/Yocto-) Much smaller than nano.
## Related
- [yoctodelay](https://github.com/sindresorhus/yoctodelay) - Delay a promise a given amount of time
- [chalk](https://github.com/chalk/chalk) - Terminal string styling
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc