daisyui 2.12.0 → 2.13.2
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/README.md +1 -1
- package/dist/full.css +1 -1
- package/dist/styled.css +1 -2
- package/dist/styled.js +1 -1
- package/dist/styled.rtl.js +1 -1
- package/dist/themes.css +4 -4
- package/dist/unstyled.css +0 -1
- package/dist/unstyled.js +1 -1
- package/dist/unstyled.rtl.js +1 -1
- package/package.json +11 -3
- package/src/colors/functions.js +147 -147
- package/src/colors/themes.js +3 -2
package/src/colors/functions.js
CHANGED
|
@@ -1,173 +1,173 @@
|
|
|
1
|
-
const colorNames = require("./colorNames");
|
|
2
1
|
const Color = require("color");
|
|
2
|
+
const colorNames = require("./colorNames");
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
if (Color(input).isDark()) {
|
|
6
|
-
let arr = Color(input).mix(Color("white"), percentage).saturate(10).hsl().round().array()
|
|
7
|
-
return arr[0] + " " + arr[1] + "%" + " " + arr[2] + "%";
|
|
8
|
-
} else {
|
|
9
|
-
let arr = Color(input).mix(Color("black"), percentage).saturate(10).hsl().round().array()
|
|
10
|
-
return arr[0] + " " + arr[1] + "%" + " " + arr[2] + "%";
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const convertToHsl = function (input) {
|
|
15
|
-
let resultObj = {};
|
|
16
|
-
if (typeof input === "object" && input !== null) {
|
|
17
|
-
Object.entries(input).forEach(([rule, value]) => {
|
|
18
|
-
if (colorNames.hasOwnProperty(rule)) {
|
|
19
|
-
const hslArray = Color(value).hsl().round().array();
|
|
20
|
-
resultObj[colorNames[rule]] = hslArray[0] + " " + hslArray[1] + "%" + " " + hslArray[2] + "%";
|
|
21
|
-
} else {
|
|
22
|
-
resultObj[rule] = value;
|
|
23
|
-
}
|
|
4
|
+
module.exports = {
|
|
24
5
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
6
|
+
generateForegorundColorFrom: function (input, percentage = 0.8) {
|
|
7
|
+
if (Color(input).isDark()) {
|
|
8
|
+
let arr = Color(input).mix(Color("white"), percentage).saturate(10).hsl().round().array()
|
|
9
|
+
return arr[0] + " " + arr[1] + "%" + " " + arr[2] + "%";
|
|
10
|
+
} else {
|
|
11
|
+
let arr = Color(input).mix(Color("black"), percentage).saturate(10).hsl().round().array()
|
|
12
|
+
return arr[0] + " " + arr[1] + "%" + " " + arr[2] + "%";
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
convertToHsl: function (input) {
|
|
17
|
+
let resultObj = {};
|
|
18
|
+
if (typeof input === "object" && input !== null) {
|
|
19
|
+
Object.entries(input).forEach(([rule, value]) => {
|
|
20
|
+
if (colorNames.hasOwnProperty(rule)) {
|
|
21
|
+
const hslArray = Color(value).hsl().round().array();
|
|
22
|
+
resultObj[colorNames[rule]] = hslArray[0] + " " + hslArray[1] + "%" + " " + hslArray[2] + "%";
|
|
23
|
+
} else {
|
|
24
|
+
resultObj[rule] = value;
|
|
25
|
+
}
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
// auto generate focus colors
|
|
28
|
+
if (!input.hasOwnProperty("primary-focus")) {
|
|
29
|
+
const darkerHslArray = Color(input["primary"]).darken(0.2).hsl().round().array();
|
|
30
|
+
resultObj["--pf"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
31
|
+
}
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
if (!input.hasOwnProperty("secondary-focus")) {
|
|
34
|
+
const darkerHslArray = Color(input["secondary"]).darken(0.2).hsl().round().array();
|
|
35
|
+
resultObj["--sf"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
36
|
+
}
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
if (!input.hasOwnProperty("accent-focus")) {
|
|
39
|
+
const darkerHslArray = Color(input["accent"]).darken(0.2).hsl().round().array();
|
|
40
|
+
resultObj["--af"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
41
|
+
}
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
if (!input.hasOwnProperty("neutral-focus")) {
|
|
44
|
+
const darkerHslArray = Color(input["neutral"]).darken(0.2).hsl().round().array();
|
|
45
|
+
resultObj["--nf"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
46
|
+
}
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
// auto generate base colors
|
|
49
|
+
if (!input.hasOwnProperty("base-100")) {
|
|
50
|
+
resultObj["--b1"] = 0 + " " + 0 + "%" + " " + 100 + "%";
|
|
51
|
+
}
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
resultObj["--b3"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
60
|
-
} else {
|
|
61
|
-
const darkerHslArray = Color(input["base-100"]).darken(0.1).darken(0.1).hsl().round().array();
|
|
62
|
-
resultObj["--b3"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
53
|
+
if (!input.hasOwnProperty("base-200")) {
|
|
54
|
+
const darkerHslArray = Color(input["base-100"]).darken(0.1).hsl().round().array();
|
|
55
|
+
resultObj["--b2"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
63
56
|
}
|
|
64
|
-
}
|
|
65
57
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
if (!input.hasOwnProperty("error")) {
|
|
77
|
-
resultObj["--er"] = 0 + " " + 91 + "%" + " " + 71 + "%";
|
|
78
|
-
}
|
|
58
|
+
if (!input.hasOwnProperty("base-300")) {
|
|
59
|
+
if (input.hasOwnProperty("base-200")) {
|
|
60
|
+
const darkerHslArray = Color(input["base-200"]).darken(0.1).hsl().round().array();
|
|
61
|
+
resultObj["--b3"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
62
|
+
} else {
|
|
63
|
+
const darkerHslArray = Color(input["base-100"]).darken(0.1).darken(0.1).hsl().round().array();
|
|
64
|
+
resultObj["--b3"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
79
67
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
68
|
+
// auto generate state colors
|
|
69
|
+
if (!input.hasOwnProperty("info")) {
|
|
70
|
+
resultObj["--in"] = 198 + " " + 93 + "%" + " " + 60 + "%";
|
|
71
|
+
}
|
|
72
|
+
if (!input.hasOwnProperty("success")) {
|
|
73
|
+
resultObj["--su"] = 158 + " " + 64 + "%" + " " + 52 + "%";
|
|
74
|
+
}
|
|
75
|
+
if (!input.hasOwnProperty("warning")) {
|
|
76
|
+
resultObj["--wa"] = 43 + " " + 96 + "%" + " " + 56 + "%";
|
|
77
|
+
}
|
|
78
|
+
if (!input.hasOwnProperty("error")) {
|
|
79
|
+
resultObj["--er"] = 0 + " " + 91 + "%" + " " + 71 + "%";
|
|
80
|
+
}
|
|
87
81
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
82
|
+
// auto generate content colors
|
|
83
|
+
if (!input.hasOwnProperty("base-content")) {
|
|
84
|
+
resultObj["--bc"] = this.generateForegorundColorFrom(input["base-100"])
|
|
85
|
+
}
|
|
86
|
+
if (!input.hasOwnProperty("primary-content")) {
|
|
87
|
+
resultObj["--pc"] = this.generateForegorundColorFrom(input["primary"])
|
|
88
|
+
}
|
|
91
89
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
if (!input.hasOwnProperty("secondary-content")) {
|
|
91
|
+
resultObj["--sc"] = this.generateForegorundColorFrom(input["secondary"])
|
|
92
|
+
}
|
|
95
93
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
if (!input.hasOwnProperty("accent-content")) {
|
|
95
|
+
resultObj["--ac"] = this.generateForegorundColorFrom(input["accent"])
|
|
96
|
+
}
|
|
99
97
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
resultObj["--inc"] = generateForegorundColorFrom(input["info"])
|
|
103
|
-
} else {
|
|
104
|
-
resultObj["--inc"] = 198 + " " + 100 + "%" + " " + 12 + "%";
|
|
98
|
+
if (!input.hasOwnProperty("neutral-content")) {
|
|
99
|
+
resultObj["--nc"] = this.generateForegorundColorFrom(input["neutral"])
|
|
105
100
|
}
|
|
106
|
-
}
|
|
107
101
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
102
|
+
if (!input.hasOwnProperty("info-content")) {
|
|
103
|
+
if (input.hasOwnProperty("info")) {
|
|
104
|
+
resultObj["--inc"] = this.generateForegorundColorFrom(input["info"])
|
|
105
|
+
} else {
|
|
106
|
+
resultObj["--inc"] = 198 + " " + 100 + "%" + " " + 12 + "%";
|
|
107
|
+
}
|
|
113
108
|
}
|
|
114
|
-
}
|
|
115
109
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
110
|
+
if (!input.hasOwnProperty("success-content")) {
|
|
111
|
+
if (input.hasOwnProperty("success")) {
|
|
112
|
+
resultObj["--suc"] = this.generateForegorundColorFrom(input["success"])
|
|
113
|
+
} else {
|
|
114
|
+
resultObj["--suc"] = 158 + " " + 100 + "%" + " " + 10 + "%";
|
|
115
|
+
}
|
|
121
116
|
}
|
|
122
|
-
}
|
|
123
117
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
118
|
+
if (!input.hasOwnProperty("warning-content")) {
|
|
119
|
+
if (input.hasOwnProperty("warning")) {
|
|
120
|
+
resultObj["--wac"] = this.generateForegorundColorFrom(input["warning"])
|
|
121
|
+
} else {
|
|
122
|
+
resultObj["--wac"] = 43 + " " + 100 + "%" + " " + 11 + "%";
|
|
123
|
+
}
|
|
129
124
|
}
|
|
130
|
-
}
|
|
131
125
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (!input.hasOwnProperty("--rounded-badge")) {
|
|
140
|
-
resultObj["--rounded-badge"] = "1.9rem";
|
|
141
|
-
}
|
|
142
|
-
if (!input.hasOwnProperty("--animation-btn")) {
|
|
143
|
-
resultObj["--animation-btn"] = "0.25s";
|
|
144
|
-
}
|
|
145
|
-
if (!input.hasOwnProperty("--animation-input")) {
|
|
146
|
-
resultObj["--animation-input"] = ".2s";
|
|
147
|
-
}
|
|
148
|
-
if (!input.hasOwnProperty("--btn-text-case")) {
|
|
149
|
-
resultObj["--btn-text-case"] = "uppercase";
|
|
150
|
-
}
|
|
151
|
-
if (!input.hasOwnProperty("--btn-focus-scale")) {
|
|
152
|
-
resultObj["--btn-focus-scale"] = "0.95";
|
|
153
|
-
}
|
|
154
|
-
if (!input.hasOwnProperty("--border-btn")) {
|
|
155
|
-
resultObj["--border-btn"] = "1px";
|
|
156
|
-
}
|
|
157
|
-
if (!input.hasOwnProperty("--tab-border")) {
|
|
158
|
-
resultObj["--tab-border"] = "1px";
|
|
159
|
-
}
|
|
160
|
-
if (!input.hasOwnProperty("--tab-radius")) {
|
|
161
|
-
resultObj["--tab-radius"] = "0.5rem";
|
|
162
|
-
}
|
|
126
|
+
if (!input.hasOwnProperty("error-content")) {
|
|
127
|
+
if (input.hasOwnProperty("error")) {
|
|
128
|
+
resultObj["--erc"] = this.generateForegorundColorFrom(input["error"])
|
|
129
|
+
} else {
|
|
130
|
+
resultObj["--erc"] = 0 + " " + 100 + "%" + " " + 14 + "%";
|
|
131
|
+
}
|
|
132
|
+
}
|
|
163
133
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
134
|
+
// auto generate css variables
|
|
135
|
+
if (!input.hasOwnProperty("--rounded-box")) {
|
|
136
|
+
resultObj["--rounded-box"] = "1rem";
|
|
137
|
+
}
|
|
138
|
+
if (!input.hasOwnProperty("--rounded-btn")) {
|
|
139
|
+
resultObj["--rounded-btn"] = "0.5rem";
|
|
140
|
+
}
|
|
141
|
+
if (!input.hasOwnProperty("--rounded-badge")) {
|
|
142
|
+
resultObj["--rounded-badge"] = "1.9rem";
|
|
143
|
+
}
|
|
144
|
+
if (!input.hasOwnProperty("--animation-btn")) {
|
|
145
|
+
resultObj["--animation-btn"] = "0.25s";
|
|
146
|
+
}
|
|
147
|
+
if (!input.hasOwnProperty("--animation-input")) {
|
|
148
|
+
resultObj["--animation-input"] = ".2s";
|
|
149
|
+
}
|
|
150
|
+
if (!input.hasOwnProperty("--btn-text-case")) {
|
|
151
|
+
resultObj["--btn-text-case"] = "uppercase";
|
|
152
|
+
}
|
|
153
|
+
if (!input.hasOwnProperty("--btn-focus-scale")) {
|
|
154
|
+
resultObj["--btn-focus-scale"] = "0.95";
|
|
155
|
+
}
|
|
156
|
+
if (!input.hasOwnProperty("--border-btn")) {
|
|
157
|
+
resultObj["--border-btn"] = "1px";
|
|
158
|
+
}
|
|
159
|
+
if (!input.hasOwnProperty("--tab-border")) {
|
|
160
|
+
resultObj["--tab-border"] = "1px";
|
|
161
|
+
}
|
|
162
|
+
if (!input.hasOwnProperty("--tab-radius")) {
|
|
163
|
+
resultObj["--tab-radius"] = "0.5rem";
|
|
164
|
+
}
|
|
169
165
|
|
|
170
|
-
|
|
166
|
+
});
|
|
167
|
+
return resultObj;
|
|
168
|
+
}
|
|
169
|
+
return input;
|
|
170
|
+
},
|
|
171
171
|
|
|
172
172
|
injectThemes: function (addBase, config, themes) {
|
|
173
173
|
let includedThemesObj = new Object();
|
|
@@ -175,14 +175,14 @@ module.exports = {
|
|
|
175
175
|
// add light themes
|
|
176
176
|
if (config("daisyui.themes") == false) {
|
|
177
177
|
Object.entries(themes).forEach(([theme, index]) => {
|
|
178
|
-
includedThemesObj[theme] = convertToHsl(themes[theme]);
|
|
178
|
+
includedThemesObj[theme] = this.convertToHsl(themes[theme]);
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
// add default themes
|
|
183
183
|
if (config("daisyui.themes") != false) {
|
|
184
184
|
Object.entries(themes).forEach(([theme, index]) => {
|
|
185
|
-
includedThemesObj[theme] = convertToHsl(themes[theme]);
|
|
185
|
+
includedThemesObj[theme] = this.convertToHsl(themes[theme]);
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
|
|
@@ -192,7 +192,7 @@ module.exports = {
|
|
|
192
192
|
if (typeof item === "object" && item !== null) {
|
|
193
193
|
Object.entries(item).forEach(([customThemeName, customThemevalue]) => {
|
|
194
194
|
includedThemesObj["[data-theme=" + customThemeName + "]"] =
|
|
195
|
-
convertToHsl(customThemevalue);
|
|
195
|
+
this.convertToHsl(customThemevalue);
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
});
|
package/src/colors/themes.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"[data-theme=aqua]": {
|
|
3
3
|
primary: "#09ecf3",
|
|
4
|
+
"primary-content": "#005355",
|
|
4
5
|
secondary: "#966fb3",
|
|
5
6
|
accent: "#ffe999",
|
|
6
7
|
neutral: "#3b8ac4",
|
|
@@ -122,7 +123,7 @@ module.exports = {
|
|
|
122
123
|
},
|
|
123
124
|
"[data-theme=emerald]": {
|
|
124
125
|
primary: "#66cc8a",
|
|
125
|
-
"primary-content": "#
|
|
126
|
+
"primary-content": "#223D30",
|
|
126
127
|
secondary: "#377cfb",
|
|
127
128
|
"secondary-content": "#f9fafb",
|
|
128
129
|
accent: "#ea5234",
|
|
@@ -180,7 +181,7 @@ module.exports = {
|
|
|
180
181
|
secondary: "#f000b8",
|
|
181
182
|
"secondary-content": "#ffffff",
|
|
182
183
|
accent: "#37cdbe",
|
|
183
|
-
"accent-content": "#
|
|
184
|
+
"accent-content": "#163835",
|
|
184
185
|
neutral: "#3d4451",
|
|
185
186
|
"neutral-content": "#ffffff",
|
|
186
187
|
"base-100": "#ffffff",
|