// Stringify styles
function stringify(style) {
  if (typeof style === 'string') {
    return style
  }

  return Object.keys(style)
    .map(key => {
      return `${key}:${style[key]}`
    })
    .join(';')
}

function cholk(text) {
  return {
    style: stringify(cholk._style),
    text,
  }
}

cholk._style = {}
cholk.log = (...args) => {
  const results = []
  const styles = []
  args.forEach(arg => {
    if (typeof arg === 'object' && arg.style) {
      results.push(`%c${arg.text}`)
      styles.push(arg.style)
    } else {
      results.push(`%c${arg}`)
      styles.push('')
    }
  })
  console.log(results.join(''), ...styles)
}

const proto = Object.create(null)

// Add common colors
const colors = ['red', 'blue', 'green']
const properties = colors.reduce((props, color) => {
  props[color] = {
    get() {
      cholk._style.color = color
      return cholk
    },
  }
  return props
}, {})

// Custom style
proto.style = styleString => {
  cholk._style = styleString
  return cholk
}

Object.defineProperties(proto, properties)

cholk.__proto__ = proto

export default cholk

@@ -205,16 +205,94 @@
 ';')%0A%7D%0A%0A
+function capitalize(word) %7B%0A  return word%5B0%5D.toUpperCase() + word.slice(1)%0A%7D%0A%0A
 function
@@ -754,117 +754,345 @@
 ll)%0A
-%0A// Add common colors%0Aconst colors = %5B'red', 'blue', 'green'%5D%0Aconst properties = colors.reduce((props, 
+const properties = %7B%7D%0A%0A// Add common colors%0A// For font color and background color%0Aconst colors = %5B%0A  'black',%0A  'red',%0A  'green',%0A  'yellow',%0A  'blue',%0A  'magenta',%0A  'cyan',%0A  'white',%0A  'gray',%0A  'redBright',%0A  'greenBright',%0A  'yellowBright',%0A  'blueBright',%0A  'magentaBright',%0A  'cyanBright',%0A  'whiteBright',%0A%5D%0Acolors.forEach(
 color
-)
  =%3E 
@@ -1099,16 +1099,21 @@
 %7B%0A  prop
+ertie
 s%5Bcolor%5D
@@ -1198,25 +1198,138 @@
 %7D%0A  
-return props%0A%7D, %7B
+properties%5B%60bg$%7Bcapitalize(color)%7D%60%5D = %7B%0A    get() %7B%0A      cholk._style%5B'background-color'%5D = color%0A      return cholk%0A    %7D,%0A  %7D%0A
 %7D)%0A%0A

Add more common colors and background color support