Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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

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

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

PREVIOUS NEXT
Code Example
Javascript :: jquery pause n seconds 
Javascript :: counterup2.js cdn 
Javascript :: how to use another port in angular 
Javascript :: hide header react navigation 
Javascript :: javascript check if function exists 
Javascript :: get random number with min and max 
Javascript :: how to make an alphabet in javascript 
Javascript :: javascript check for undefined 
Javascript :: update version of node gyp 
Javascript :: nest js install and create project 
Javascript :: generating component in angular without spec file 
Javascript :: how to get the width of the browser in javascript 
Javascript :: jquery button remove disabled attribute 
Javascript :: get current url host name in javascript 
Javascript :: jquery check if element has css display none 
Javascript :: javascript selection sort 
Javascript :: boxshadow in react native 
Javascript :: js show span for 5 seconds 
Javascript :: axios node js set user agent 
Javascript :: javascript get current month start and end date 
Javascript :: npm ERR! Fix the upstream dependency conflict, 
Javascript :: alphabet regex js 
Javascript :: react native animated sticker 
Javascript :: javascript get css variable 
Javascript :: js redirect to relative url 
Javascript :: uppercase javascript 
Javascript :: 419 unknown status ajax laravel 
Javascript :: javascript date minus seconds 
Javascript :: react native touchableopacity disable 
Javascript :: javascrip reverse text 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =