UNPKG

vuestic-ui

Version:
27 lines (26 loc) 912 B
import { getCurrentInstance, computed, unref } from "vue"; import { u as useColors } from "./useColors.js"; import { m as isColorTransparent } from "../services/color/utils.js"; const useTextColor = (componentColor, isTransparent = false) => { const { props } = getCurrentInstance(); const { getColor, getTextColor } = useColors(); const textColorComputed = computed(() => { if (props.textColor) { return getColor(props.textColor); } const bg = componentColor ? unref(componentColor) : props.color; if (!bg) { return "currentColor"; } const componentColorHex = getColor(bg); if (isColorTransparent(componentColorHex)) { return "currentColor"; } return unref(isTransparent) ? componentColorHex : getColor(getTextColor(componentColorHex)); }); return { textColorComputed }; }; export { useTextColor as u }; //# sourceMappingURL=useTextColor.js.map