Skip to content

Instantly share code, notes, and snippets.

@TiagoDanin
Forked from vinicius73/log-pretty-version.js
Created July 3, 2022 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TiagoDanin/15ccefcf352522b430fff86172a09f91 to your computer and use it in GitHub Desktop.
Save TiagoDanin/15ccefcf352522b430fff86172a09f91 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