daisyui 2.46.0 → 2.47.0
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/themes.css +568 -568
- package/package.json +1 -1
- package/src/colors/functions.js +20 -20
package/package.json
CHANGED
package/src/colors/functions.js
CHANGED
|
@@ -5,11 +5,11 @@ module.exports = {
|
|
|
5
5
|
|
|
6
6
|
generateForegroundColorFrom: function (input, percentage = 0.8) {
|
|
7
7
|
if (Color(input).isDark()) {
|
|
8
|
-
let arr = Color(input).mix(Color("white"), percentage).saturate(10).hsl().
|
|
9
|
-
return arr[0] + " " + arr[1] + "%" + " " + arr[2] + "%";
|
|
8
|
+
let arr = Color(input).mix(Color("white"), percentage).saturate(10).hsl().array()
|
|
9
|
+
return arr[0].toPrecision(5).replace(/\.?0+$/,"") + " " + arr[1].toPrecision(5).replace(/\.?0+$/,"") + "%" + " " + arr[2].toPrecision(5).replace(/\.?0+$/,"") + "%";
|
|
10
10
|
} else {
|
|
11
|
-
let arr = Color(input).mix(Color("black"), percentage).saturate(10).hsl().
|
|
12
|
-
return arr[0] + " " + arr[1] + "%" + " " + arr[2] + "%";
|
|
11
|
+
let arr = Color(input).mix(Color("black"), percentage).saturate(10).hsl().array()
|
|
12
|
+
return arr[0].toPrecision(5).replace(/\.?0+$/,"") + " " + arr[1].toPrecision(5).replace(/\.?0+$/,"") + "%" + " " + arr[2].toPrecision(5).replace(/\.?0+$/,"") + "%";
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
|
|
@@ -18,31 +18,31 @@ module.exports = {
|
|
|
18
18
|
if (typeof input === "object" && input !== null) {
|
|
19
19
|
Object.entries(input).forEach(([rule, value]) => {
|
|
20
20
|
if (colorNames.hasOwnProperty(rule)) {
|
|
21
|
-
const hslArray = Color(value).hsl().
|
|
22
|
-
resultObj[colorNames[rule]] = hslArray[0] + " " + hslArray[1] + "%" + " " + hslArray[2] + "%";
|
|
21
|
+
const hslArray = Color(value).hsl().array();
|
|
22
|
+
resultObj[colorNames[rule]] = hslArray[0].toPrecision(5).replace(/\.?0+$/,"") + " " + hslArray[1].toPrecision(5).replace(/\.?0+$/,"") + "%" + " " + hslArray[2].toPrecision(5).replace(/\.?0+$/,"") + "%";
|
|
23
23
|
} else {
|
|
24
24
|
resultObj[rule] = value;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// auto generate focus colors
|
|
28
28
|
if (!input.hasOwnProperty("primary-focus")) {
|
|
29
|
-
const darkerHslArray = Color(input["primary"]).darken(0.2).hsl().
|
|
30
|
-
resultObj["--pf"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
29
|
+
const darkerHslArray = Color(input["primary"]).darken(0.2).hsl().array();
|
|
30
|
+
resultObj["--pf"] = darkerHslArray[0].toPrecision(5).replace(/\.?0+$/,"") + " " + darkerHslArray[1].toPrecision(5).replace(/\.?0+$/,"") + "%" + " " + darkerHslArray[2].toPrecision(5).replace(/\.?0+$/,"") + "%";
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
if (!input.hasOwnProperty("secondary-focus")) {
|
|
34
|
-
const darkerHslArray = Color(input["secondary"]).darken(0.2).hsl().
|
|
35
|
-
resultObj["--sf"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
34
|
+
const darkerHslArray = Color(input["secondary"]).darken(0.2).hsl().array();
|
|
35
|
+
resultObj["--sf"] = darkerHslArray[0].toPrecision(5).replace(/\.?0+$/,"") + " " + darkerHslArray[1].toPrecision(5).replace(/\.?0+$/,"") + "%" + " " + darkerHslArray[2].toPrecision(5).replace(/\.?0+$/,"") + "%";
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
if (!input.hasOwnProperty("accent-focus")) {
|
|
39
|
-
const darkerHslArray = Color(input["accent"]).darken(0.2).hsl().
|
|
40
|
-
resultObj["--af"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
39
|
+
const darkerHslArray = Color(input["accent"]).darken(0.2).hsl().array();
|
|
40
|
+
resultObj["--af"] = darkerHslArray[0].toPrecision(5).replace(/\.?0+$/,"") + " " + darkerHslArray[1].toPrecision(5).replace(/\.?0+$/,"") + "%" + " " + darkerHslArray[2].toPrecision(5).replace(/\.?0+$/,"") + "%";
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
if (!input.hasOwnProperty("neutral-focus")) {
|
|
44
|
-
const darkerHslArray = Color(input["neutral"]).darken(0.2).hsl().
|
|
45
|
-
resultObj["--nf"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
44
|
+
const darkerHslArray = Color(input["neutral"]).darken(0.2).hsl().array();
|
|
45
|
+
resultObj["--nf"] = darkerHslArray[0].toPrecision(5).replace(/\.?0+$/,"") + " " + darkerHslArray[1].toPrecision(5).replace(/\.?0+$/,"") + "%" + " " + darkerHslArray[2].toPrecision(5).replace(/\.?0+$/,"") + "%";
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// auto generate base colors
|
|
@@ -51,17 +51,17 @@ module.exports = {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
if (!input.hasOwnProperty("base-200")) {
|
|
54
|
-
const darkerHslArray = Color(input["base-100"]).darken(0.1).hsl().
|
|
55
|
-
resultObj["--b2"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
54
|
+
const darkerHslArray = Color(input["base-100"]).darken(0.1).hsl().array();
|
|
55
|
+
resultObj["--b2"] = darkerHslArray[0].toPrecision(5).replace(/\.?0+$/,"") + " " + darkerHslArray[1].toPrecision(5).replace(/\.?0+$/,"") + "%" + " " + darkerHslArray[2].toPrecision(5).replace(/\.?0+$/,"") + "%";
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
if (!input.hasOwnProperty("base-300")) {
|
|
59
59
|
if (input.hasOwnProperty("base-200")) {
|
|
60
|
-
const darkerHslArray = Color(input["base-200"]).darken(0.1).hsl().
|
|
61
|
-
resultObj["--b3"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
60
|
+
const darkerHslArray = Color(input["base-200"]).darken(0.1).hsl().array();
|
|
61
|
+
resultObj["--b3"] = darkerHslArray[0].toPrecision(5).replace(/\.?0+$/,"") + " " + darkerHslArray[1].toPrecision(5).replace(/\.?0+$/,"") + "%" + " " + darkerHslArray[2].toPrecision(5).replace(/\.?0+$/,"") + "%";
|
|
62
62
|
} else {
|
|
63
|
-
const darkerHslArray = Color(input["base-100"]).darken(0.1).darken(0.1).hsl().
|
|
64
|
-
resultObj["--b3"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
63
|
+
const darkerHslArray = Color(input["base-100"]).darken(0.1).darken(0.1).hsl().array();
|
|
64
|
+
resultObj["--b3"] = darkerHslArray[0].toPrecision(5).replace(/\.?0+$/,"") + " " + darkerHslArray[1].toPrecision(5).replace(/\.?0+$/,"") + "%" + " " + darkerHslArray[2].toPrecision(5).replace(/\.?0+$/,"") + "%";
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|