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.1 to 2.3.2

test/color.test.js

35

lib/color.js

@@ -6,11 +6,36 @@ const chalk = require('chalk')

const defaultColorLevel = 3
const context = { chalk }
const context = { chalk, level: defaultColorLevel }
function setColorLevel (desiredLevel) {
const colorLevel = Number(desiredLevel)
const level = isNaN(colorLevel) ? defaultColorLevel : (colorLevel <= 0) ? 0 : (colorLevel > 3) ? 3 : colorLevel
let level = colorLevel
if (isNaN(colorLevel)) {
level = defaultColorLevel
} else if (colorLevel < 0) {
level = 0
} else if (colorLevel > 3) {
level = 3
}
context.level = level
context.chalk = new chalk.Instance({ level })
return level
}
setColorLevel(process.env.BUZULI_COLOR_LEVEL)
function getColorLevel () {
return context.level
}
function initColor (ignoreTTY=false) {
const desiredColorLevel = process.env.BUZULI_COLOR_LEVEL
const forceColorOff = !process.stdout.isTTY && !ignoreTTY
const resolvedColorLevel = forceColorOff ? 0 : desiredColorLevel
setColorLevel(resolvedColorLevel)
}
initColor()
const light = process.env.BUZULI_COLOR_LIGHT

@@ -53,3 +78,5 @@ const dark = process.env.BUZULI_COLOR_DARK

pool: colorPool,
setColorLevel
initColor,
setColorLevel,
getColorLevel,
}

@@ -56,0 +83,0 @@

2

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

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

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