sun-card-design 1.1.3 → 1.1.10

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.
Files changed (38) hide show
  1. package/dist/mobile/sun-card-design-mobile.es49.js +1 -1
  2. package/dist/mobile/sun-card-design-mobile.es72.js +4 -4
  3. package/dist/mobile/sun-card-design-mobile.es73.js +11 -30
  4. package/dist/mobile/sun-card-design-mobile.es75.js +10 -10
  5. package/dist/mobile/sun-card-design-mobile.es84.js +2 -4
  6. package/dist/mobile/sun-card-design-mobile.es85.js +42 -10
  7. package/dist/mobile/sun-card-design-mobile.es86.js +133 -94
  8. package/dist/mobile/sun-card-design-mobile.es87.js +110 -12
  9. package/dist/mobile/sun-card-design-mobile.es88.js +150 -145
  10. package/dist/mobile/sun-card-design-mobile.es89.js +36 -99
  11. package/dist/pc/sun-card-design-pc.es32.js +2 -2
  12. package/dist/pc/sun-card-design-pc.es33.js +2 -2
  13. package/dist/pc/sun-card-design-pc.es34.js +2 -2
  14. package/dist/pc/sun-card-design-pc.es35.js +2 -2
  15. package/dist/pc/sun-card-design-pc.es36.js +2 -2
  16. package/dist/pc/sun-card-design-pc.es37.js +2 -2
  17. package/dist/pc/sun-card-design-pc.es38.js +2 -2
  18. package/dist/pc/sun-card-design-pc.es68.js +2 -2
  19. package/dist/pc/sun-card-design-pc.es70.js +2 -2
  20. package/dist/pc/sun-card-design-pc.es72.js +4 -4
  21. package/dist/pc/sun-card-design-pc.es73.js +12 -31
  22. package/dist/pc/sun-card-design-pc.es74.js +2 -175
  23. package/dist/pc/sun-card-design-pc.es75.js +145 -9
  24. package/dist/pc/sun-card-design-pc.es76.js +2 -107
  25. package/dist/pc/sun-card-design-pc.es77.js +2 -2
  26. package/dist/pc/sun-card-design-pc.es78.js +2 -146
  27. package/dist/pc/sun-card-design-pc.es79.js +2 -2
  28. package/dist/pc/sun-card-design-pc.es80.js +2 -2
  29. package/dist/pc/sun-card-design-pc.es81.js +2 -2
  30. package/dist/pc/sun-card-design-pc.es82.js +2 -2
  31. package/dist/pc/sun-card-design-pc.es83.js +2 -2
  32. package/dist/pc/sun-card-design-pc.es84.js +173 -2
  33. package/dist/pc/sun-card-design-pc.es85.js +42 -2
  34. package/dist/pc/sun-card-design-pc.es86.js +146 -2
  35. package/dist/pc/sun-card-design-pc.es87.js +110 -12
  36. package/dist/pc/sun-card-design-pc.es88.js +150 -145
  37. package/dist/pc/sun-card-design-pc.es89.js +36 -99
  38. package/package.json +2 -1
@@ -1,4 +1,4 @@
1
- var DownloadOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] }, "name": "download", "theme": "outlined" };
1
+ var UploadOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] }, "name": "upload", "theme": "outlined" };
2
2
  export {
3
- DownloadOutlined as default
3
+ UploadOutlined as default
4
4
  };
@@ -1,4 +1,175 @@
1
- var EditOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z" } }] }, "name": "edit", "theme": "outlined" };
1
+ import { inputToRGB } from "./sun-card-design-pc.es86.js";
2
+ import { rgbToHsv, rgbToHex } from "./sun-card-design-pc.es87.js";
3
+ var hueStep = 2;
4
+ var saturationStep = 0.16;
5
+ var saturationStep2 = 0.05;
6
+ var brightnessStep1 = 0.05;
7
+ var brightnessStep2 = 0.15;
8
+ var lightColorCount = 5;
9
+ var darkColorCount = 4;
10
+ var darkColorMap = [{
11
+ index: 7,
12
+ opacity: 0.15
13
+ }, {
14
+ index: 6,
15
+ opacity: 0.25
16
+ }, {
17
+ index: 5,
18
+ opacity: 0.3
19
+ }, {
20
+ index: 5,
21
+ opacity: 0.45
22
+ }, {
23
+ index: 5,
24
+ opacity: 0.65
25
+ }, {
26
+ index: 5,
27
+ opacity: 0.85
28
+ }, {
29
+ index: 4,
30
+ opacity: 0.9
31
+ }, {
32
+ index: 3,
33
+ opacity: 0.95
34
+ }, {
35
+ index: 2,
36
+ opacity: 0.97
37
+ }, {
38
+ index: 1,
39
+ opacity: 0.98
40
+ }];
41
+ function toHsv(_ref) {
42
+ var r = _ref.r, g = _ref.g, b = _ref.b;
43
+ var hsv = rgbToHsv(r, g, b);
44
+ return {
45
+ h: hsv.h * 360,
46
+ s: hsv.s,
47
+ v: hsv.v
48
+ };
49
+ }
50
+ function toHex(_ref2) {
51
+ var r = _ref2.r, g = _ref2.g, b = _ref2.b;
52
+ return "#".concat(rgbToHex(r, g, b));
53
+ }
54
+ function mix(rgb1, rgb2, amount) {
55
+ var p = amount / 100;
56
+ var rgb = {
57
+ r: (rgb2.r - rgb1.r) * p + rgb1.r,
58
+ g: (rgb2.g - rgb1.g) * p + rgb1.g,
59
+ b: (rgb2.b - rgb1.b) * p + rgb1.b
60
+ };
61
+ return rgb;
62
+ }
63
+ function getHue(hsv, i, light) {
64
+ var hue;
65
+ if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
66
+ hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
67
+ } else {
68
+ hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
69
+ }
70
+ if (hue < 0) {
71
+ hue += 360;
72
+ } else if (hue >= 360) {
73
+ hue -= 360;
74
+ }
75
+ return hue;
76
+ }
77
+ function getSaturation(hsv, i, light) {
78
+ if (hsv.h === 0 && hsv.s === 0) {
79
+ return hsv.s;
80
+ }
81
+ var saturation;
82
+ if (light) {
83
+ saturation = hsv.s - saturationStep * i;
84
+ } else if (i === darkColorCount) {
85
+ saturation = hsv.s + saturationStep;
86
+ } else {
87
+ saturation = hsv.s + saturationStep2 * i;
88
+ }
89
+ if (saturation > 1) {
90
+ saturation = 1;
91
+ }
92
+ if (light && i === lightColorCount && saturation > 0.1) {
93
+ saturation = 0.1;
94
+ }
95
+ if (saturation < 0.06) {
96
+ saturation = 0.06;
97
+ }
98
+ return Number(saturation.toFixed(2));
99
+ }
100
+ function getValue(hsv, i, light) {
101
+ var value;
102
+ if (light) {
103
+ value = hsv.v + brightnessStep1 * i;
104
+ } else {
105
+ value = hsv.v - brightnessStep2 * i;
106
+ }
107
+ if (value > 1) {
108
+ value = 1;
109
+ }
110
+ return Number(value.toFixed(2));
111
+ }
112
+ function generate(color) {
113
+ var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
114
+ var patterns = [];
115
+ var pColor = inputToRGB(color);
116
+ for (var i = lightColorCount; i > 0; i -= 1) {
117
+ var hsv = toHsv(pColor);
118
+ var colorString = toHex(inputToRGB({
119
+ h: getHue(hsv, i, true),
120
+ s: getSaturation(hsv, i, true),
121
+ v: getValue(hsv, i, true)
122
+ }));
123
+ patterns.push(colorString);
124
+ }
125
+ patterns.push(toHex(pColor));
126
+ for (var _i = 1; _i <= darkColorCount; _i += 1) {
127
+ var _hsv = toHsv(pColor);
128
+ var _colorString = toHex(inputToRGB({
129
+ h: getHue(_hsv, _i),
130
+ s: getSaturation(_hsv, _i),
131
+ v: getValue(_hsv, _i)
132
+ }));
133
+ patterns.push(_colorString);
134
+ }
135
+ if (opts.theme === "dark") {
136
+ return darkColorMap.map(function(_ref3) {
137
+ var index = _ref3.index, opacity = _ref3.opacity;
138
+ var darkColorString = toHex(mix(inputToRGB(opts.backgroundColor || "#141414"), inputToRGB(patterns[index]), opacity * 100));
139
+ return darkColorString;
140
+ });
141
+ }
142
+ return patterns;
143
+ }
144
+ var presetPrimaryColors = {
145
+ red: "#F5222D",
146
+ volcano: "#FA541C",
147
+ orange: "#FA8C16",
148
+ gold: "#FAAD14",
149
+ yellow: "#FADB14",
150
+ lime: "#A0D911",
151
+ green: "#52C41A",
152
+ cyan: "#13C2C2",
153
+ blue: "#1890FF",
154
+ geekblue: "#2F54EB",
155
+ purple: "#722ED1",
156
+ magenta: "#EB2F96",
157
+ grey: "#666666"
158
+ };
159
+ var presetPalettes = {};
160
+ var presetDarkPalettes = {};
161
+ Object.keys(presetPrimaryColors).forEach(function(key) {
162
+ presetPalettes[key] = generate(presetPrimaryColors[key]);
163
+ presetPalettes[key].primary = presetPalettes[key][5];
164
+ presetDarkPalettes[key] = generate(presetPrimaryColors[key], {
165
+ theme: "dark",
166
+ backgroundColor: "#141414"
167
+ });
168
+ presetDarkPalettes[key].primary = presetDarkPalettes[key][5];
169
+ });
2
170
  export {
3
- EditOutlined as default
171
+ generate,
172
+ presetDarkPalettes,
173
+ presetPalettes,
174
+ presetPrimaryColors
4
175
  };
@@ -1,4 +1,44 @@
1
- var SearchOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z" } }] }, "name": "search", "theme": "outlined" };
1
+ var containers = [];
2
+ var styleElements = [];
3
+ var usage = "insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";
4
+ function createStyleElement() {
5
+ var styleElement = document.createElement("style");
6
+ styleElement.setAttribute("type", "text/css");
7
+ return styleElement;
8
+ }
9
+ function insertCss(css, options) {
10
+ options = options || {};
11
+ if (css === void 0) {
12
+ throw new Error(usage);
13
+ }
14
+ var position = options.prepend === true ? "prepend" : "append";
15
+ var container = options.container !== void 0 ? options.container : document.querySelector("head");
16
+ var containerId = containers.indexOf(container);
17
+ if (containerId === -1) {
18
+ containerId = containers.push(container) - 1;
19
+ styleElements[containerId] = {};
20
+ }
21
+ var styleElement;
22
+ if (styleElements[containerId] !== void 0 && styleElements[containerId][position] !== void 0) {
23
+ styleElement = styleElements[containerId][position];
24
+ } else {
25
+ styleElement = styleElements[containerId][position] = createStyleElement();
26
+ if (position === "prepend") {
27
+ container.insertBefore(styleElement, container.childNodes[0]);
28
+ } else {
29
+ container.appendChild(styleElement);
30
+ }
31
+ }
32
+ if (css.charCodeAt(0) === 65279) {
33
+ css = css.substr(1, css.length);
34
+ }
35
+ if (styleElement.styleSheet) {
36
+ styleElement.styleSheet.cssText += css;
37
+ } else {
38
+ styleElement.textContent += css;
39
+ }
40
+ return styleElement;
41
+ }
2
42
  export {
3
- SearchOutlined as default
43
+ insertCss as default
4
44
  };
@@ -1,4 +1,148 @@
1
- var UploadOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] }, "name": "upload", "theme": "outlined" };
1
+ import { rgbToRgb, hsvToRgb, hslToRgb, convertHexToDecimal, parseIntFromHex } from "./sun-card-design-pc.es87.js";
2
+ import { names } from "./sun-card-design-pc.es88.js";
3
+ import { convertToPercentage, boundAlpha } from "./sun-card-design-pc.es89.js";
4
+ function inputToRGB(color) {
5
+ var rgb = { r: 0, g: 0, b: 0 };
6
+ var a = 1;
7
+ var s = null;
8
+ var v = null;
9
+ var l = null;
10
+ var ok = false;
11
+ var format = false;
12
+ if (typeof color === "string") {
13
+ color = stringInputToObject(color);
14
+ }
15
+ if (typeof color === "object") {
16
+ if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
17
+ rgb = rgbToRgb(color.r, color.g, color.b);
18
+ ok = true;
19
+ format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
20
+ } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
21
+ s = convertToPercentage(color.s);
22
+ v = convertToPercentage(color.v);
23
+ rgb = hsvToRgb(color.h, s, v);
24
+ ok = true;
25
+ format = "hsv";
26
+ } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
27
+ s = convertToPercentage(color.s);
28
+ l = convertToPercentage(color.l);
29
+ rgb = hslToRgb(color.h, s, l);
30
+ ok = true;
31
+ format = "hsl";
32
+ }
33
+ if (Object.prototype.hasOwnProperty.call(color, "a")) {
34
+ a = color.a;
35
+ }
36
+ }
37
+ a = boundAlpha(a);
38
+ return {
39
+ ok,
40
+ format: color.format || format,
41
+ r: Math.min(255, Math.max(rgb.r, 0)),
42
+ g: Math.min(255, Math.max(rgb.g, 0)),
43
+ b: Math.min(255, Math.max(rgb.b, 0)),
44
+ a
45
+ };
46
+ }
47
+ var CSS_INTEGER = "[-\\+]?\\d+%?";
48
+ var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
49
+ var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
50
+ var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
51
+ var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
52
+ var matchers = {
53
+ CSS_UNIT: new RegExp(CSS_UNIT),
54
+ rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
55
+ rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
56
+ hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
57
+ hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
58
+ hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
59
+ hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
60
+ hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
61
+ hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
62
+ hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
63
+ hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
64
+ };
65
+ function stringInputToObject(color) {
66
+ color = color.trim().toLowerCase();
67
+ if (color.length === 0) {
68
+ return false;
69
+ }
70
+ var named = false;
71
+ if (names[color]) {
72
+ color = names[color];
73
+ named = true;
74
+ } else if (color === "transparent") {
75
+ return { r: 0, g: 0, b: 0, a: 0, format: "name" };
76
+ }
77
+ var match = matchers.rgb.exec(color);
78
+ if (match) {
79
+ return { r: match[1], g: match[2], b: match[3] };
80
+ }
81
+ match = matchers.rgba.exec(color);
82
+ if (match) {
83
+ return { r: match[1], g: match[2], b: match[3], a: match[4] };
84
+ }
85
+ match = matchers.hsl.exec(color);
86
+ if (match) {
87
+ return { h: match[1], s: match[2], l: match[3] };
88
+ }
89
+ match = matchers.hsla.exec(color);
90
+ if (match) {
91
+ return { h: match[1], s: match[2], l: match[3], a: match[4] };
92
+ }
93
+ match = matchers.hsv.exec(color);
94
+ if (match) {
95
+ return { h: match[1], s: match[2], v: match[3] };
96
+ }
97
+ match = matchers.hsva.exec(color);
98
+ if (match) {
99
+ return { h: match[1], s: match[2], v: match[3], a: match[4] };
100
+ }
101
+ match = matchers.hex8.exec(color);
102
+ if (match) {
103
+ return {
104
+ r: parseIntFromHex(match[1]),
105
+ g: parseIntFromHex(match[2]),
106
+ b: parseIntFromHex(match[3]),
107
+ a: convertHexToDecimal(match[4]),
108
+ format: named ? "name" : "hex8"
109
+ };
110
+ }
111
+ match = matchers.hex6.exec(color);
112
+ if (match) {
113
+ return {
114
+ r: parseIntFromHex(match[1]),
115
+ g: parseIntFromHex(match[2]),
116
+ b: parseIntFromHex(match[3]),
117
+ format: named ? "name" : "hex"
118
+ };
119
+ }
120
+ match = matchers.hex4.exec(color);
121
+ if (match) {
122
+ return {
123
+ r: parseIntFromHex(match[1] + match[1]),
124
+ g: parseIntFromHex(match[2] + match[2]),
125
+ b: parseIntFromHex(match[3] + match[3]),
126
+ a: convertHexToDecimal(match[4] + match[4]),
127
+ format: named ? "name" : "hex8"
128
+ };
129
+ }
130
+ match = matchers.hex3.exec(color);
131
+ if (match) {
132
+ return {
133
+ r: parseIntFromHex(match[1] + match[1]),
134
+ g: parseIntFromHex(match[2] + match[2]),
135
+ b: parseIntFromHex(match[3] + match[3]),
136
+ format: named ? "name" : "hex"
137
+ };
138
+ }
139
+ return false;
140
+ }
141
+ function isValidCSSUnit(color) {
142
+ return Boolean(matchers.CSS_UNIT.exec(String(color)));
143
+ }
2
144
  export {
3
- UploadOutlined as default
145
+ inputToRGB,
146
+ isValidCSSUnit,
147
+ stringInputToObject
4
148
  };
@@ -1,14 +1,112 @@
1
- import { defineComponent } from "vue";
2
- import { useInsertStyles } from "./sun-card-design-pc.es73.js";
3
- var InsertStyles = defineComponent({
4
- name: "InsertStyles",
5
- setup: function setup() {
6
- useInsertStyles();
7
- return function() {
8
- return null;
9
- };
10
- }
11
- });
1
+ import { bound01, pad2 } from "./sun-card-design-pc.es89.js";
2
+ function rgbToRgb(r, g, b) {
3
+ return {
4
+ r: bound01(r, 255) * 255,
5
+ g: bound01(g, 255) * 255,
6
+ b: bound01(b, 255) * 255
7
+ };
8
+ }
9
+ function hue2rgb(p, q, t) {
10
+ if (t < 0) {
11
+ t += 1;
12
+ }
13
+ if (t > 1) {
14
+ t -= 1;
15
+ }
16
+ if (t < 1 / 6) {
17
+ return p + (q - p) * (6 * t);
18
+ }
19
+ if (t < 1 / 2) {
20
+ return q;
21
+ }
22
+ if (t < 2 / 3) {
23
+ return p + (q - p) * (2 / 3 - t) * 6;
24
+ }
25
+ return p;
26
+ }
27
+ function hslToRgb(h, s, l) {
28
+ var r;
29
+ var g;
30
+ var b;
31
+ h = bound01(h, 360);
32
+ s = bound01(s, 100);
33
+ l = bound01(l, 100);
34
+ if (s === 0) {
35
+ g = l;
36
+ b = l;
37
+ r = l;
38
+ } else {
39
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
40
+ var p = 2 * l - q;
41
+ r = hue2rgb(p, q, h + 1 / 3);
42
+ g = hue2rgb(p, q, h);
43
+ b = hue2rgb(p, q, h - 1 / 3);
44
+ }
45
+ return { r: r * 255, g: g * 255, b: b * 255 };
46
+ }
47
+ function rgbToHsv(r, g, b) {
48
+ r = bound01(r, 255);
49
+ g = bound01(g, 255);
50
+ b = bound01(b, 255);
51
+ var max = Math.max(r, g, b);
52
+ var min = Math.min(r, g, b);
53
+ var h = 0;
54
+ var v = max;
55
+ var d = max - min;
56
+ var s = max === 0 ? 0 : d / max;
57
+ if (max === min) {
58
+ h = 0;
59
+ } else {
60
+ switch (max) {
61
+ case r:
62
+ h = (g - b) / d + (g < b ? 6 : 0);
63
+ break;
64
+ case g:
65
+ h = (b - r) / d + 2;
66
+ break;
67
+ case b:
68
+ h = (r - g) / d + 4;
69
+ break;
70
+ }
71
+ h /= 6;
72
+ }
73
+ return { h, s, v };
74
+ }
75
+ function hsvToRgb(h, s, v) {
76
+ h = bound01(h, 360) * 6;
77
+ s = bound01(s, 100);
78
+ v = bound01(v, 100);
79
+ var i = Math.floor(h);
80
+ var f = h - i;
81
+ var p = v * (1 - s);
82
+ var q = v * (1 - f * s);
83
+ var t = v * (1 - (1 - f) * s);
84
+ var mod = i % 6;
85
+ var r = [v, q, p, p, t, v][mod];
86
+ var g = [t, v, v, q, p, p][mod];
87
+ var b = [p, p, t, v, v, q][mod];
88
+ return { r: r * 255, g: g * 255, b: b * 255 };
89
+ }
90
+ function rgbToHex(r, g, b, allow3Char) {
91
+ var hex = [
92
+ pad2(Math.round(r).toString(16)),
93
+ pad2(Math.round(g).toString(16)),
94
+ pad2(Math.round(b).toString(16))
95
+ ];
96
+ return hex.join("");
97
+ }
98
+ function convertHexToDecimal(h) {
99
+ return parseIntFromHex(h) / 255;
100
+ }
101
+ function parseIntFromHex(val) {
102
+ return parseInt(val, 16);
103
+ }
12
104
  export {
13
- InsertStyles
105
+ convertHexToDecimal,
106
+ hslToRgb,
107
+ hsvToRgb,
108
+ parseIntFromHex,
109
+ rgbToHex,
110
+ rgbToHsv,
111
+ rgbToRgb
14
112
  };