All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.browser.js Maven / Gradle / Ivy

The newest version!
/* eslint-env browser */
/* eslint-disable n/no-unsupported-features/node-builtins */

const level = (() => {
	if (!('navigator' in globalThis)) {
		return 0;
	}

	if (globalThis.navigator.userAgentData) {
		const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');
		if (brand?.version > 93) {
			return 3;
		}
	}

	if (/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)) {
		return 1;
	}

	return 0;
})();

const colorSupport = level !== 0 && {
	level,
	hasBasic: true,
	has256: level >= 2,
	has16m: level >= 3,
};

const supportsColor = {
	stdout: colorSupport,
	stderr: colorSupport,
};

export default supportsColor;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy