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

@buzuli/color

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@buzuli/color - npm Package Compare versions

Comparing version 2.3.2 to 2.4.0

40

lib/color.js

@@ -26,2 +26,29 @@ const chalk = require('chalk')

function isTruthyString (text) {
if (!text)
return false
const truthyStrings = [
'1',
'enabled',
'on',
't',
'true',
'y',
'yes',
]
return truthyStrings.includes(text.toLowerCase())
}
function coerceNumber (text) {
if (text == null)
return undefined
if (isNaN(text))
return undefined
return Number(text)
}
function getColorLevel () {

@@ -32,4 +59,9 @@ return context.level

function initColor (ignoreTTY=false) {
const desiredColorLevel = process.env.BUZULI_COLOR_LEVEL
const forceColorOff = !process.stdout.isTTY && !ignoreTTY
const envIgnoreTTY = isTruthyString(process.env.BUZULI_COLOR_IGNORE_TTY)
const desiredColorLevel = coerceNumber(process.env.BUZULI_COLOR_LEVEL)
const stdoutIsNotTTY = !process.stdout.isTTY
const shouldHonorTTY = !ignoreTTY && !envIgnoreTTY
const forceColorOff = stdoutIsNotTTY && shouldHonorTTY
const resolvedColorLevel = forceColorOff ? 0 : desiredColorLevel

@@ -42,4 +74,4 @@

const light = process.env.BUZULI_COLOR_LIGHT
const dark = process.env.BUZULI_COLOR_DARK
const light = isTruthyString(process.env.BUZULI_COLOR_LIGHT)
const dark = isTruthyString(process.env.BUZULI_COLOR_DARK)

@@ -46,0 +78,0 @@ const codeRed = process.env.BUZULI_COLOR_RED || (light ? 'a10' : dark ? 'd43' : 'b21')

2

package.json
{
"name": "@buzuli/color",
"version": "2.3.2",
"version": "2.4.0",
"description": "Preferred colors for @buzuli's projects",

@@ -5,0 +5,0 @@ "main": "lib/color.js",

@@ -59,4 +59,4 @@ # color

- `BUZULI_COLOR_LIGHT` : optimized for light backgrounds (enabled,on,true,1,yes all work)
- `BUZULI_COLOR_DARK` : optimized for dark backgrounds (enabled,on,true,1,yes all work)
- `BUZULI_COLOR_LIGHT` : optimized for light backgrounds (1,enabled,on,t,true,y,yes all work)
- `BUZULI_COLOR_DARK` : optimized for dark backgrounds (1,enabled,on,t,true,y,yes all work)

@@ -81,1 +81,5 @@ If both `_LIGHT` and `_DARK` are specified, `_LIGHT` wins 🔦.

- 3 : 16 million (Truecolor)
Normally no color will be applied if it is determined that stdout is not a TTY, even if `BUZULI_COLOR_LEVEL` is set.
However, you can override this via `BUZULI_COLOR_IGNORE_TTY` (1,enabled,on,t,true,y,yes all work).
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