UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

56 lines (55 loc) 1.69 kB
import "./kendo.core-B45DfgdW.js"; import { Color, namedColors, parseColor, resolveElementColor } from "@progress/kendo-drawing"; //#region ../src/kendo.color.js const __meta__ = { id: "color", name: "Color utils", category: "framework", advanced: true, description: "Color utilities used across components", depends: ["core"] }; window.kendo = window.kendo || {}; let colorProbe; function getColorProbe() { if (typeof document === "undefined") return null; if (!colorProbe) { colorProbe = document.createElement("span"); colorProbe.setAttribute("aria-hidden", "true"); colorProbe.style.cssText = "position:absolute;left:-10000px;top:-10000px;visibility:hidden;pointer-events:none;"; (document.body || document.documentElement).appendChild(colorProbe); } return colorProbe; } function resolveCssColor(value) { if (typeof value !== "string") return null; const probe = getColorProbe(); if (!probe) return null; const previousColor = probe.style.color; probe.style.color = ""; probe.style.color = value; if (!probe.style.color) { probe.style.color = previousColor; return null; } const color = parseColor(resolveElementColor(probe, "color"), true); probe.style.color = previousColor; return color; } function parseColor$1(value, safe) { const color = parseColor(value, true); if (color || !value || value === "none" || value instanceof Color) { if (color || safe) return color; return parseColor(value, safe); } const resolvedColor = resolveCssColor(value); if (resolvedColor || safe) return resolvedColor; return parseColor(value, safe); } kendo.deepExtend(kendo, { parseColor: parseColor$1, namedColors, Color }); //#endregion export { __meta__ };