daisyui 2.0.8 → 2.2.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 +4 -12
- package/dist/full.css +1 -1
- package/dist/styled.css +1 -1
- package/dist/styled.js +1 -1
- package/dist/styled.rtl.js +1 -1
- package/dist/themes.css +1 -1
- package/dist/unstyled.css +1 -1
- package/dist/unstyled.js +1 -1
- package/dist/unstyled.rtl.js +1 -1
- package/dist/utilities-unstyled.js +1 -1
- package/dist/utilities.js +1 -1
- package/package.json +1 -2
- package/src/colors/functions.js +307 -0
- package/src/colors/themes.js +89 -615
- package/src/index.js +4 -139
- package/src/colors/windi.js +0 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = {".artboard-demo":{"display":"flex","flex":"none","flexDirection":"column","alignItems":"center","justifyContent":"center"},".artboard.phone":{"width":"320px"},".artboard.phone-1":{"width":"320px","height":"568px"},".artboard.phone-1.artboard-horizontal,.artboard.phone-1.horizontal":{"width":"568px","height":"320px"},".artboard.phone-2":{"width":"375px","height":"667px"},".artboard.phone-2.artboard-horizontal,.artboard.phone-2.horizontal":{"width":"667px","height":"375px"},".artboard.phone-3":{"width":"414px","height":"736px"},".artboard.phone-3.artboard-horizontal,.artboard.phone-3.horizontal":{"width":"736px","height":"414px"},".artboard.phone-4":{"width":"375px","height":"812px"},".artboard.phone-4.artboard-horizontal,.artboard.phone-4.horizontal":{"width":"812px","height":"375px"},".artboard.phone-5":{"width":"414px","height":"896px"},".artboard.phone-5.artboard-horizontal,.artboard.phone-5.horizontal":{"width":"896px","height":"414px"},".artboard.phone-6":{"width":"320px","height":"1024px"},".artboard.phone-6.artboard-horizontal,.artboard.phone-6.horizontal":{"width":"1024px","height":"320px"},".badge-xs":{"height":".75rem","fontSize":".75rem","lineHeight":".75rem","paddingLeft":".313rem","paddingRight":".313rem"},".badge-sm":{"height":"1rem","fontSize":".75rem","lineHeight":"1rem","paddingLeft":".438rem","paddingRight":".438rem"},".badge-md":{"height":"1.25rem","fontSize":".875rem","lineHeight":"1.25rem","paddingLeft":".563rem","paddingRight":".563rem"},".badge-lg":{"height":"1.5rem","fontSize":"1rem","lineHeight":"1.5rem","paddingLeft":".688rem","paddingRight":".688rem"},".btn-xs":{"height":"1.5rem","paddingLeft":".5rem","paddingRight":".5rem","minHeight":"1.5rem","fontSize":".75rem"},".btn-sm":{"height":"2rem","paddingLeft":".75rem","paddingRight":".75rem","minHeight":"2rem","fontSize":".875rem"},".btn-md":{"height":"3rem","paddingLeft":"1rem","paddingRight":"1rem","minHeight":"3rem","fontSize":".875rem"},".btn-lg":{"height":"4rem","paddingLeft":"1.5rem","paddingRight":"1.5rem","minHeight":"4rem","fontSize":"1.125rem"},".btn-wide":{"width":"16rem"},".btn-block":{"width":"100%"},".btn-square:where(.btn-xs)":{"height":"1.5rem","width":"1.5rem","padding":"0"},".btn-square:where(.btn-sm)":{"height":"2rem","width":"2rem","padding":"0"},".btn-square:where(.btn-md)":{"height":"3rem","width":"3rem","padding":"0"},".btn-square:where(.btn-lg)":{"height":"4rem","width":"4rem","padding":"0"},".btn-circle:where(.btn-xs)":{"height":"1.5rem","width":"1.5rem","borderRadius":"9999px","padding":"0"},".btn-circle:where(.btn-sm)":{"height":"2rem","width":"2rem","borderRadius":"9999px","padding":"0"},".btn-circle:where(.btn-md)":{"height":"3rem","width":"3rem","borderRadius":"9999px","padding":"0"},".btn-circle:where(.btn-lg)":{"height":"4rem","width":"4rem","borderRadius":"9999px","padding":"0"},".card-side":{"alignItems":"stretch","flexDirection":"row"},".card-side figure>*":{"maxWidth":"unset"},":where(.card-sidefigure>*)":{"width":"100%","height":"100%","objectFit":"cover"},".checkbox-xs":{"height":"1rem","width":"1rem"},".checkbox-sm":{"height":"1.25rem","width":"1.25rem"},".checkbox-md":{"height":"1.5rem","width":"1.5rem"},".checkbox-lg":{"height":"2rem","width":"2rem"},".divider-horizontal":{"flexDirection":"column"},".divider-horizontal:before":{"height":"100%","width":".125rem"},".divider-horizontal:after":{"height":"100%","width":".125rem"},".divider-vertical":{"flexDirection":"row"},".divider-vertical:before":{"height":".125rem","width":"100%"},".divider-vertical:after":{"height":".125rem","width":"100%"},".input-md":{"height":"3rem","paddingLeft":"1rem","paddingRight":"1rem","fontSize":".875rem","lineHeight":["1.25rem","2"]},".input-lg":{"height":"4rem","paddingLeft":"1.5rem","paddingRight":"1.5rem","fontSize":"1.125rem","lineHeight":["1.75rem","2"]},".input-sm":{"height":"2rem","paddingLeft":".75rem","paddingRight":".75rem","fontSize":".875rem","lineHeight":"2rem"},".input-xs":{"height":"1.5rem","paddingLeft":".5rem","paddingRight":".5rem","fontSize":".75rem","lineHeight":["1rem","1.625"]},".kbd-xs":{"paddingLeft":".25rem","paddingRight":".25rem","fontSize":".75rem","lineHeight":"1rem","minHeight":"1.2em","minWidth":"1.2em"},".kbd-sm":{"paddingLeft":".25rem","paddingRight":".25rem","fontSize":".875rem","lineHeight":"1.25rem","minHeight":"1.6em","minWidth":"1.6em"},".kbd-md":{"paddingLeft":".5rem","paddingRight":".5rem","fontSize":"1rem","lineHeight":"1.5rem","minHeight":"2.2em","minWidth":"2.2em"},".kbd-lg":{"paddingLeft":"1rem","paddingRight":"1rem","fontSize":"1.125rem","lineHeight":"1.75rem","minHeight":"2.5em","minWidth":"2.5em"},".menu-vertical":{"flexDirection":"column"},".menu-vertical :where(li)":{"flexDirection":"column"},".menu-vertical>:where(li)>:where(ul)":{"top":"initial","left":"100%"},".menu-horizontal":{"display":"inline-flex","flexDirection":"row"},".menu-horizontal :where(li)":{"flexDirection":"row"},".menu-horizontal>:where(li)>:where(ul)":{"top":"100%","left":"initial"},".radio-xs":{"height":"1rem","width":"1rem"},".radio-sm":{"height":"1.25rem","width":"1.25rem"},".radio-md":{"height":"1.5rem","width":"1.5rem"},".radio-lg":{"height":"2rem","width":"2rem"},".range-xs":{"height":"
|
|
1
|
+
module.exports = {".artboard-demo":{"display":"flex","flex":"none","flexDirection":"column","alignItems":"center","justifyContent":"center"},".artboard.phone":{"width":"320px"},".artboard.phone-1":{"width":"320px","height":"568px"},".artboard.phone-1.artboard-horizontal,.artboard.phone-1.horizontal":{"width":"568px","height":"320px"},".artboard.phone-2":{"width":"375px","height":"667px"},".artboard.phone-2.artboard-horizontal,.artboard.phone-2.horizontal":{"width":"667px","height":"375px"},".artboard.phone-3":{"width":"414px","height":"736px"},".artboard.phone-3.artboard-horizontal,.artboard.phone-3.horizontal":{"width":"736px","height":"414px"},".artboard.phone-4":{"width":"375px","height":"812px"},".artboard.phone-4.artboard-horizontal,.artboard.phone-4.horizontal":{"width":"812px","height":"375px"},".artboard.phone-5":{"width":"414px","height":"896px"},".artboard.phone-5.artboard-horizontal,.artboard.phone-5.horizontal":{"width":"896px","height":"414px"},".artboard.phone-6":{"width":"320px","height":"1024px"},".artboard.phone-6.artboard-horizontal,.artboard.phone-6.horizontal":{"width":"1024px","height":"320px"},".badge-xs":{"height":".75rem","fontSize":".75rem","lineHeight":".75rem","paddingLeft":".313rem","paddingRight":".313rem"},".badge-sm":{"height":"1rem","fontSize":".75rem","lineHeight":"1rem","paddingLeft":".438rem","paddingRight":".438rem"},".badge-md":{"height":"1.25rem","fontSize":".875rem","lineHeight":"1.25rem","paddingLeft":".563rem","paddingRight":".563rem"},".badge-lg":{"height":"1.5rem","fontSize":"1rem","lineHeight":"1.5rem","paddingLeft":".688rem","paddingRight":".688rem"},".btn-xs":{"height":"1.5rem","paddingLeft":".5rem","paddingRight":".5rem","minHeight":"1.5rem","fontSize":".75rem"},".btn-sm":{"height":"2rem","paddingLeft":".75rem","paddingRight":".75rem","minHeight":"2rem","fontSize":".875rem"},".btn-md":{"height":"3rem","paddingLeft":"1rem","paddingRight":"1rem","minHeight":"3rem","fontSize":".875rem"},".btn-lg":{"height":"4rem","paddingLeft":"1.5rem","paddingRight":"1.5rem","minHeight":"4rem","fontSize":"1.125rem"},".btn-wide":{"width":"16rem"},".btn-block":{"width":"100%"},".btn-square:where(.btn-xs)":{"height":"1.5rem","width":"1.5rem","padding":"0"},".btn-square:where(.btn-sm)":{"height":"2rem","width":"2rem","padding":"0"},".btn-square:where(.btn-md)":{"height":"3rem","width":"3rem","padding":"0"},".btn-square:where(.btn-lg)":{"height":"4rem","width":"4rem","padding":"0"},".btn-circle:where(.btn-xs)":{"height":"1.5rem","width":"1.5rem","borderRadius":"9999px","padding":"0"},".btn-circle:where(.btn-sm)":{"height":"2rem","width":"2rem","borderRadius":"9999px","padding":"0"},".btn-circle:where(.btn-md)":{"height":"3rem","width":"3rem","borderRadius":"9999px","padding":"0"},".btn-circle:where(.btn-lg)":{"height":"4rem","width":"4rem","borderRadius":"9999px","padding":"0"},".card-side":{"alignItems":"stretch","flexDirection":"row"},".card-side figure>*":{"maxWidth":"unset"},":where(.card-sidefigure>*)":{"width":"100%","height":"100%","objectFit":"cover"},".checkbox-xs":{"height":"1rem","width":"1rem"},".checkbox-sm":{"height":"1.25rem","width":"1.25rem"},".checkbox-md":{"height":"1.5rem","width":"1.5rem"},".checkbox-lg":{"height":"2rem","width":"2rem"},".divider-horizontal":{"flexDirection":"column"},".divider-horizontal:before":{"height":"100%","width":".125rem"},".divider-horizontal:after":{"height":"100%","width":".125rem"},".divider-vertical":{"flexDirection":"row"},".divider-vertical:before":{"height":".125rem","width":"100%"},".divider-vertical:after":{"height":".125rem","width":"100%"},".input-md":{"height":"3rem","paddingLeft":"1rem","paddingRight":"1rem","fontSize":".875rem","lineHeight":["1.25rem","2"]},".input-lg":{"height":"4rem","paddingLeft":"1.5rem","paddingRight":"1.5rem","fontSize":"1.125rem","lineHeight":["1.75rem","2"]},".input-sm":{"height":"2rem","paddingLeft":".75rem","paddingRight":".75rem","fontSize":".875rem","lineHeight":"2rem"},".input-xs":{"height":"1.5rem","paddingLeft":".5rem","paddingRight":".5rem","fontSize":".75rem","lineHeight":["1rem","1.625"]},".kbd-xs":{"paddingLeft":".25rem","paddingRight":".25rem","fontSize":".75rem","lineHeight":"1rem","minHeight":"1.2em","minWidth":"1.2em"},".kbd-sm":{"paddingLeft":".25rem","paddingRight":".25rem","fontSize":".875rem","lineHeight":"1.25rem","minHeight":"1.6em","minWidth":"1.6em"},".kbd-md":{"paddingLeft":".5rem","paddingRight":".5rem","fontSize":"1rem","lineHeight":"1.5rem","minHeight":"2.2em","minWidth":"2.2em"},".kbd-lg":{"paddingLeft":"1rem","paddingRight":"1rem","fontSize":"1.125rem","lineHeight":"1.75rem","minHeight":"2.5em","minWidth":"2.5em"},".menu-vertical":{"flexDirection":"column"},".menu-vertical :where(li)":{"flexDirection":"column"},".menu-vertical>:where(li)>:where(ul)":{"top":"initial","left":"100%"},".menu-horizontal":{"display":"inline-flex","flexDirection":"row"},".menu-horizontal :where(li)":{"flexDirection":"row"},".menu-horizontal>:where(li)>:where(ul)":{"top":"100%","left":"initial"},".radio-xs":{"height":"1rem","width":"1rem"},".radio-sm":{"height":"1.25rem","width":"1.25rem"},".radio-md":{"height":"1.5rem","width":"1.5rem"},".radio-lg":{"height":"2rem","width":"2rem"},".range-xs":{"height":"1rem"},".range-xs::-webkit-slider-runnable-track":{"height":".25rem"},".range-xs::-moz-range-track":{"height":".25rem"},".range-xs::-webkit-slider-thumb":{"height":"1rem","width":"1rem","-FillerOffset":"0.4rem"},".range-xs::-moz-range-thumb":{"height":"1rem","width":"1rem","-FillerOffset":"0.4rem"},".range-sm":{"height":"1.25rem"},".range-sm::-webkit-slider-runnable-track":{"height":".25rem"},".range-sm::-moz-range-track":{"height":".25rem"},".range-sm::-webkit-slider-thumb":{"height":"1.25rem","width":"1.25rem","-FillerOffset":"0.5rem"},".range-sm::-moz-range-thumb":{"height":"1.25rem","width":"1.25rem","-FillerOffset":"0.5rem"},".range-md":{"height":"1.5rem"},".range-md::-webkit-slider-runnable-track":{"height":".5rem"},".range-md::-moz-range-track":{"height":".5rem"},".range-md::-webkit-slider-thumb":{"height":"1.5rem","width":"1.5rem","-FillerOffset":"0.6rem"},".range-md::-moz-range-thumb":{"height":"1.5rem","width":"1.5rem","-FillerOffset":"0.6rem"},".range-lg":{"height":"2rem"},".range-lg::-webkit-slider-runnable-track":{"height":"1rem"},".range-lg::-moz-range-track":{"height":"1rem"},".range-lg::-webkit-slider-thumb":{"height":"2rem","width":"2rem","-FillerOffset":"1rem"},".range-lg::-moz-range-thumb":{"height":"2rem","width":"2rem","-FillerOffset":"1rem"},".rating-xs input":{"height":".75rem","width":".75rem"},".rating-sm input":{"height":"1rem","width":"1rem"},".rating-md input":{"height":"1.5rem","width":"1.5rem"},".rating-lg input":{"height":"2.5rem","width":"2.5rem"},".rating-half.rating-xs input:not(.rating-hidden)":{"width":".375rem"},".rating-half.rating-sm input:not(.rating-hidden)":{"width":".5rem"},".rating-half.rating-md input:not(.rating-hidden)":{"width":".75rem"},".rating-half.rating-lg input:not(.rating-hidden)":{"width":"1.25rem"},".select-md":{"height":"3rem","paddingLeft":"1rem","paddingRight":"2.5rem","fontSize":".875rem","lineHeight":["1.25rem","2"],"minHeight":"3rem"},".select-lg":{"height":"4rem","paddingLeft":"1.5rem","paddingRight":"2rem","fontSize":"1.125rem","lineHeight":["1.75rem","2"],"minHeight":"4rem"},".select-sm":{"height":"2rem","paddingLeft":".75rem","paddingRight":"2rem","fontSize":".875rem","lineHeight":"2rem","minHeight":"2rem"},".select-xs":{"height":"1.5rem","paddingLeft":".5rem","paddingRight":"2rem","fontSize":".75rem","lineHeight":["1rem","1.625"],"minHeight":"1.5rem"},".stats-horizontal":{"gridAutoFlow":"column"},".stats-vertical":{"gridAutoFlow":"row"},".steps-horizontal":{"gridAutoColumns":"1fr","display":"inline-grid","gridAutoFlow":"column","overflow":"hidden","overflowX":"auto"},".steps-horizontal .step":{"display":"grid","gridTemplateColumns":"repeat(1,minmax(0,1fr))","gridTemplateRows":"repeat(2,minmax(0,1fr))","placeItems":"center","textAlign":"center"},".steps-vertical":{"gridAutoRows":"1fr","gridAutoFlow":"row"},".steps-vertical .step":{"display":"grid","gridTemplateColumns":"repeat(2,minmax(0,1fr))","gridTemplateRows":"repeat(1,minmax(0,1fr))"},".tab-md":{"height":"2rem","fontSize":".875rem","lineHeight":["1.25rem","2"],"-TabPadding":"1rem"},".tab-lg":{"height":"3rem","fontSize":"1.125rem","lineHeight":["1.75rem","2"],"-TabPadding":"1.25rem"},".tab-sm":{"height":"1.5rem","fontSize":".875rem","lineHeight":".75rem","-TabPadding":"0.75rem"},".tab-xs":{"height":"1.25rem","fontSize":".75rem","lineHeight":".75rem","-TabPadding":"0.5rem"},".toggle-xs":{"-Handleoffset":"0.5rem","height":"1rem","width":"1.5rem"},".toggle-sm":{"-Handleoffset":"0.75rem","height":"1.25rem","width":"2rem"},".toggle-md":{"-Handleoffset":"1.5rem","height":"1.5rem","width":"3rem"},".toggle-lg":{"-Handleoffset":"2rem","height":"2rem","width":"4rem"}};
|
package/dist/utilities.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = {".rounded-box":{"borderRadius":"var(--rounded-box,1rem)"},".rounded-t-box":{"borderTopLeftRadius":"var(--rounded-box,1rem)","borderTopRightRadius":"var(--rounded-box,1rem)"},".rounded-b-box":{"borderBottomLeftRadius":"var(--rounded-box,1rem)","borderBottomRightRadius":"var(--rounded-box,1rem)"},".rounded-btn":{"borderRadius":"var(--rounded-btn,.5rem)"},".rounded-badge":{"borderRadius":"var(--rounded-badge,1.9rem)"},".text-2xs":{"fontSize":".7rem"},".glass,.glass.btn-active,.glass:hover":{"border":"none","backdropFilter":"blur(var(--glass-blur, 40px))","backgroundColor":"transparent","backgroundImage":"linear-gradient(135deg,rgb(255 255 255 / var(--glass-opacity,30%)) 0,rgb(0 0 0 / 0) 100%),linear-gradient(var(--glass-reflex-degree,100deg),rgb(255 255 255 / var(--glass-reflex-opacity,10%)) 25%,rgb(0 0 0 / 0) 25%)","boxShadow":"0 0 0 1px rgb(255 255 255 / var(--glass-border-opacity,10%)) inset,0 0 0 2px rgb(0 0 0 / 5%)","textShadow":"0 1px rgb(0 0 0 / var(--glass-text-shadow-opacity,5%))"},".min-h-6":{"minHeight":"1.5rem"},".min-h-8":{"minHeight":"2rem"},".min-h-12":{"minHeight":"3rem"},".min-h-16":{"minHeight":"4rem"},".no-animation":{"-BtnFocusScale":"1","-AnimationBtn":"0","-AnimationInput":"0"},".tab-border-none":{"-TabBorder":"0px"},".tab-border":{"-TabBorder":"1px"},".tab-border-2":{"-TabBorder":"2px"},".tab-border-3":{"-TabBorder":"3px"},".tab-rounded-none":{"-TabRadius":"0"},".tab-rounded-lg":{"-TabRadius":"0.5rem"}};
|
|
1
|
+
module.exports = {".rounded-box":{"borderRadius":"var(--rounded-box,1rem)"},".rounded-t-box":{"borderTopLeftRadius":"var(--rounded-box,1rem)","borderTopRightRadius":"var(--rounded-box,1rem)"},".rounded-b-box":{"borderBottomLeftRadius":"var(--rounded-box,1rem)","borderBottomRightRadius":"var(--rounded-box,1rem)"},".rounded-l-box":{"borderTopLeftRadius":"var(--rounded-box,1rem)","borderBottomLeftRadius":"var(--rounded-box,1rem)"},".rounded-r-box":{"borderTopRightRadius":"var(--rounded-box,1rem)","borderBottomRightRadius":"var(--rounded-box,1rem)"},".rounded-br-box":{"borderBottomRightRadius":"var(--rounded-box,1rem)"},".rounded-tr-box":{"borderTopRightRadius":"var(--rounded-box,1rem)"},".rounded-bl-box":{"borderBottomLeftRadius":"var(--rounded-box,1rem)"},".rounded-tl-box":{"borderTopLeftRadius":"var(--rounded-box,1rem)"},".rounded-btn":{"borderRadius":"var(--rounded-btn,.5rem)"},".rounded-badge":{"borderRadius":"var(--rounded-badge,1.9rem)"},".text-2xs":{"fontSize":".7rem"},".glass,.glass.btn-active,.glass:hover":{"border":"none","backdropFilter":"blur(var(--glass-blur, 40px))","backgroundColor":"transparent","backgroundImage":"linear-gradient(135deg,rgb(255 255 255 / var(--glass-opacity,30%)) 0,rgb(0 0 0 / 0) 100%),linear-gradient(var(--glass-reflex-degree,100deg),rgb(255 255 255 / var(--glass-reflex-opacity,10%)) 25%,rgb(0 0 0 / 0) 25%)","boxShadow":"0 0 0 1px rgb(255 255 255 / var(--glass-border-opacity,10%)) inset,0 0 0 2px rgb(0 0 0 / 5%)","textShadow":"0 1px rgb(0 0 0 / var(--glass-text-shadow-opacity,5%))"},".min-h-6":{"minHeight":"1.5rem"},".min-h-8":{"minHeight":"2rem"},".min-h-12":{"minHeight":"3rem"},".min-h-16":{"minHeight":"4rem"},".no-animation":{"-BtnFocusScale":"1","-AnimationBtn":"0","-AnimationInput":"0"},".tab-border-none":{"-TabBorder":"0px"},".tab-border":{"-TabBorder":"1px"},".tab-border-2":{"-TabBorder":"2px"},".tab-border-3":{"-TabBorder":"3px"},".tab-rounded-none":{"-TabRadius":"0"},".tab-rounded-lg":{"-TabRadius":"0.5rem"}};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "daisyui",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "daisyUI - Tailwind CSS Components",
|
|
5
5
|
"author": "Pouya Saadeghi",
|
|
6
6
|
"license": "MIT",
|
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
"themes": "postcss src/themes/index.css -o dist/themes.css --config src/themes",
|
|
66
66
|
"full": "postcss src/full/index.css -o dist/full.css --config src/full",
|
|
67
67
|
"build": "npm run base && npm run utilities:global && npm run utilities:unstyled && npm run utilities:styled && npm run components && npm run merge:unstyled && npm run merge:styled && npm run rtl && npm run prejss && npm run themes && npm run full",
|
|
68
|
-
"clean": "rm -R colors && rm -R dist && rm index.js",
|
|
69
68
|
"install:docs": "cd src/docs && npm install",
|
|
70
69
|
"dev": "cd src/docs && npm run dev",
|
|
71
70
|
"add": "touch src/components/unstyled/$npm_config_name.css && touch src/components/styled/$npm_config_name.css",
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
const colorNames = require("./colorNames");
|
|
2
|
+
const Color = require("color");
|
|
3
|
+
|
|
4
|
+
const generateForegorundColorFrom = function (input, percentage = 0.8) {
|
|
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
|
+
}
|
|
24
|
+
|
|
25
|
+
// auto generate focus colors
|
|
26
|
+
if (!input.hasOwnProperty("primary-focus")) {
|
|
27
|
+
const darkerHslArray = Color(input["primary"]).darken(0.2).hsl().round().array();
|
|
28
|
+
resultObj["--pf"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!input.hasOwnProperty("secondary-focus")) {
|
|
32
|
+
const darkerHslArray = Color(input["secondary"]).darken(0.2).hsl().round().array();
|
|
33
|
+
resultObj["--sf"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!input.hasOwnProperty("accent-focus")) {
|
|
37
|
+
const darkerHslArray = Color(input["accent"]).darken(0.2).hsl().round().array();
|
|
38
|
+
resultObj["--af"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!input.hasOwnProperty("neutral-focus")) {
|
|
42
|
+
const darkerHslArray = Color(input["neutral"]).darken(0.2).hsl().round().array();
|
|
43
|
+
resultObj["--nf"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// auto generate base colors
|
|
47
|
+
if (!input.hasOwnProperty("base-100")) {
|
|
48
|
+
resultObj["--b1"] = 0 + " " + 0 + "%" + " " + 100 + "%";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!input.hasOwnProperty("base-200")) {
|
|
52
|
+
const darkerHslArray = Color(input["base-100"]).darken(0.1).hsl().round().array();
|
|
53
|
+
resultObj["--b2"] = darkerHslArray[0] + " " + darkerHslArray[1] + "%" + " " + darkerHslArray[2] + "%";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!input.hasOwnProperty("base-300")) {
|
|
57
|
+
if (input.hasOwnProperty("base-200")) {
|
|
58
|
+
const darkerHslArray = Color(input["base-200"]).darken(0.1).hsl().round().array();
|
|
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] + "%";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// auto generate state colors
|
|
67
|
+
if (!input.hasOwnProperty("info")) {
|
|
68
|
+
resultObj["--in"] = 198 + " " + 93 + "%" + " " + 60 + "%";
|
|
69
|
+
}
|
|
70
|
+
if (!input.hasOwnProperty("success")) {
|
|
71
|
+
resultObj["--su"] = 158 + " " + 64 + "%" + " " + 52 + "%";
|
|
72
|
+
}
|
|
73
|
+
if (!input.hasOwnProperty("warning")) {
|
|
74
|
+
resultObj["--wa"] = 43 + " " + 96 + "%" + " " + 56 + "%";
|
|
75
|
+
}
|
|
76
|
+
if (!input.hasOwnProperty("error")) {
|
|
77
|
+
resultObj["--er"] = 0 + " " + 91 + "%" + " " + 71 + "%";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// auto generate content colors
|
|
81
|
+
if (!input.hasOwnProperty("base-content")) {
|
|
82
|
+
resultObj["--bc"] = generateForegorundColorFrom(input["base-100"])
|
|
83
|
+
}
|
|
84
|
+
if (!input.hasOwnProperty("primary-content")) {
|
|
85
|
+
resultObj["--pc"] = generateForegorundColorFrom(input["primary"])
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (!input.hasOwnProperty("secondary-content")) {
|
|
89
|
+
resultObj["--sc"] = generateForegorundColorFrom(input["secondary"])
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!input.hasOwnProperty("accent-content")) {
|
|
93
|
+
resultObj["--ac"] = generateForegorundColorFrom(input["accent"])
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (!input.hasOwnProperty("neutral-content")) {
|
|
97
|
+
resultObj["--nc"] = generateForegorundColorFrom(input["neutral"])
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (!input.hasOwnProperty("info-content")) {
|
|
101
|
+
if (input.hasOwnProperty("info")) {
|
|
102
|
+
resultObj["--inc"] = generateForegorundColorFrom(input["info"])
|
|
103
|
+
} else {
|
|
104
|
+
resultObj["--inc"] = 198 + " " + 100 + "%" + " " + 12 + "%";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (!input.hasOwnProperty("success-content")) {
|
|
109
|
+
if (input.hasOwnProperty("success")) {
|
|
110
|
+
resultObj["--suc"] = generateForegorundColorFrom(input["success"])
|
|
111
|
+
} else {
|
|
112
|
+
resultObj["--suc"] = 158 + " " + 100 + "%" + " " + 10 + "%";
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (!input.hasOwnProperty("warning-content")) {
|
|
117
|
+
if (input.hasOwnProperty("warning")) {
|
|
118
|
+
resultObj["--wac"] = generateForegorundColorFrom(input["warning"])
|
|
119
|
+
} else {
|
|
120
|
+
resultObj["--wac"] = 43 + " " + 100 + "%" + " " + 11 + "%";
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (!input.hasOwnProperty("error-content")) {
|
|
125
|
+
if (input.hasOwnProperty("error")) {
|
|
126
|
+
resultObj["--erc"] = generateForegorundColorFrom(input["error"])
|
|
127
|
+
} else {
|
|
128
|
+
resultObj["--erc"] = 0 + " " + 100 + "%" + " " + 14 + "%";
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// auto generate css variables
|
|
133
|
+
if (!input.hasOwnProperty("--rounded-box")) {
|
|
134
|
+
resultObj["--rounded-box"] = "1rem";
|
|
135
|
+
}
|
|
136
|
+
if (!input.hasOwnProperty("--rounded-btn")) {
|
|
137
|
+
resultObj["--rounded-btn"] = "0.5rem";
|
|
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
|
+
}
|
|
163
|
+
|
|
164
|
+
});
|
|
165
|
+
return resultObj;
|
|
166
|
+
}
|
|
167
|
+
return input;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
module.exports = {
|
|
171
|
+
|
|
172
|
+
injectThemes: function (addBase, config, themes) {
|
|
173
|
+
let includedThemesObj = new Object();
|
|
174
|
+
|
|
175
|
+
// add light themes
|
|
176
|
+
if (config("daisyui.themes") == false) {
|
|
177
|
+
Object.entries(themes).forEach(([theme, index]) => {
|
|
178
|
+
includedThemesObj[theme] = convertToHsl(themes[theme]);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// add default themes
|
|
183
|
+
if (config("daisyui.themes") != false) {
|
|
184
|
+
Object.entries(themes).forEach(([theme, index]) => {
|
|
185
|
+
includedThemesObj[theme] = convertToHsl(themes[theme]);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// add custom themes
|
|
190
|
+
if (Array.isArray(config("daisyui.themes"))) {
|
|
191
|
+
config("daisyui.themes").forEach((item, index) => {
|
|
192
|
+
if (typeof item === "object" && item !== null) {
|
|
193
|
+
Object.entries(item).forEach(([customThemeName, customThemevalue]) => {
|
|
194
|
+
includedThemesObj["[data-theme=" + customThemeName + "]"] =
|
|
195
|
+
convertToHsl(customThemevalue);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
let themeOrder = [];
|
|
204
|
+
if (Array.isArray(config("daisyui.themes"))) {
|
|
205
|
+
config("daisyui.themes").forEach((theme, index) => {
|
|
206
|
+
if (typeof theme === "object" && theme !== null) {
|
|
207
|
+
Object.entries(theme).forEach(([customThemeName, customThemevalue]) => {
|
|
208
|
+
themeOrder.push(customThemeName);
|
|
209
|
+
});
|
|
210
|
+
} else if (
|
|
211
|
+
includedThemesObj.hasOwnProperty("[data-theme=" + theme + "]")
|
|
212
|
+
) {
|
|
213
|
+
themeOrder.push(theme);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
} else if (config("daisyui.themes") != false) {
|
|
217
|
+
themeOrder = [
|
|
218
|
+
"light",
|
|
219
|
+
"dark",
|
|
220
|
+
"cupcake",
|
|
221
|
+
"bumblebee",
|
|
222
|
+
"emerald",
|
|
223
|
+
"corporate",
|
|
224
|
+
"synthwave",
|
|
225
|
+
"retro",
|
|
226
|
+
"cyberpunk",
|
|
227
|
+
"valentine",
|
|
228
|
+
"halloween",
|
|
229
|
+
"garden",
|
|
230
|
+
"forest",
|
|
231
|
+
"aqua",
|
|
232
|
+
"lofi",
|
|
233
|
+
"pastel",
|
|
234
|
+
"fantasy",
|
|
235
|
+
"wireframe",
|
|
236
|
+
"black",
|
|
237
|
+
"luxury",
|
|
238
|
+
"dracula",
|
|
239
|
+
"cmyk",
|
|
240
|
+
"autumn",
|
|
241
|
+
"business",
|
|
242
|
+
"acid",
|
|
243
|
+
"lemonade",
|
|
244
|
+
];
|
|
245
|
+
} else if (config("daisyui.themes") == false) {
|
|
246
|
+
themeOrder.push("light");
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// inject themes in order
|
|
250
|
+
themeOrder.forEach((themeName, index) => {
|
|
251
|
+
if (index === 0) {
|
|
252
|
+
// first theme as root
|
|
253
|
+
addBase({
|
|
254
|
+
[":root"]: includedThemesObj["[data-theme=" + themeName + "]"],
|
|
255
|
+
});
|
|
256
|
+
} else if (index === 1) {
|
|
257
|
+
// auto dark
|
|
258
|
+
if (config("daisyui.darkTheme")) {
|
|
259
|
+
if (
|
|
260
|
+
themeOrder[0] != config("daisyui.darkTheme") &&
|
|
261
|
+
themeOrder.includes(config("daisyui.darkTheme"))
|
|
262
|
+
) {
|
|
263
|
+
addBase({
|
|
264
|
+
["@media (prefers-color-scheme: dark)"]: {
|
|
265
|
+
[":root"]:
|
|
266
|
+
includedThemesObj[
|
|
267
|
+
`[data-theme=${config("daisyui.darkTheme")}]`
|
|
268
|
+
],
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
if (themeOrder[0] != "dark" && themeOrder.includes("dark")) {
|
|
274
|
+
addBase({
|
|
275
|
+
["@media (prefers-color-scheme: dark)"]: {
|
|
276
|
+
[":root"]: includedThemesObj["[data-theme=dark]"],
|
|
277
|
+
},
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
// theme 0 with name
|
|
282
|
+
addBase({
|
|
283
|
+
["[data-theme=" + themeOrder[0] + "]"]:
|
|
284
|
+
includedThemesObj["[data-theme=" + themeOrder[0] + "]"],
|
|
285
|
+
});
|
|
286
|
+
// theme 1 with name
|
|
287
|
+
addBase({
|
|
288
|
+
["[data-theme=" + themeOrder[1] + "]"]:
|
|
289
|
+
includedThemesObj["[data-theme=" + themeOrder[1] + "]"],
|
|
290
|
+
});
|
|
291
|
+
} else {
|
|
292
|
+
addBase({
|
|
293
|
+
["[data-theme=" + themeName + "]"]:
|
|
294
|
+
includedThemesObj["[data-theme=" + themeName + "]"],
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
return {
|
|
302
|
+
includedThemesObj: includedThemesObj,
|
|
303
|
+
themeOrder: themeOrder,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
}
|