@front10/helpers 2.0.23 → 2.0.24
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.
|
@@ -41,6 +41,17 @@ var generateTypographyStyles = function generateTypographyStyles(typography) {
|
|
|
41
41
|
return style;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
var generateColorsVariable = function generateColorsVariable(colors) {
|
|
45
|
+
var style = ":root {";
|
|
46
|
+
Object.keys(colors).forEach(function (color) {
|
|
47
|
+
var rgbColor = (0, _Color.hex2RGB)(colors[color]);
|
|
48
|
+
style += "--".concat(color, ": ").concat(colors[color], ";");
|
|
49
|
+
style += "--".concat(color, "-rgb: ").concat(rgbColor.r, ", ").concat(rgbColor.g, ", ").concat(rgbColor.b, ";");
|
|
50
|
+
});
|
|
51
|
+
style += "}";
|
|
52
|
+
return style;
|
|
53
|
+
};
|
|
54
|
+
|
|
44
55
|
var generateStylesPalette = function generateStylesPalette(palette, item, i) {
|
|
45
56
|
var hoverBgColor = item.color;
|
|
46
57
|
var gradientTo = item.color;
|
|
@@ -76,7 +87,10 @@ var initTheme = function initTheme(theme) {
|
|
|
76
87
|
outputFields = theme.config.outputFields;
|
|
77
88
|
}
|
|
78
89
|
|
|
79
|
-
if (outputFields.includes("colors"))
|
|
90
|
+
if (outputFields.includes("colors")) {
|
|
91
|
+
themeToken.colors = theme.colors;
|
|
92
|
+
}
|
|
93
|
+
|
|
80
94
|
if (outputFields.includes("typography")) themeToken.typography = theme.typography;
|
|
81
95
|
|
|
82
96
|
if (theme) {
|
|
@@ -86,6 +100,7 @@ var initTheme = function initTheme(theme) {
|
|
|
86
100
|
|
|
87
101
|
if (theme.colors || theme.designTokens.colors) {
|
|
88
102
|
var colors = Boolean(theme.colors) ? theme.colors : theme.designTokens.colors;
|
|
103
|
+
generatedStyles.push(generateColorsVariable(colors));
|
|
89
104
|
var themeColorsKeys = Object.keys(colors);
|
|
90
105
|
|
|
91
106
|
for (var index = 0; index < themeColorsKeys.length; index += 1) {
|