Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js console log with color

console.log('%c Oh my heavens! ', 'background: #222; color: #bada55');
Comment

console.log color terminal

Reset = "x1b[0m"
Bright = "x1b[1m"
Dim = "x1b[2m"
Underscore = "x1b[4m"
Blink = "x1b[5m"
Reverse = "x1b[7m"
Hidden = "x1b[8m"

FgBlack = "x1b[30m"
FgRed = "x1b[31m"
FgGreen = "x1b[32m"
FgYellow = "x1b[33m"
FgBlue = "x1b[34m"
FgMagenta = "x1b[35m"
FgCyan = "x1b[36m"
FgWhite = "x1b[37m"

BgBlack = "x1b[40m"
BgRed = "x1b[41m"
BgGreen = "x1b[42m"
BgYellow = "x1b[43m"
BgBlue = "x1b[44m"
BgMagenta = "x1b[45m"
BgCyan = "x1b[46m"
BgWhite = "x1b[47m"
Comment

console.log color

colors = {
    reset: '33[0m',

    //text color

    black: '33[30m',
    red: '33[31m',
    green: '33[32m',
    yellow: '33[33m',
    blue: '33[34m',
    magenta: '33[35m',
    cyan: '33[36m',
    white: '33[37m',

    //background color

    blackBg: '33[40m',
    redBg: '33[41m',
    greenBg: '33[42m',
    yellowBg: '33[43m',
    blueBg: '33[44m',
    magentaBg: '33[45m',
    cyanBg: '33[46m',
    whiteBg: '33[47m'
}

console.log('33[31m this is red color on text');
console.log('33[0m this is reset');
console.log('33[41m this is red color on background');
Comment

js console.log color

console.log('%c My txt ', 'My css');

// Example
console.log('%c Hello world ', 'background: #222; color: #bada55');
Comment

changing color of console log

console.log('%c Oh my heavens! ', 'background: #222; color: #bada55');
 Run code snippetHide results
Comment

how to change the color of a console.log in javascript

// Download the npm package "colors"
// npm i colors

var colors = require("colors");

console.log("Hello World".blue);

// output: Hello World (Its blue btw lmao)
Comment

javascript console.log colors

console.log('x1b[33m%sx1b[0m', 'hi!')
Comment

javascript console.log colors

console.log('%c Hello World','color:red;border:1px solid dodgerblue');
Comment

PREVIOUS NEXT
Code Example
Javascript :: getting href value in jquery 
Javascript :: javascript create an array of range between two numbers 
Javascript :: install proptypes react 
Javascript :: js get option value 
Javascript :: adb bootloader reboot 
Javascript :: javascript array filter with multiple id 
Javascript :: refresh after delete in node 
Javascript :: javascript range of integers with spread 
Javascript :: array remove index from array 
Javascript :: react native datepicker disable future dates 
Javascript :: daterangepicker set maxdate 
Javascript :: json to csv nodejs 
Javascript :: if else short term 
Javascript :: To append dropdown option using jquery 
Javascript :: javascript clear all cookies 
Javascript :: uuid timestamp for javascript 
Javascript :: Array.include is not a function javascript error help 
Javascript :: react 404 page not found 
Javascript :: nuxt input mask 
Javascript :: get value json python 
Javascript :: jquery get element innertext 
Javascript :: js regex with variable 
Javascript :: check if at least one checkbox is checked 
Javascript :: get file extention js 
Javascript :: javascript date time formating 
Javascript :: lodash convert object to array 
Javascript :: how to auto refresh a div js 
Javascript :: fileupload progress bar in axios 
Javascript :: Use History React Router v5 app 
Javascript :: javascript delete second last element of array 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =