Skip to content

Commit

Permalink
fix: add default/undefined color for browser
Browse files Browse the repository at this point in the history
  • Loading branch information
pimlie committed Oct 11, 2018
1 parent d39684d commit 39584d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import BrowserReporter from './reporters/browser.js'
if (!window.consola) {
// Create new consola instance
window.consola = new Consola({
promisified: false,
reporters: [
new BrowserReporter()
]
Expand Down
16 changes: 6 additions & 10 deletions src/reporters/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@ export default class BrowserReporter {

log (logObj) {
const replaceColors = {
undefined: 'grey',
yellow: 'goldenrod',
white: 'grey'
}

let styleDefault = 'color: silver; background-color: inherit;'
let styleAdditional = 'color: ' + (logObj.additionalColor ? logObj.additionalColor : 'black') + '; background-color: inherit;'
let style
let badgeStyle

const color = replaceColors[logObj.color] ? replaceColors[logObj.color] : logObj.color
if (color) {
badgeStyle = 'color: white; background-color: ' + color + ';'
style = 'color: ' + color + '; background-color: inherit;'
}

const styleDefault = 'color: silver; background-color: inherit;'
const styleAdditional = 'color: ' + (logObj.additionalColor ? logObj.additionalColor : 'black') + '; background-color: inherit;'
const badgeStyle = 'color: white; background-color: ' + color + ';'
const style = 'color: ' + color + '; background-color: inherit;'

let type = logObj.type
if (!console[type]) { // eslint-disable-line no-console
Expand Down

0 comments on commit 39584d2

Please sign in to comment.