Skip to content

Instantly share code, notes, and snippets.

@michael-wolfenden
Forked from bvaughn/console-colors.js
Created August 3, 2018 02:51
Show Gist options
  • Save michael-wolfenden/3f7a0560497112de19d04c448e177dc5 to your computer and use it in GitHub Desktop.
Save michael-wolfenden/3f7a0560497112de19d04c448e177dc5 to your computer and use it in GitHub Desktop.
const COLORS = {
blue: ['#1E88E5', '#90CAF9'],
brown: ['#6D4C41', '#D7CCC8'],
gray: ['#212121', '#BDBDBD'],
green: ['#388E3C', '#A5D6A7'],
red: ['#E53935', '#EF9A9A'],
orange: ['#F4511E', '#FFAB91'],
purple: ['#8E24AA', '#E1BEE7'],
yellow: ['#FFD600', '#FFF59D'],
}
const print = Object.entries(COLORS).reduce(
(api, [name, colors]) => ({
[name]: (shortLabel, longerMessage, optionalSuffix = '') =>
console.log(
`%c${shortLabel}%c${longerMessage}%c${optionalSuffix}`,
`background-color: ${colors[0]}; color: #fff; padding: 2px 4px; font-weight: bold;`,
`background-color: ${colors[1]}; color: #000; padding: 2px 4px;`,
optionalSuffix !== ''
? `background-color: ${colors[0]}; color: #fff; padding: 2px 4px; font-weight: bold;`
: '',
),
...api,
}), {}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment