browser-supports-log-styles

returns true if browser supports console log styling

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
browser-supports-log-styles
901.1.76 years ago8 years agoMinified + gzip package size for browser-supports-log-styles in KB

Readme

browser-supports-log-styles
returns true if browser supports console log styling

NPM version Build Status Coverage Status Dependency Status
Modern browsers support CSS-based styling of console log outputs. See Documentation on Mozilla Developer Network

Usage

Download latest version here: https://wzrd.in/standalone/browser-supports-log-styles
Or install via npm: npm install -S browser-supports-log-styles
if (browserSupportsLogStyles()) {
  console.log('%cLOG%c styling supported', 'color: white; padding: .2em .5em; border-radius: 1em; background-color: blue', 'color: inherit')
} else {
  console.log('styling not supported')
}

Current Browser Support

  • Chrome
  • Safari
  • Firefox >= v31

Credit

Takend from TJ Holowaychuk @visionmedia's fantastic debug npm package Original code: https://github.com/visionmedia/debug/blob/165e937e6dd529588fc3d9761d3f745969d3d054/browser.js#L28-L44

License

MIT