Socket
Socket
Sign inDemoInstall

color-support

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.1.0

15

index.js

@@ -43,2 +43,17 @@ // call it on itself so we can test the export val for basic stuff

obj = obj || {}
// if just requesting a specific level, then return that.
if (typeof options.level === 'number') {
switch (options.level) {
case 0:
return hasNone(obj, options)
case 1:
return hasBasic(obj)
case 2:
return has256(obj)
case 3:
return has16m(obj)
}
}
obj.level = 0

@@ -45,0 +60,0 @@ obj.hasBasic = false

2

package.json
{
"name": "color-support",
"version": "1.0.1",
"version": "1.1.0",
"description": "A module which will endeavor to guess your terminal's level of color support.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -93,3 +93,28 @@ # color-support

supported (instead of returning `false`).
* level - A number from 0 to 3. This will return a result for the
specified level. This is useful if you want to be able to set the
color support level explicitly as a number in an environment
variable or config, but then use the object flags in your program.
Except for `alwaysReturn` to return an object for level 0, all other
options are ignored, since no checking is done if a level is
explicitly set.
## Return Value
If no color support is available, then `false` is returned by default,
unless the `alwaysReturn` flag is set to `true`. This is so that the
simple question of "can I use colors or not" can treat any truthy
return as "yes".
Otherwise, the return object has the following fields:
* `level` - A number from 0 to 3
* `0` - No color support
* `1` - Basic (16) color support
* `2` - 256 color support
* `3` - 16 million (true) color support
* `hasBasic` - Boolean
* `has256` - Boolean
* `has16m` - Boolean
## CLI

@@ -96,0 +121,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc