import { er as toValue } from "./vue.runtime.esm-bundler-BvoXUmaf.js";
import { x as destructComputed } from "./defineComponent-DB6xIcDy.js";
import { a as isCssColor, c as parseColor, i as hasLightForeground, o as isParsableColor } from "./colorUtils-BE28T62U.js";
//#region node_modules/vuetify/lib/composables/color.js
function useColor(colors) {
	return destructComputed(() => {
		const { class: colorClasses, style: colorStyles } = computeColor(colors);
		return {
			colorClasses,
			colorStyles
		};
	});
}
function useTextColor(color) {
	const { colorClasses: textColorClasses, colorStyles: textColorStyles } = useColor(() => ({ text: toValue(color) }));
	return {
		textColorClasses,
		textColorStyles
	};
}
function useBackgroundColor(color) {
	const { colorClasses: backgroundColorClasses, colorStyles: backgroundColorStyles } = useColor(() => ({ background: toValue(color) }));
	return {
		backgroundColorClasses,
		backgroundColorStyles
	};
}
function normalizeColors(colors) {
	return {
		text: typeof colors.text === "string" ? colors.text.replace(/^text-/, "") : colors.text,
		background: typeof colors.background === "string" ? colors.background.replace(/^bg-/, "") : colors.background
	};
}
function computeColor(colors) {
	const _colors = normalizeColors(toValue(colors));
	const classes = [];
	const styles = {};
	if (_colors.background) if (isCssColor(_colors.background)) {
		styles.backgroundColor = _colors.background;
		if (!_colors.text && isParsableColor(_colors.background)) {
			const backgroundColor = parseColor(_colors.background);
			if (backgroundColor.a == null || backgroundColor.a === 1) classes.push(hasLightForeground(backgroundColor) ? "v-theme-on-dark" : "v-theme-on-light");
		}
	} else classes.push(`bg-${_colors.background}`);
	if (_colors.text) if (isCssColor(_colors.text)) {
		styles.color = _colors.text;
		styles.caretColor = _colors.text;
	} else classes.push(`text-${_colors.text}`);
	return {
		class: classes,
		style: styles
	};
}
//#endregion
export { useColor as n, useTextColor as r, useBackgroundColor as t };

//# sourceMappingURL=color-B6vuQruj.js.map