Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

chalk npm

const chalk = require('chalk'); const error = chalk.bold.red;const warning = chalk.keyword('orange'); console.log(error('Error!'));console.log(warning('Warning!'));
Comment

npm installl chalk

const chalk = require('chalk');const log = console.log; // Combine styled and normal stringslog(chalk.blue('Hello') + ' World' + chalk.red('!')); // Compose multiple styles using the chainable APIlog(chalk.blue.bgRed.bold('Hello world!')); // Pass in multiple argumentslog(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); // Nest styleslog(chalk.red('Hello', chalk.underline.bgBlue('world') + '!')); // Nest styles of the same type even (color, underline, background)log(chalk.green(    'I am a green line ' +    chalk.blue.underline.bold('with a blue substring') +    ' that becomes green again!')); // ES2015 template literallog(`CPU: ${chalk.red('90%')}RAM: ${chalk.green('40%')}DISK: ${chalk.yellow('70%')}`); // ES2015 tagged template literallog(chalk`CPU: {red ${cpu.totalPercent}%}RAM: {green ${ram.used / ram.total * 100}%}DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}`); // Use RGB colors in terminal emulators that support it.log(chalk.keyword('orange')('Yay for orange colored text!'));log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));log(chalk.hex('#DEADED').bold('Bold gray!'));
Comment

PREVIOUS NEXT
Code Example
Javascript :: postasync json C# 
Javascript :: split decimal value in javascript 
Javascript :: javascript console.log alternative 
Javascript :: how to get which key is pressed in javascript 
Javascript :: bootstrap disable button after click 
Javascript :: find and replace value in array of objects javascript 
Javascript :: get random item from array javascript 
Javascript :: square root numbers in array javascript 
Javascript :: chai compare arrays 
Javascript :: adding to array using reach hooks 
Javascript :: sleeping in js 
Javascript :: jquery open page in new tab 
Javascript :: javascript wait async 
Javascript :: javascript ternary 
Javascript :: not getting any response with fetch javascript method 
Javascript :: map javascript index 
Javascript :: express req body undefined 
Javascript :: python json.dumps pretty print 
Javascript :: hover con js 
Javascript :: regex valid url 
Javascript :: remove char from string js 
Javascript :: smooth scroll safari 
Javascript :: convert arraybuffer to file javascript 
Javascript :: binary search algorithm in javascript 
Javascript :: how to hide react navigation header in react native 
Javascript :: javascript iterate object attribute name 
Javascript :: react native gradient 
Javascript :: remove item from array by value 
Javascript :: urlencoded limit 
Javascript :: app.use bodyparser 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =