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

eight-colors

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eight-colors - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

lib/index.d.ts

3

dist/eight-colors.js

@@ -1,2 +0,1 @@

!function(o,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("eight-colors",[],e):"object"==typeof exports?exports["eight-colors"]=e():o["eight-colors"]=e()}(self,(()=>{return o={578:o=>{const e={},r=(o,e,r)=>`[${o}m${e}[${r}m`,t=["black","red","green","yellow","blue","magenta","cyan","white"];t.forEach(((o,t)=>{e[o]=o=>r(`3${t}`,o,"39")})),e.bg={},t.forEach(((o,t)=>{e.bg[o]=o=>r(`4${t}`,o,"49")})),e.br={},t.forEach(((o,t)=>{e.br[o]=o=>r(`9${t}`,o,"39")})),e.br.bg={},t.forEach(((o,t)=>{e.br.bg[o]=o=>r(`10${t}`,o,"49")})),e.reset=o=>r("0",o,"0"),e.bold=o=>r("1",o,"21"),e.faint=o=>r("2",o,"22"),e.italic=o=>r("3",o,"23"),e.underline=o=>r("4",o,"24"),e.inverse=o=>r("7",o,"27"),e.hidden=o=>r("8",o,"28"),e.strike=o=>r("9",o,"29"),e.remove=o=>`${o}`.replace(/\033\[(\d+)m/g,""),e.log=function(){console.log.apply(console,arguments)},e.logColor=function(){const o=Array.from(arguments),r=o.pop();let t;const n=e[r];return"function"==typeof n?t=n(o.join(" ")):(o.push(r),t=o.join(" ")),e.log(t),t},t.forEach((o=>{const r=`log${o.charAt(0).toUpperCase()}${o.slice(1)}`;e[r]=function(){const r=Array.from(arguments);return r.push(o),e.logColor.apply(e,r)}})),o.exports=e},148:(o,e,r)=>{const t=r(578);o.exports=t}},e={},function r(t){var n=e[t];if(void 0!==n)return n.exports;var c=e[t]={exports:{}};return o[t](c,c.exports,r),c.exports}(148);var o,e}));
//# sourceMappingURL=eight-colors.js.map
!function(o,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("eight-colors",[],e):"object"==typeof exports?exports["eight-colors"]=e():o["eight-colors"]=e()}(self,(()=>{return o={578:o=>{const e={},r=(o,e,r)=>`[${o}m${e}[${r}m`,t=["black","red","green","yellow","blue","magenta","cyan","white"];t.forEach(((o,t)=>{e[o]=o=>r(`3${t}`,o,"39")})),e.bg={},t.forEach(((o,t)=>{e.bg[o]=o=>r(`4${t}`,o,"49")})),e.br={},t.forEach(((o,t)=>{e.br[o]=o=>r(`9${t}`,o,"39")})),e.br.bg={},t.forEach(((o,t)=>{e.br.bg[o]=o=>r(`10${t}`,o,"49")})),e.reset=o=>r("0",o,"0"),e.bold=o=>r("1",o,"21"),e.faint=o=>r("2",o,"22"),e.italic=o=>r("3",o,"23"),e.underline=o=>r("4",o,"24"),e.inverse=o=>r("7",o,"27"),e.hidden=o=>r("8",o,"28"),e.strike=o=>r("9",o,"29"),e.remove=o=>`${o}`.replace(/\033\[(\d+)m/g,""),e.log=function(){console.log.apply(console,arguments)},e.logColor=function(){let o=Array.from(arguments);const r=o.pop(),t=e[r];return"function"==typeof t?o=o.map((o=>t(o))):o.push(r),e.log.apply(e,o),o.join(" ")},t.forEach((o=>{const r=`log${o.charAt(0).toUpperCase()}${o.slice(1)}`;e[r]=function(){const r=Array.from(arguments);return r.push(o),e.logColor.apply(e,r)}})),o.exports=e},148:(o,e,r)=>{const t=r(578);o.exports=t}},e={},function r(t){var n=e[t];if(void 0!==n)return n.exports;var c=e[t]={exports:{}};return o[t](c,c.exports,r),c.exports}(148);var o,e}));

@@ -7,10 +7,10 @@ const EC = {};

//https://en.wikipedia.org/wiki/ANSI_escape_code
//https://handwiki.org/wiki/ANSI_escape_code
// https://en.wikipedia.org/wiki/ANSI_escape_code
// https://handwiki.org/wiki/ANSI_escape_code
//eight colors
//0 - 7
// eight colors
// 0 - 7
const list = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'];
//text color
// text color
list.forEach((name, i) => {

@@ -22,3 +22,3 @@ EC[name] = (str) => {

//background color
// background color
EC.bg = {};

@@ -31,3 +31,3 @@ list.forEach((name, i) => {

//bright color
// bright color
EC.br = {};

@@ -40,3 +40,3 @@ list.forEach((name, i) => {

//bright background color
// bright background color
EC.br.bg = {};

@@ -50,3 +50,3 @@ list.forEach((name, i) => {

//styles
// styles
EC.reset = (str) => {

@@ -77,3 +77,3 @@ return add('0', str, '0');

//remove color
// remove color
EC.remove = (str) => {

@@ -83,3 +83,3 @@ return `${str}`.replace(/\033\[(\d+)m/g, '');

//log hook
// log hook
EC.log = function() {

@@ -90,14 +90,12 @@ console.log.apply(console, arguments);

EC.logColor = function() {
const args = Array.from(arguments);
let args = Array.from(arguments);
const color = args.pop();
let str;
const fn = EC[color];
if (typeof fn === 'function') {
str = fn(args.join(' '));
args = args.map((it) => fn(it));
} else {
args.push(color);
str = args.join(' ');
}
EC.log(str);
return str;
EC.log.apply(EC, args);
return args.join(' ');
};

@@ -104,0 +102,0 @@

{
"name": "eight-colors",
"version": "1.0.3",
"version": "1.1.0",
"description": "Eight colors for the console",
"main": "lib/index.js",
"main": "./lib/index.js",
"browser": {
"eight-colors": "dist/eight-colors.js"
"eight-colors": "./dist/eight-colors.js"
},
"exports": {
".": {
"types": "./lib/index.d.ts",
"import": "./lib/index.mjs",
"require": "./lib/index.js",
"default": "./lib/index.js"
},
"./package.json": "./package.json"
},
"types": "./lib/index.d.ts",
"scripts": {

@@ -18,2 +28,3 @@ "test": "node ./scripts/test.js",

],
"license": "MIT",
"repository": {

@@ -25,3 +36,3 @@ "type": "git",

"devDependencies": {
"eslint": "^8.36.0",
"eslint": "^8.56.0",
"eslint-config-plus": "^1.0.6",

@@ -28,0 +39,0 @@ "eslint-plugin-html": "^7.1.0"

@@ -22,18 +22,34 @@ # Eight Colors

//check out all APIs
// check out all APIs
console.log(EC);
//text color
// print all APIs
const print = (parent, ls) => {
if (typeof parent === 'function') {
console.log(`${ls.join('.')}(String)`);
return;
}
for (const k in parent) {
print(parent[k], ls.concat(k));
}
};
print(EC, ['EC']);
// text color
console.log(EC.red('red string'));
//background color
// background color
console.log(EC.bg.red('red background'));
//bright color
// bright color
console.log(EC.br.red('bright red string'));
//bright background color
// bright background color
console.log(EC.br.bg.red('bright red background'));
//style
// style
console.log(EC.italic('italic text'));

@@ -43,3 +59,3 @@ console.log(EC.underline('underline text'));

//remove color
// remove color
const redString = EC.red('red string');

@@ -50,4 +66,5 @@ console.log(redString);

//log color
EC.logColor('string', 'red');
// log color
const res = EC.logColor('string1', 'string2', 'red');
console.assert(EC.remove(res) === 'string1 string2');

@@ -65,3 +82,2 @@ EC.logGreen('log green');

EC.logColor('logColor 2 arguments without color', '2');
```

@@ -120,3 +136,3 @@ ![](/scripts/screenshots.png)

EC.log(String)
EC.logColor(String, Color)
EC.logColor(String, ColorName)

@@ -152,11 +168,14 @@ EC.logBlack(String)

* 1.1.0
- added types
* 1.0.3
* fixed API multiple arguments
- fixed API multiple arguments
* 1.0.2
* added browser bundle
- added browser bundle
* 1.0.1
* added log color API
- added log color API
* 1.0.0
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