@trackunit/ui-design-tokens 1.14.4 → 1.14.5
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/index.cjs.js +3 -5
- package/index.esm.js +3 -5
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -745,13 +745,13 @@ function componentToHex(c) {
|
|
|
745
745
|
return "00";
|
|
746
746
|
}
|
|
747
747
|
const hex = c.toString(16);
|
|
748
|
-
return hex.length === 1 ?
|
|
748
|
+
return hex.length === 1 ? `0${hex}` : hex;
|
|
749
749
|
}
|
|
750
750
|
function rgbToHex(r, g, b) {
|
|
751
751
|
if (isNaN(r) || isNaN(g) || isNaN(b)) {
|
|
752
752
|
return "#000000";
|
|
753
753
|
}
|
|
754
|
-
return
|
|
754
|
+
return `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;
|
|
755
755
|
}
|
|
756
756
|
/**
|
|
757
757
|
* Convert a string to a HEX color.
|
|
@@ -794,9 +794,7 @@ const getHEX = (variable) => {
|
|
|
794
794
|
if (onlyRgb.indexOf(")") !== -1) {
|
|
795
795
|
onlyRgb = onlyRgb.substring(0, onlyRgb.indexOf(")")).trim();
|
|
796
796
|
}
|
|
797
|
-
const RGB = onlyRgb
|
|
798
|
-
.split(" ")
|
|
799
|
-
.map(channel => Number(channel));
|
|
797
|
+
const RGB = onlyRgb.split(" ").map(channel => Number(channel));
|
|
800
798
|
return rgbToHex(RGB[0] ?? NaN, RGB[1] ?? NaN, RGB[2] ?? NaN);
|
|
801
799
|
};
|
|
802
800
|
|
package/index.esm.js
CHANGED
|
@@ -743,13 +743,13 @@ function componentToHex(c) {
|
|
|
743
743
|
return "00";
|
|
744
744
|
}
|
|
745
745
|
const hex = c.toString(16);
|
|
746
|
-
return hex.length === 1 ?
|
|
746
|
+
return hex.length === 1 ? `0${hex}` : hex;
|
|
747
747
|
}
|
|
748
748
|
function rgbToHex(r, g, b) {
|
|
749
749
|
if (isNaN(r) || isNaN(g) || isNaN(b)) {
|
|
750
750
|
return "#000000";
|
|
751
751
|
}
|
|
752
|
-
return
|
|
752
|
+
return `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;
|
|
753
753
|
}
|
|
754
754
|
/**
|
|
755
755
|
* Convert a string to a HEX color.
|
|
@@ -792,9 +792,7 @@ const getHEX = (variable) => {
|
|
|
792
792
|
if (onlyRgb.indexOf(")") !== -1) {
|
|
793
793
|
onlyRgb = onlyRgb.substring(0, onlyRgb.indexOf(")")).trim();
|
|
794
794
|
}
|
|
795
|
-
const RGB = onlyRgb
|
|
796
|
-
.split(" ")
|
|
797
|
-
.map(channel => Number(channel));
|
|
795
|
+
const RGB = onlyRgb.split(" ").map(channel => Number(channel));
|
|
798
796
|
return rgbToHex(RGB[0] ?? NaN, RGB[1] ?? NaN, RGB[2] ?? NaN);
|
|
799
797
|
};
|
|
800
798
|
|