Last active
March 28, 2018 05:52
-
-
Save hackerzhut/beed14c4338d6303a77d46a2dbd3ded2 to your computer and use it in GitHub Desktop.
Color Log using Proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
const log = new Proxy({}, { | |
get: (_, color) => (...args) => console.log(`%c ${args.join(' ')}`, `color: ${color}`) | |
}); | |
log.tomato('I am tomato') | |
log.chocolate('I am chocolate') | |
log.cornflowerblue('I am cornflowerblue') | |
log.darkcyan('I am darkcyan') | |
log.goldenrod('I am goldenrod') | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment