kaleido-ui 0.1.87 → 0.1.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/index.cjs +11 -1
- package/dist/web/index.js +11 -1
- package/package.json +1 -1
package/dist/web/index.cjs
CHANGED
|
@@ -3749,6 +3749,16 @@ var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
|
3749
3749
|
function NetworkMiniBadge({ iconUrl, label }) {
|
|
3750
3750
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: cn(iconBadgeOverlayClass, "overflow-hidden"), children: iconUrl ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("img", { src: iconUrl, alt: label ?? "", className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "flex h-full w-full items-center justify-center bg-muted text-xxs font-bold uppercase leading-none text-muted-foreground", children: label?.charAt(0) }) });
|
|
3751
3751
|
}
|
|
3752
|
+
function readableTagColor(color) {
|
|
3753
|
+
const raw = color.replace("#", "");
|
|
3754
|
+
const hex = raw.length === 3 ? raw.split("").map((char) => char + char).join("") : raw;
|
|
3755
|
+
if (!/^[0-9a-fA-F]{6}$/.test(hex)) return color;
|
|
3756
|
+
const r = parseInt(hex.slice(0, 2), 16);
|
|
3757
|
+
const g = parseInt(hex.slice(2, 4), 16);
|
|
3758
|
+
const b = parseInt(hex.slice(4, 6), 16);
|
|
3759
|
+
const luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;
|
|
3760
|
+
return luminance < 0.45 ? `color-mix(in srgb, ${color} 45%, white)` : color;
|
|
3761
|
+
}
|
|
3752
3762
|
function AssetSelector({
|
|
3753
3763
|
label,
|
|
3754
3764
|
selectedTicker,
|
|
@@ -3840,7 +3850,7 @@ function AssetSelector({
|
|
|
3840
3850
|
),
|
|
3841
3851
|
style: option.networkTag.color ? {
|
|
3842
3852
|
backgroundColor: `color-mix(in srgb, ${option.networkTag.color} 15%, transparent)`,
|
|
3843
|
-
color: option.networkTag.color
|
|
3853
|
+
color: readableTagColor(option.networkTag.color)
|
|
3844
3854
|
} : void 0,
|
|
3845
3855
|
children: option.networkTag.label
|
|
3846
3856
|
}
|
package/dist/web/index.js
CHANGED
|
@@ -3568,6 +3568,16 @@ import { Fragment as Fragment6, jsx as jsx38, jsxs as jsxs25 } from "react/jsx-r
|
|
|
3568
3568
|
function NetworkMiniBadge({ iconUrl, label }) {
|
|
3569
3569
|
return /* @__PURE__ */ jsx38("span", { className: cn(iconBadgeOverlayClass, "overflow-hidden"), children: iconUrl ? /* @__PURE__ */ jsx38("img", { src: iconUrl, alt: label ?? "", className: "h-full w-full object-cover" }) : /* @__PURE__ */ jsx38("span", { className: "flex h-full w-full items-center justify-center bg-muted text-xxs font-bold uppercase leading-none text-muted-foreground", children: label?.charAt(0) }) });
|
|
3570
3570
|
}
|
|
3571
|
+
function readableTagColor(color) {
|
|
3572
|
+
const raw = color.replace("#", "");
|
|
3573
|
+
const hex = raw.length === 3 ? raw.split("").map((char) => char + char).join("") : raw;
|
|
3574
|
+
if (!/^[0-9a-fA-F]{6}$/.test(hex)) return color;
|
|
3575
|
+
const r = parseInt(hex.slice(0, 2), 16);
|
|
3576
|
+
const g = parseInt(hex.slice(2, 4), 16);
|
|
3577
|
+
const b = parseInt(hex.slice(4, 6), 16);
|
|
3578
|
+
const luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;
|
|
3579
|
+
return luminance < 0.45 ? `color-mix(in srgb, ${color} 45%, white)` : color;
|
|
3580
|
+
}
|
|
3571
3581
|
function AssetSelector({
|
|
3572
3582
|
label,
|
|
3573
3583
|
selectedTicker,
|
|
@@ -3659,7 +3669,7 @@ function AssetSelector({
|
|
|
3659
3669
|
),
|
|
3660
3670
|
style: option.networkTag.color ? {
|
|
3661
3671
|
backgroundColor: `color-mix(in srgb, ${option.networkTag.color} 15%, transparent)`,
|
|
3662
|
-
color: option.networkTag.color
|
|
3672
|
+
color: readableTagColor(option.networkTag.color)
|
|
3663
3673
|
} : void 0,
|
|
3664
3674
|
children: option.networkTag.label
|
|
3665
3675
|
}
|
package/package.json
CHANGED