Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
console-log-colors
Advanced tools
Console log colors helper for simple lightweight useage, no external dependencies.
Console log colors helper for simple lightweight useage. No external dependencies. It supports use in Node.js and Browser(Since Chrome 69) environments.
Please use chalk for complex requirements.
npm install console-log-colors
Examples:
const { color, log, red, green, cyan, cyanBright } = require('console-log-colors');
// or use import
import { color, log, red, green, cyan, cyanBright } from 'console-log-colors';
// ansi colors
console.log(green('This is a green string!'));
console.log(color.green('This is a green string!'));
console.log(color('This is a green string!', 'green'));
// chained styles
console.log(cyan.bgRed.bold.underline('Hello world!'));
// log
log('This is a green string!', 'green');
log.green('This is a green string!', 'This is a green string!');
// helpers
console.log('isSupported:', clc.isSupported());
clc.disable();
console.log('isSupported(after disabled):', clc.isSupported());
clc.enable();
console.log('isSupported(after enabled):', clc.isSupported());
const greenstr = clc.green('This is a green string!');
const striped = clc.strip(greenstr);
console.log(greenstr, ' ==> [striped]', striped);
import { cyan } from 'console-log-colors';
console.log(cyan.bgRed.bold.underline('Hello world!'));
console.log(bold.cyan.bgRed.underline('Hello world!'));
import { red, white, gray } from 'console-log-colors';
console.log(
red(`a red ${white('white')} red ${red('red')} red ${gray('gray')} red ${red('red')} red ${red('red')}`)
);
Support ansi256 colors. For example:
import { c250 } from 'console-log-colors';
console.log(c250.bg129(' ANSI256: color 250 and background 129 '));
color[color type](string)
import { color } from 'console-log-colors';
console.log(color.red('red'), color.green('green'), color.cyanBright('cyanBright'));
log[color type](str)
import { log } from 'console-log-colors';
log.red('red text');
log.green('green text');
log.cyanBright('cyanBright text', 'cyanBright text2');
color.list
Object.keys(color.list).forEach(function (colorType) {
log[colorType](colorType);
});
modifier:
color:
Bright color:
bgColor:
bgColor - legacy styles for colors pre version:
Bright bgColor:
ANSI256
:
c<0~255>
bg<0~255>
$ npm run benchmark
Output reference:
# All Colors
+ console-log-colors x 1,713,611 ops/sec ±1.35% (88 runs sampled))
ansi-colors x 361,503 ops/sec ±1.15% (89 runs sampled))
cli-color x 61,993 ops/sec ±1.53% (91 runs sampled)
picocolors x 1,458,754 ops/sec ±1.14% (90 runs sampled)
colorette x 441,998 ops/sec ±1.19% (92 runs sampled)
chalk x 922,968 ops/sec ±1.30% (91 runs sampled)d)
kleur x 1,162,681 ops/sec ±1.46% (87 runs sampled)
yoctocolors x 345,921 ops/sec ±1.07% (91 runs sampled)
kolorist x 345,567 ops/sec ±0.69% (93 runs sampled)
# Chained colors
+ console-log-colors x 105,119 ops/sec ±2.13% (92 runs sampled))
ansi-colors x 36,412 ops/sec ±1.31% (91 runs sampled)
cli-color x 28,733 ops/sec ±1.10% (90 runs sampled)
chalk x 479,833 ops/sec ±0.82% (93 runs sampled)
kleur x 74,308 ops/sec ±2.06% (75 runs sampled))
# Nested colors
+ console-log-colors x 193,483 ops/sec ±1.20% (88 runs sampled)
ansi-colors x 97,122 ops/sec ±1.21% (89 runs sampled))
cli-color x 25,077 ops/sec ±0.97% (93 runs sampled)
picocolors x 191,207 ops/sec ±1.22% (86 runs sampled)
colorette x 179,415 ops/sec ±1.37% (88 runs sampled)
chalk x 136,924 ops/sec ±1.04% (90 runs sampled)
kleur x 166,470 ops/sec ±1.23% (87 runs sampled)
kolorist x 150,592 ops/sec ±1.33% (90 runs sampled)
console-log-colors
is released under the MIT license.
该插件由志文工作室开发和维护。
FAQs
Console log colors helper for simple lightweight useage, no external dependencies.
The npm package console-log-colors receives a total of 8,179 weekly downloads. As such, console-log-colors popularity was classified as popular.
We found that console-log-colors demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.