Improve browser detection

Synchronise with https://github.com/chalk/supports-color/pull/134

Signed-off-by: Richie Bendall <richiebendall@gmail.com>
This commit is contained in:
Richie Bendall 2022-03-28 23:01:11 +13:00
parent d28690e66b
commit 64e21c84e3
No known key found for this signature in database
GPG key ID: 94AE1ACB662A2A6D

View file

@ -1,6 +1,8 @@
/* eslint-env browser */
const isBlinkBasedBrowser = /\b(Chrome|Chromium)\//.test(navigator.userAgent);
const isBlinkBasedBrowser = navigator.userAgentData
? navigator.userAgentData.brands.some(({brand}) => brand === 'Chromium')
: /\b(Chrome|Chromium)\//.test(navigator.userAgent);
const colorSupport = isBlinkBasedBrowser ? {
level: 1,