Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js console log with color

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

console.log with color font

 console.log("%cThis is a %cConsole.log", "background:black ; color: white", "color: red; font-size:25px");
Comment

console.log with color font

var colors = require('colors');

console.log('i am black'.bgBlack);
console.log('i am red'.bgRed);
console.log('i am green'.bgGreen);
console.log('i am black'.bgYellow);
console.log('i am blue'.bgBlue);
console.log('i am magenta'.bgMagenta);
console.log('i am cyan'.bgCyan);
console.log('i am white'.bgWhite);
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

javascript colorized console.log

console.log('%cconsole.log', 'color: green;');
console.info('%cconsole.info', 'color: green;');
console.debug('%cconsole.debug', 'color: green;');
console.warn('%cconsole.warn', 'color: green;');
console.error('%cconsole.error', 'color: green;');
Comment

changing color of console log

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

console.log with color font

var colors = require('colors');

console.log('i am black'.black);
console.log('i am red'.red);
console.log('i am green'.green);
console.log('i am black'.yellow);
console.log('i am blue'.blue);
console.log('i am magenta'.magenta);
console.log('i am cyan'.cyan);
console.log('i am white'.white);
console.log('i am gray'.gray);
console.log('i am grey'.grey);
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 colorized console.log

const styles = ['color: green', 'background: yellow'].join(';');

const message = 'Some Important Message Here';

// 3. Using the styles and message variable
console.log('%c%s', styles, message);
Comment

javascript console.log colors

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

javascript colorized console.log

console.log(
  'Nothing here %cHi Cat %cHey Bear', // Console Message
  'color: blue',
  'color: red', // CSS Style
);
Comment

console.log with color font

 console.log("%cThis Is Line One ", "font-size:30px");o
Comment

javascript console.log colors

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

javascript colorized console.log

// 1. Pass the css styles in an array
const styles = [
  'color: green',
  'background: yellow',
  'font-size: 30px',
  'border: 1px solid red',
  'text-shadow: 2px 2px black',
  'padding: 10px',
].join(';'); // 2. Concatenate the individual array item and concatenate them into a string separated by a semi-colon (;)

// 3. Pass the styles variable
console.log('%cHello There', styles);
Comment

console.log with color font

var colors = require('colors');

console.log('This is bold'.bold);
console.log('This is dim'.dim);
console.log('This is italic'.italic);
console.log('This is underline'.underline);
console.log('This is inverse'.inverse);
console.log('This is hidden'.hidden);
Comment

console.log colorido

const Style = {
    base: [
        "color: #fff",
        "background-color: #444",
        "padding: 2px 4px",
        "border-radius: 2px"
    ],
    warning: [
        "color: #eee",
        "background-color: red"
    ],
    success: [
        "background-color: green"
    ]
}
const log = (text, extra = []) => {
    let style = Style.base.join(';') + ';';
    style += extra.join(';'); // Add any additional styles
    console.log(`%c${text}`, style);
}

log("Normal Logs");
log("Warning Logs", Style.warning);
log("Success Logs", Style.success);
Comment

console.log with color font

var colors = require('colors');

console.log('This is rainbow'.rainbow);
console.log('This is zebra'.zebra);
console.log('This is america'.america);
console.log('This is trap'.trap);
console.log('This is random'.random);
console.log('This is random2'.random);
console.log('This is random3'.random);
Comment

PREVIOUS NEXT
Code Example
Javascript :: react change button color on hover 
Javascript :: jquery confirm delete massege 
Javascript :: get value of datalist javascript 
Javascript :: how to flatten array with reduce in javascript 
Javascript :: how to read a firebase txt file 
Javascript :: align text in js 
Javascript :: javascript play sound on click 
Javascript :: match url regex 
Javascript :: redirect not found in react-router-dom 
Javascript :: how to disable mouse right click in html page 
Javascript :: javascript remove dom element 
Javascript :: turn nodelist into array 
Javascript :: To set the text of button using Jquery 
Javascript :: how to block special characters in javascript 
Javascript :: generate module with routing in angular 
Javascript :: index.js vs main.js 
Javascript :: javascript remove last child element 
Javascript :: get json data when we get error code in axios 
Javascript :: slick on init 
Javascript :: get docs with date intervals mongoose 
Javascript :: footer dynamic copyright reactjs 
Javascript :: get alert after using ajax 
Javascript :: javascript iterate through object properties 
Javascript :: express messages 
Javascript :: get value of span jquery 
Javascript :: Jquery get value of dropdown selected 
Javascript :: electron download 
Javascript :: javascript startswith 
Javascript :: javscript generate empty 2d array 
Javascript :: split string into equal chunks javascript 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =