New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@palett/util-ansi

Package Overview
Dependencies
Maintainers
1
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@palett/util-ansi - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

30

dist/index.cjs.js

@@ -5,4 +5,9 @@ 'use strict';

var convert = require('@palett/convert');
const CLR_ALL = '0';
const ESC = '\u001b';
const L = ESC + '[';
const R = 'm';
const SC = ';';

@@ -65,15 +70,27 @@ const FORE = '38;2';

*
* @param {string[]} config
* @param {string[]} codes
* @returns {string}
*/
const br = config => `${ESC}[${config.join(';')}m`;
const br = codes => L + codes.join(SC) + R;
/**
*
* @param {string} config
* @param {string} code
* @returns {string}
*/
const brt = config => `${ESC}[${config}m`;
const brt = code => L + code + R;
/**
*
* @param {number[]} rgb - array of three integers, each from 0 to 255
* @returns {string}
*/
const rgbToAnsi = rgb => FORE + SC + rgb[0] + SC + rgb[1] + SC + rgb[2];
const hexToAnsi = hex => {
const int = convert.hexToInt(hex);
return FORE + SC + (int >> 16 & 0xFF) + SC + (int >> 8 & 0xFF) + SC + (int & 0xFF);
};
exports.BACK = BACK;

@@ -87,3 +104,8 @@ exports.CLR_ALL = CLR_ALL;

exports.FORE = FORE;
exports.L = L;
exports.R = R;
exports.SC = SC;
exports.br = br;
exports.brt = brt;
exports.hexToAnsi = hexToAnsi;
exports.rgbToAnsi = rgbToAnsi;

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

import { hexToInt } from '@palett/convert';
const CLR_ALL = '0';
const ESC = '\u001b';
const L = ESC + '[';
const R = 'm';
const SC = ';';

@@ -60,15 +65,27 @@ const FORE = '38;2';

*
* @param {string[]} config
* @param {string[]} codes
* @returns {string}
*/
const br = config => `${ESC}[${config.join(';')}m`;
const br = codes => L + codes.join(SC) + R;
/**
*
* @param {string} config
* @param {string} code
* @returns {string}
*/
const brt = config => `${ESC}[${config}m`;
const brt = code => L + code + R;
export { BACK, CLR_ALL, CLR_BACK, CLR_FORE, ConsoleColors, ESC, Effects, FORE, br, brt };
/**
*
* @param {number[]} rgb - array of three integers, each from 0 to 255
* @returns {string}
*/
const rgbToAnsi = rgb => FORE + SC + rgb[0] + SC + rgb[1] + SC + rgb[2];
const hexToAnsi = hex => {
const int = hexToInt(hex);
return FORE + SC + (int >> 16 & 0xFF) + SC + (int >> 8 & 0xFF) + SC + (int & 0xFF);
};
export { BACK, CLR_ALL, CLR_BACK, CLR_FORE, ConsoleColors, ESC, Effects, FORE, L, R, SC, br, brt, hexToAnsi, rgbToAnsi };

6

package.json
{
"name": "@palett/util-ansi",
"version": "0.0.15",
"version": "0.0.16",
"description": "A color converter",

@@ -19,3 +19,3 @@ "main": "dist/index.cjs.js",

"dependencies": {
"@palett/convert": "^0.0.15"
"@palett/convert": "^0.0.16"
},

@@ -40,3 +40,3 @@ "repository": {

"homepage": "https://github.com/hoyeungw/palett/util-ansi#readme",
"gitHead": "0c47b12f229babf25f5841925245a1d2d63fda01"
"gitHead": "64ccfe78f8e7d28e40901daf6c9dabbdd7891ced"
}
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