chalk/supports-color

`navigator.userAgentData` #133

Richienb posted onGitHub

More reliable way of checking the browser:

const isBlinkBasedBrowser = Boolean(navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium'));

vs

https://github.com/chalk/supports-color/blob/4f459ee311817cfad1332731a2c1060e07b2015e/browser.js#L3


Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers. - https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgentData

So we still need to keep the old check as fallback.

posted by sindresorhus about 3 years ago

Fund this Issue

$0.00
Funded

Pull requests