Skip to content

Instantly share code, notes, and snippets.

@vinicius73
Created June 15, 2018 14:48
Show Gist options
  • Save vinicius73/d79b7dbf62765de762f0f460c8e97d05 to your computer and use it in GitHub Desktop.
Save vinicius73/d79b7dbf62765de762f0f460c8e97d05 to your computer and use it in GitHub Desktop.
const appName = 'App Web'
const companyName = 'D6'
const version = '1.0.0'
const hasSw = (navigator.serviceWorker && navigator.serviceWorker.controller)
const mode = (window.matchMedia('(display-mode: standalone)').matches)
? 'standalone'
: 'web'
const sw = hasSw
? 'sw-on'
: 'sw-off'
console.log(
`%c ${companyName} ${appName} %c v${version} %c ${mode}/${sw} %c`,
'background:#000 ; padding: 3px; border-radius: 3px 0 0 3px; color: #fff',
'background:#0a88c2 ; padding: 3px; border-radius: 0 0 0 0; color: #fff',
`background:#${hasSw ? '21ba45' : 'db2828'} ; padding: 3px; border-radius: 0 3px 3px 0; color: #fff`,
'background:transparent'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment