nanocolors
Advanced tools
Comparing version 0.1.3 to 0.1.4
let nope = s => String(s) | ||
let isColorSupported = false | ||
// Modifiers | ||
let reset = nope | ||
@@ -14,4 +12,2 @@ let bold = nope | ||
let strikethrough = nope | ||
// Colors | ||
let black = nope | ||
@@ -26,4 +22,2 @@ let red = nope | ||
let gray = nope | ||
// Background | ||
let bgBlack = nope | ||
@@ -40,3 +34,3 @@ let bgRed = nope | ||
return { | ||
isColorSupported: false, | ||
isColorSupported, | ||
reset, | ||
@@ -70,3 +64,3 @@ bold, | ||
export { | ||
module.exports = { | ||
isColorSupported, | ||
@@ -73,0 +67,0 @@ reset, |
@@ -32,30 +32,4 @@ type Color = (text: string | number) => string | ||
/** | ||
* Does environment support color output. | ||
* | ||
* ```js | ||
* import { isColorSupported } from 'nanocolors' | ||
* | ||
* if (isColorSupported) { | ||
* console.log('With colors') | ||
* } | ||
* ``` | ||
*/ | ||
export const isColorSupported: boolean | ||
/** | ||
* A way to overwrite color support autodetection. | ||
* | ||
* ```js | ||
* import { createColors } from 'nanocolors' | ||
* | ||
* const { red } = createColors(options.enableColors) | ||
* ``` | ||
* | ||
* @param enabled Do we need to enable colors. On `undefined` we will try | ||
* to detect color support. | ||
*/ | ||
export function createColors(enabled?: boolean): Colors | ||
// Modifiers | ||
export const reset: Color | ||
@@ -69,4 +43,2 @@ export const bold: Color | ||
export const strikethrough: Color | ||
// Colors | ||
export const black: Color | ||
@@ -81,4 +53,2 @@ export const red: Color | ||
export const gray: Color | ||
// Background | ||
export const bgBlack: Color | ||
@@ -85,0 +55,0 @@ export const bgRed: Color |
14
index.js
@@ -1,2 +0,2 @@ | ||
import tty from 'tty' | ||
let tty = require('tty') | ||
@@ -44,4 +44,2 @@ let isDisabled = 'NO_COLOR' in process.env | ||
isColorSupported: true, | ||
// Modifiers | ||
reset: color(0, 0), | ||
@@ -55,4 +53,2 @@ bold: color(1, 22), | ||
strikethrough: color(9, 29), | ||
// Colors | ||
black: color(30, 39), | ||
@@ -67,4 +63,2 @@ red: color(31, 39), | ||
gray: color(90, 39), | ||
// Background | ||
bgBlack: color(40, 49), | ||
@@ -90,4 +84,2 @@ bgRed: color(41, 49), | ||
strikethrough: nope, | ||
// Colors | ||
black: nope, | ||
@@ -102,4 +94,2 @@ red: nope, | ||
gray: nope, | ||
// Background | ||
bgBlack: nope, | ||
@@ -145,3 +135,3 @@ bgRed: nope, | ||
export { | ||
module.exports = { | ||
isColorSupported, | ||
@@ -148,0 +138,0 @@ reset, |
{ | ||
"name": "nanocolors", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "2x times faster than chalk and use 5x less space in node_modules", | ||
@@ -23,20 +23,4 @@ "keywords": [ | ||
"browser": { | ||
"./index.js": "./index.browser.js", | ||
"./index.cjs": "./index.browser.cjs" | ||
}, | ||
"type": "module", | ||
"main": "index.cjs", | ||
"module": "index.js", | ||
"react-native": "index.js", | ||
"exports": { | ||
".": { | ||
"browser": "./index.browser.js", | ||
"require": "./index.cjs", | ||
"import": "./index.js", | ||
"default": "./index.js", | ||
"types": "./index.d.ts" | ||
}, | ||
"./package.json": "./package.json", | ||
"./index.d.ts": "./index.d.ts" | ||
"./index.js": "./index.browser.js" | ||
} | ||
} | ||
} |
@@ -75,3 +75,3 @@ # Nano Colors | ||
colorette 32 KB | ||
nanocolors 28 KB | ||
nanocolors 36 KB | ||
``` | ||
@@ -161,3 +161,3 @@ | ||
Nano Colors has build-in Deno support. | ||
Nano Colors has build-in [Deno support](https://deno.land/x/nanocolors). | ||
@@ -164,0 +164,0 @@ ```js |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9
10922
6
290
No