@unicom-cloud/ui 0.8.73 → 0.8.74
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/Affix.js +2 -2
- package/Alert.js +3 -3
- package/AutoComplete.js +2 -2
- package/BackTop.js +4 -4
- package/Badge.js +3 -3
- package/Breadcrumb.js +3 -3
- package/Button.js +2 -2
- package/Calendar.js +3 -3
- package/Card.js +2 -2
- package/Carousel.js +2 -2
- package/Cascader.js +1 -1
- package/Checkbox.js +1 -1
- package/Collapse.js +1 -1
- package/ColorPicker.js +2 -2
- package/Comment.js +2 -2
- package/ConfigProvider.js +1 -1
- package/Copy.js +3 -3
- package/DatePicker.js +1 -1
- package/Descriptions.js +2 -2
- package/Divider.js +2 -2
- package/Draggable.js +2 -2
- package/Dropdown.js +2 -2
- package/Empty.js +2 -2
- package/Icon.js +2 -2
- package/IconHover.js +2 -2
- package/Image.js +1 -1
- package/InputNumber.js +2 -2
- package/Layout.js +2 -2
- package/Link.js +2 -2
- package/List.js +2 -2
- package/Mentions.js +2 -2
- package/Menu.js +1 -1
- package/Message.js +4 -4
- package/Modal.js +1 -1
- package/Notice.js +2 -2
- package/Notification.js +4 -4
- package/OverflowEllipsis.js +2 -2
- package/PageHeader.js +2 -2
- package/Popconfirm.js +2 -2
- package/Popover.js +2 -2
- package/Progress.js +2 -2
- package/Radio.js +1 -1
- package/Rate.js +2 -2
- package/ResizeBox.js +2 -2
- package/Result.js +2 -2
- package/SelectView.js +1 -1
- package/Skeleton.js +2 -2
- package/Slider.js +2 -2
- package/Space.js +2 -2
- package/SpeechSynthesis.js +4 -4
- package/Spin.js +2 -2
- package/Statistic.js +3 -3
- package/Steps.js +2 -2
- package/Switch.js +4 -4
- package/Table.js +1 -1
- package/Tabs.js +1 -1
- package/Tag.js +2 -2
- package/Tooltip.js +3 -3
- package/Transfer.js +2 -2
- package/Tree.js +1 -1
- package/Trigger.js +3 -3
- package/affix/index.js +2 -2
- package/alert/index.js +9 -9
- package/anchor/Anchor.js +26 -26
- package/anchor/Link.js +2 -2
- package/anchor/util.js +1 -1
- package/auto-complete/index.js +2 -2
- package/avatar/Avatar.js +2 -2
- package/avatar/Group.js +2 -2
- package/back-top/index.js +11 -11
- package/badge/Count.js +7 -7
- package/badge/index.js +9 -9
- package/breadcrumb/Item.js +6 -6
- package/breadcrumb/index.js +3 -3
- package/button/Group.js +2 -2
- package/button/index.js +2 -2
- package/calendar/Month.js +2 -2
- package/calendar/Year.js +1 -1
- package/calendar/index.js +4 -4
- package/card/Grid.js +5 -5
- package/card/Meta.js +4 -4
- package/card/index.js +2 -2
- package/carousel/Arrow.js +2 -2
- package/carousel/Indicator.js +6 -6
- package/carousel/index.js +2 -2
- package/cascader/Cascader.js +3 -3
- package/cascader/index.js +1 -1
- package/cascader/util.js +1 -1
- package/checkbox/Checkbox.js +3 -3
- package/checkbox/Group.js +3 -3
- package/checkbox/index.js +1 -1
- package/chunk/{B0UZ1Ee2.js → 9we0Q8Kh.js} +3 -3
- package/chunk/{DJDOFlqC.js → BDZpJpz-.js} +2 -2
- package/chunk/BFmckYou.js +25 -0
- package/chunk/{Cj2SQJiO.js → BJ9_azwQ.js} +487 -487
- package/chunk/{7HDzVe32.js → Bd9zhOZS.js} +4 -4
- package/chunk/{uKZyjtff.js → BhBEMwvI.js} +21 -20
- package/chunk/{uH6uxyao.js → BoUHPeG7.js} +2 -2
- package/chunk/{Bj4EV0eG.js → BpYX5PN4.js} +1 -1
- package/chunk/{oHDWCJnz.js → Bu8A2l60.js} +3 -3
- package/chunk/CUFsOxJ2.js +10 -0
- package/chunk/CWjvjpyc.js +873 -0
- package/chunk/{Byd0ztYY.js → Crs3isAx.js} +4 -4
- package/chunk/{Ey4YJCkX.js → D0Dlbc2g.js} +2 -1
- package/chunk/{Dg0M2OmF.js → D5UfU6-H.js} +5 -5
- package/chunk/{UDX9U6M7.js → DJ8rDYjb.js} +3 -3
- package/chunk/{AwZqeapI.js → DRTWRsgI.js} +1 -1
- package/chunk/{D2LLXZQX.js → DdT3C0ih.js} +4 -4
- package/chunk/{DejjIa3N.js → Dn7KbmZ7.js} +35 -35
- package/chunk/{DpoumMDw.js → DohlrJ4S.js} +1 -1
- package/chunk/{B7hulkj9.js → NmSLBKjp.js} +2 -2
- package/chunk/{CiY7w1ZO.js → _L2dKF58.js} +3 -3
- package/chunk/{BJ1soa2K.js → uEGHykhe.js} +18 -18
- package/collapse/Collapse.js +3 -3
- package/collapse/Item.js +4 -4
- package/collapse/index.js +1 -1
- package/color-picker/ControlBar.js +2 -2
- package/color-picker/InputAlpha.js +1 -1
- package/color-picker/InputHex.js +2 -2
- package/color-picker/InputRgb.js +2 -2
- package/color-picker/Palette.js +2 -2
- package/color-picker/Panel.js +4 -4
- package/color-picker/colors.js +20 -9
- package/color-picker/index.js +20 -20
- package/color-picker/utils.js +1 -1
- package/comment/index.js +6 -6
- package/config-provider/ConfigProvider.js +2 -2
- package/config-provider/context.js +1 -1
- package/config-provider/index.js +2 -2
- package/copy/index.js +16 -16
- package/date-picker/Picker.js +2 -2
- package/date-picker/PickerRange.js +3 -3
- package/date-picker/index.js +1 -1
- package/descriptions/index.js +2 -2
- package/divider/index.js +5 -5
- package/draggable/Item.js +1 -1
- package/draggable/index.js +9 -9
- package/drawer/Drawer.js +3 -3
- package/dropdown/Button.js +1 -1
- package/dropdown/index.js +2 -2
- package/empty/index.js +2 -2
- package/form/Control.js +1 -1
- package/form/Form.js +2 -2
- package/form/FormItem.js +3 -3
- package/form/FormLabel.js +9 -9
- package/grid/Col.js +2 -2
- package/grid/Row.js +2 -2
- package/grid/grid-item.js +2 -2
- package/grid/grid.js +8 -8
- package/icon/index.js +11 -11
- package/icon-hover/index.js +2 -2
- package/image/Image.js +4 -4
- package/image/ImageFooter.js +2 -2
- package/image/ImagePreview.js +5 -5
- package/image/ImagePreviewArrow.js +4 -4
- package/image/ImagePreviewGroup.js +1 -1
- package/image/ImagePreviewToolbar.js +1 -1
- package/image/TriggerForToolbar.js +4 -4
- package/image/index.js +1 -1
- package/index.js +565 -575
- package/input/Group.js +4 -4
- package/input/Input.js +45 -45
- package/input/InputElement.js +2 -2
- package/input/Password.js +2 -2
- package/input/Search.js +2 -2
- package/input/Textarea.js +2 -2
- package/input-number/index.js +2 -2
- package/input-tag/InputTag.js +4 -4
- package/layout/Content.js +2 -2
- package/layout/Footer.js +5 -5
- package/layout/Header.js +4 -4
- package/layout/Sider.js +2 -2
- package/layout/index.js +2 -2
- package/link/index.js +5 -5
- package/list/Item.js +2 -2
- package/list/Meta.js +4 -4
- package/list/index.js +2 -2
- package/mentions/index.js +2 -2
- package/menu/Item.js +5 -5
- package/menu/ItemGroup.js +1 -1
- package/menu/Menu.js +3 -3
- package/menu/OverflowWrap.js +2 -2
- package/menu/index.js +2 -2
- package/message/index.js +4 -4
- package/message/useMessage.js +1 -1
- package/modal/Confirm.js +2 -2
- package/modal/Modal.js +4 -4
- package/modal/index.js +1 -1
- package/notice/index.js +2 -2
- package/notification/index.js +4 -4
- package/notification/useNotification.js +1 -1
- package/overflow-ellipsis/OverflowItem.js +6 -6
- package/overflow-ellipsis/index.js +8 -8
- package/package.json +1 -1
- package/page-header/index.js +2 -2
- package/pagination/PageItem.js +2 -2
- package/pagination/PageJumper.js +1 -1
- package/pagination/PageOption.js +1 -1
- package/pagination/Pagination.js +23 -23
- package/picker/Input.js +7 -7
- package/picker/InputRange.js +9 -9
- package/popconfirm/index.js +2 -2
- package/popover/index.js +2 -2
- package/progress/CircleProgress.js +7 -7
- package/progress/LineProgess.js +1 -1
- package/progress/StepProgress.js +7 -7
- package/progress/index.js +8 -8
- package/radio/Group.js +3 -3
- package/radio/Radio.js +3 -3
- package/radio/index.js +2 -2
- package/rate/index.js +2 -2
- package/resize-box/ResizeTrigger.js +10 -10
- package/resize-box/Split.js +12 -12
- package/resize-box/SplitGroup.js +2 -2
- package/resize-box/index.js +2 -2
- package/result/index.js +9 -9
- package/select/Option.js +2 -2
- package/select/Select.js +3 -3
- package/select-view/Core.js +27 -27
- package/select-view/index.js +1 -1
- package/skeleton/Image.js +4 -4
- package/skeleton/Text.js +7 -7
- package/skeleton/index.js +2 -2
- package/slider/Button.js +2 -2
- package/slider/Dot.js +5 -5
- package/slider/Input.js +12 -12
- package/slider/Tick.js +6 -6
- package/slider/index.js +2 -2
- package/space/index.js +12 -12
- package/speech-synthesis/index.js +4 -4
- package/spin/DotLoading.js +1 -1
- package/spin/index.js +2 -2
- package/statistic/Countdown.js +7 -7
- package/statistic/index.js +20 -20
- package/steps/Step.js +1 -1
- package/steps/index.js +2 -2
- package/style.css +1 -1
- package/switch/index.js +4 -4
- package/table/Table.js +4 -4
- package/table/index.js +4 -4
- package/tabs/Tab.js +3 -3
- package/tabs/TabContent.js +3 -3
- package/tabs/TabPane.js +2 -2
- package/tabs/index.js +2 -2
- package/tag/index.js +6 -6
- package/time-picker/Picker.js +2 -2
- package/time-picker/TimeColumn.js +7 -7
- package/time-picker/TimePicker.js +23 -23
- package/time-picker/util.js +5 -5
- package/timeline/Item.js +2 -2
- package/timeline/Timeline.js +2 -2
- package/tooltip/index.js +3 -3
- package/transfer/Item.js +3 -3
- package/transfer/List.js +3 -3
- package/transfer/index.js +2 -2
- package/tree/Animation.js +3 -3
- package/tree/Node.js +4 -4
- package/tree/NodeList.js +1 -1
- package/tree/Tree.js +3 -3
- package/tree/index.js +1 -1
- package/tree-select/Select.js +2 -2
- package/trigger/index.js +3 -3
- package/types/color-picker/colors.d.ts +1 -1
- package/types/utils/color.d.ts +1 -1
- package/typography/Base.js +2 -2
- package/typography/EditContent.js +1 -1
- package/typography/Ellipsis.js +14 -15
- package/typography/Paragraph.js +6 -6
- package/typography/Typography.js +5 -5
- package/typography/index.js +12 -13
- package/upload/TriggerNode.js +2 -2
- package/upload/Upload.js +5 -5
- package/upload/Uploader.js +2 -2
- package/utils/PqbCSSTransition.js +1 -1
- package/utils/className.js +3 -3
- package/utils/color.js +2 -116
- package/utils/contextHolder.js +1 -1
- package/utils/copy.js +4 -4
- package/utils/fileToURL.js +1 -1
- package/utils/index.js +299 -309
- package/utils/reactTransitionGroup.js +1 -1
- package/utils/saveAs.js +1 -1
- package/utils/tinycolor.js +12 -12
- package/utils/tween.js +1 -1
- package/verification-code/VerificationCode.js +7 -7
- package/version/index.js +1 -1
- package/watermark/Watermark.js +6 -6
- package/chunk/CCVU-Kst.js +0 -770
- package/chunk/CTxjmYmx.js +0 -19
- package/chunk/JPPo5nY_.js +0 -9
package/chunk/CCVU-Kst.js
DELETED
|
@@ -1,770 +0,0 @@
|
|
|
1
|
-
function f(r, e) {
|
|
2
|
-
C(r) && (r = "100%");
|
|
3
|
-
const t = W(r);
|
|
4
|
-
return r = e === 360 ? r : Math.min(e, Math.max(0, parseFloat(r))), t && (r = parseInt(String(r * e), 10) / 100), Math.abs(r - e) < 1e-6 ? 1 : (e === 360 ? r = (r < 0 ? r % e + e : r % e) / parseFloat(String(e)) : r = r % e / parseFloat(String(e)), r);
|
|
5
|
-
}
|
|
6
|
-
function p(r) {
|
|
7
|
-
return Math.min(1, Math.max(0, r));
|
|
8
|
-
}
|
|
9
|
-
function C(r) {
|
|
10
|
-
return typeof r == "string" && r.indexOf(".") !== -1 && parseFloat(r) === 1;
|
|
11
|
-
}
|
|
12
|
-
function W(r) {
|
|
13
|
-
return typeof r == "string" && r.indexOf("%") !== -1;
|
|
14
|
-
}
|
|
15
|
-
function N(r) {
|
|
16
|
-
return r = parseFloat(r), (isNaN(r) || r < 0 || r > 1) && (r = 1), r;
|
|
17
|
-
}
|
|
18
|
-
function y(r) {
|
|
19
|
-
return Number(r) <= 1 ? `${Number(r) * 100}%` : r;
|
|
20
|
-
}
|
|
21
|
-
function d(r) {
|
|
22
|
-
return r.length === 1 ? "0" + r : String(r);
|
|
23
|
-
}
|
|
24
|
-
function E(r, e, t) {
|
|
25
|
-
return {
|
|
26
|
-
r: f(r, 255) * 255,
|
|
27
|
-
g: f(e, 255) * 255,
|
|
28
|
-
b: f(t, 255) * 255
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function A(r, e, t) {
|
|
32
|
-
r = f(r, 255), e = f(e, 255), t = f(t, 255);
|
|
33
|
-
const a = Math.max(r, e, t), s = Math.min(r, e, t);
|
|
34
|
-
let n = 0, i = 0;
|
|
35
|
-
const h = (a + s) / 2;
|
|
36
|
-
if (a === s)
|
|
37
|
-
i = 0, n = 0;
|
|
38
|
-
else {
|
|
39
|
-
const u = a - s;
|
|
40
|
-
switch (i = h > 0.5 ? u / (2 - a - s) : u / (a + s), a) {
|
|
41
|
-
case r:
|
|
42
|
-
n = (e - t) / u + (e < t ? 6 : 0);
|
|
43
|
-
break;
|
|
44
|
-
case e:
|
|
45
|
-
n = (t - r) / u + 2;
|
|
46
|
-
break;
|
|
47
|
-
case t:
|
|
48
|
-
n = (r - e) / u + 4;
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
n /= 6;
|
|
52
|
-
}
|
|
53
|
-
return { h: n, s: i, l: h };
|
|
54
|
-
}
|
|
55
|
-
function w(r, e, t) {
|
|
56
|
-
return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? r + (e - r) * (6 * t) : t < 1 / 2 ? e : t < 2 / 3 ? r + (e - r) * (2 / 3 - t) * 6 : r;
|
|
57
|
-
}
|
|
58
|
-
function I(r, e, t) {
|
|
59
|
-
let a, s, n;
|
|
60
|
-
if (r = f(r, 360), e = f(e, 100), t = f(t, 100), e === 0)
|
|
61
|
-
s = t, n = t, a = t;
|
|
62
|
-
else {
|
|
63
|
-
const i = t < 0.5 ? t * (1 + e) : t + e - t * e, h = 2 * t - i;
|
|
64
|
-
a = w(h, i, r + 1 / 3), s = w(h, i, r), n = w(h, i, r - 1 / 3);
|
|
65
|
-
}
|
|
66
|
-
return { r: a * 255, g: s * 255, b: n * 255 };
|
|
67
|
-
}
|
|
68
|
-
function $(r, e, t) {
|
|
69
|
-
r = f(r, 255), e = f(e, 255), t = f(t, 255);
|
|
70
|
-
const a = Math.max(r, e, t), s = Math.min(r, e, t);
|
|
71
|
-
let n = 0;
|
|
72
|
-
const i = a, h = a - s, u = a === 0 ? 0 : h / a;
|
|
73
|
-
if (a === s)
|
|
74
|
-
n = 0;
|
|
75
|
-
else {
|
|
76
|
-
switch (a) {
|
|
77
|
-
case r:
|
|
78
|
-
n = (e - t) / h + (e < t ? 6 : 0);
|
|
79
|
-
break;
|
|
80
|
-
case e:
|
|
81
|
-
n = (t - r) / h + 2;
|
|
82
|
-
break;
|
|
83
|
-
case t:
|
|
84
|
-
n = (r - e) / h + 4;
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
n /= 6;
|
|
88
|
-
}
|
|
89
|
-
return { h: n, s: u, v: i };
|
|
90
|
-
}
|
|
91
|
-
function O(r, e, t) {
|
|
92
|
-
r = f(r, 360) * 6, e = f(e, 100), t = f(t, 100);
|
|
93
|
-
const a = Math.floor(r), s = r - a, n = t * (1 - e), i = t * (1 - s * e), h = t * (1 - (1 - s) * e), u = a % 6, x = [t, i, n, n, h, t][u], k = [h, t, t, i, n, n][u], j = [n, n, h, t, t, i][u];
|
|
94
|
-
return { r: x * 255, g: k * 255, b: j * 255 };
|
|
95
|
-
}
|
|
96
|
-
function H(r, e, t, a) {
|
|
97
|
-
const s = [
|
|
98
|
-
d(Math.round(r).toString(16)),
|
|
99
|
-
d(Math.round(e).toString(16)),
|
|
100
|
-
d(Math.round(t).toString(16))
|
|
101
|
-
];
|
|
102
|
-
return a && s[0].startsWith(s[0].charAt(1)) && s[1].startsWith(s[1].charAt(1)) && s[2].startsWith(s[2].charAt(1)) ? s[0].charAt(0) + s[1].charAt(0) + s[2].charAt(0) : s.join("");
|
|
103
|
-
}
|
|
104
|
-
function T(r, e, t, a, s) {
|
|
105
|
-
const n = [
|
|
106
|
-
d(Math.round(r).toString(16)),
|
|
107
|
-
d(Math.round(e).toString(16)),
|
|
108
|
-
d(Math.round(t).toString(16)),
|
|
109
|
-
d(q(a))
|
|
110
|
-
];
|
|
111
|
-
return s && n[0].startsWith(n[0].charAt(1)) && n[1].startsWith(n[1].charAt(1)) && n[2].startsWith(n[2].charAt(1)) && n[3].startsWith(n[3].charAt(1)) ? n[0].charAt(0) + n[1].charAt(0) + n[2].charAt(0) + n[3].charAt(0) : n.join("");
|
|
112
|
-
}
|
|
113
|
-
function J(r, e, t, a) {
|
|
114
|
-
return [
|
|
115
|
-
d(q(a)),
|
|
116
|
-
d(Math.round(r).toString(16)),
|
|
117
|
-
d(Math.round(e).toString(16)),
|
|
118
|
-
d(Math.round(t).toString(16))
|
|
119
|
-
].join("");
|
|
120
|
-
}
|
|
121
|
-
function P(r, e, t, a) {
|
|
122
|
-
const s = r / 100, n = e / 100, i = t / 100, h = a / 100, u = 255 * (1 - s) * (1 - h), x = 255 * (1 - n) * (1 - h), k = 255 * (1 - i) * (1 - h);
|
|
123
|
-
return { r: u, g: x, b: k };
|
|
124
|
-
}
|
|
125
|
-
function R(r, e, t) {
|
|
126
|
-
let a = 1 - r / 255, s = 1 - e / 255, n = 1 - t / 255, i = Math.min(a, s, n);
|
|
127
|
-
return i === 1 ? (a = 0, s = 0, n = 0) : (a = (a - i) / (1 - i) * 100, s = (s - i) / (1 - i) * 100, n = (n - i) / (1 - i) * 100), i *= 100, {
|
|
128
|
-
c: Math.round(a),
|
|
129
|
-
m: Math.round(s),
|
|
130
|
-
y: Math.round(n),
|
|
131
|
-
k: Math.round(i)
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
function q(r) {
|
|
135
|
-
return Math.round(parseFloat(r) * 255).toString(16);
|
|
136
|
-
}
|
|
137
|
-
function F(r) {
|
|
138
|
-
return l(r) / 255;
|
|
139
|
-
}
|
|
140
|
-
function l(r) {
|
|
141
|
-
return parseInt(r, 16);
|
|
142
|
-
}
|
|
143
|
-
function B(r) {
|
|
144
|
-
return {
|
|
145
|
-
r: r >> 16,
|
|
146
|
-
g: (r & 65280) >> 8,
|
|
147
|
-
b: r & 255
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
const v = {
|
|
151
|
-
aliceblue: "#f0f8ff",
|
|
152
|
-
antiquewhite: "#faebd7",
|
|
153
|
-
aqua: "#00ffff",
|
|
154
|
-
aquamarine: "#7fffd4",
|
|
155
|
-
azure: "#f0ffff",
|
|
156
|
-
beige: "#f5f5dc",
|
|
157
|
-
bisque: "#ffe4c4",
|
|
158
|
-
black: "#000000",
|
|
159
|
-
blanchedalmond: "#ffebcd",
|
|
160
|
-
blue: "#0000ff",
|
|
161
|
-
blueviolet: "#8a2be2",
|
|
162
|
-
brown: "#a52a2a",
|
|
163
|
-
burlywood: "#deb887",
|
|
164
|
-
cadetblue: "#5f9ea0",
|
|
165
|
-
chartreuse: "#7fff00",
|
|
166
|
-
chocolate: "#d2691e",
|
|
167
|
-
coral: "#ff7f50",
|
|
168
|
-
cornflowerblue: "#6495ed",
|
|
169
|
-
cornsilk: "#fff8dc",
|
|
170
|
-
crimson: "#dc143c",
|
|
171
|
-
cyan: "#00ffff",
|
|
172
|
-
darkblue: "#00008b",
|
|
173
|
-
darkcyan: "#008b8b",
|
|
174
|
-
darkgoldenrod: "#b8860b",
|
|
175
|
-
darkgray: "#a9a9a9",
|
|
176
|
-
darkgreen: "#006400",
|
|
177
|
-
darkgrey: "#a9a9a9",
|
|
178
|
-
darkkhaki: "#bdb76b",
|
|
179
|
-
darkmagenta: "#8b008b",
|
|
180
|
-
darkolivegreen: "#556b2f",
|
|
181
|
-
darkorange: "#ff8c00",
|
|
182
|
-
darkorchid: "#9932cc",
|
|
183
|
-
darkred: "#8b0000",
|
|
184
|
-
darksalmon: "#e9967a",
|
|
185
|
-
darkseagreen: "#8fbc8f",
|
|
186
|
-
darkslateblue: "#483d8b",
|
|
187
|
-
darkslategray: "#2f4f4f",
|
|
188
|
-
darkslategrey: "#2f4f4f",
|
|
189
|
-
darkturquoise: "#00ced1",
|
|
190
|
-
darkviolet: "#9400d3",
|
|
191
|
-
deeppink: "#ff1493",
|
|
192
|
-
deepskyblue: "#00bfff",
|
|
193
|
-
dimgray: "#696969",
|
|
194
|
-
dimgrey: "#696969",
|
|
195
|
-
dodgerblue: "#1e90ff",
|
|
196
|
-
firebrick: "#b22222",
|
|
197
|
-
floralwhite: "#fffaf0",
|
|
198
|
-
forestgreen: "#228b22",
|
|
199
|
-
fuchsia: "#ff00ff",
|
|
200
|
-
gainsboro: "#dcdcdc",
|
|
201
|
-
ghostwhite: "#f8f8ff",
|
|
202
|
-
goldenrod: "#daa520",
|
|
203
|
-
gold: "#ffd700",
|
|
204
|
-
gray: "#808080",
|
|
205
|
-
green: "#008000",
|
|
206
|
-
greenyellow: "#adff2f",
|
|
207
|
-
grey: "#808080",
|
|
208
|
-
honeydew: "#f0fff0",
|
|
209
|
-
hotpink: "#ff69b4",
|
|
210
|
-
indianred: "#cd5c5c",
|
|
211
|
-
indigo: "#4b0082",
|
|
212
|
-
ivory: "#fffff0",
|
|
213
|
-
khaki: "#f0e68c",
|
|
214
|
-
lavenderblush: "#fff0f5",
|
|
215
|
-
lavender: "#e6e6fa",
|
|
216
|
-
lawngreen: "#7cfc00",
|
|
217
|
-
lemonchiffon: "#fffacd",
|
|
218
|
-
lightblue: "#add8e6",
|
|
219
|
-
lightcoral: "#f08080",
|
|
220
|
-
lightcyan: "#e0ffff",
|
|
221
|
-
lightgoldenrodyellow: "#fafad2",
|
|
222
|
-
lightgray: "#d3d3d3",
|
|
223
|
-
lightgreen: "#90ee90",
|
|
224
|
-
lightgrey: "#d3d3d3",
|
|
225
|
-
lightpink: "#ffb6c1",
|
|
226
|
-
lightsalmon: "#ffa07a",
|
|
227
|
-
lightseagreen: "#20b2aa",
|
|
228
|
-
lightskyblue: "#87cefa",
|
|
229
|
-
lightslategray: "#778899",
|
|
230
|
-
lightslategrey: "#778899",
|
|
231
|
-
lightsteelblue: "#b0c4de",
|
|
232
|
-
lightyellow: "#ffffe0",
|
|
233
|
-
lime: "#00ff00",
|
|
234
|
-
limegreen: "#32cd32",
|
|
235
|
-
linen: "#faf0e6",
|
|
236
|
-
magenta: "#ff00ff",
|
|
237
|
-
maroon: "#800000",
|
|
238
|
-
mediumaquamarine: "#66cdaa",
|
|
239
|
-
mediumblue: "#0000cd",
|
|
240
|
-
mediumorchid: "#ba55d3",
|
|
241
|
-
mediumpurple: "#9370db",
|
|
242
|
-
mediumseagreen: "#3cb371",
|
|
243
|
-
mediumslateblue: "#7b68ee",
|
|
244
|
-
mediumspringgreen: "#00fa9a",
|
|
245
|
-
mediumturquoise: "#48d1cc",
|
|
246
|
-
mediumvioletred: "#c71585",
|
|
247
|
-
midnightblue: "#191970",
|
|
248
|
-
mintcream: "#f5fffa",
|
|
249
|
-
mistyrose: "#ffe4e1",
|
|
250
|
-
moccasin: "#ffe4b5",
|
|
251
|
-
navajowhite: "#ffdead",
|
|
252
|
-
navy: "#000080",
|
|
253
|
-
oldlace: "#fdf5e6",
|
|
254
|
-
olive: "#808000",
|
|
255
|
-
olivedrab: "#6b8e23",
|
|
256
|
-
orange: "#ffa500",
|
|
257
|
-
orangered: "#ff4500",
|
|
258
|
-
orchid: "#da70d6",
|
|
259
|
-
palegoldenrod: "#eee8aa",
|
|
260
|
-
palegreen: "#98fb98",
|
|
261
|
-
paleturquoise: "#afeeee",
|
|
262
|
-
palevioletred: "#db7093",
|
|
263
|
-
papayawhip: "#ffefd5",
|
|
264
|
-
peachpuff: "#ffdab9",
|
|
265
|
-
peru: "#cd853f",
|
|
266
|
-
pink: "#ffc0cb",
|
|
267
|
-
plum: "#dda0dd",
|
|
268
|
-
powderblue: "#b0e0e6",
|
|
269
|
-
purple: "#800080",
|
|
270
|
-
rebeccapurple: "#663399",
|
|
271
|
-
red: "#ff0000",
|
|
272
|
-
rosybrown: "#bc8f8f",
|
|
273
|
-
royalblue: "#4169e1",
|
|
274
|
-
saddlebrown: "#8b4513",
|
|
275
|
-
salmon: "#fa8072",
|
|
276
|
-
sandybrown: "#f4a460",
|
|
277
|
-
seagreen: "#2e8b57",
|
|
278
|
-
seashell: "#fff5ee",
|
|
279
|
-
sienna: "#a0522d",
|
|
280
|
-
silver: "#c0c0c0",
|
|
281
|
-
skyblue: "#87ceeb",
|
|
282
|
-
slateblue: "#6a5acd",
|
|
283
|
-
slategray: "#708090",
|
|
284
|
-
slategrey: "#708090",
|
|
285
|
-
snow: "#fffafa",
|
|
286
|
-
springgreen: "#00ff7f",
|
|
287
|
-
steelblue: "#4682b4",
|
|
288
|
-
tan: "#d2b48c",
|
|
289
|
-
teal: "#008080",
|
|
290
|
-
thistle: "#d8bfd8",
|
|
291
|
-
tomato: "#ff6347",
|
|
292
|
-
turquoise: "#40e0d0",
|
|
293
|
-
violet: "#ee82ee",
|
|
294
|
-
wheat: "#f5deb3",
|
|
295
|
-
white: "#ffffff",
|
|
296
|
-
whitesmoke: "#f5f5f5",
|
|
297
|
-
yellow: "#ffff00",
|
|
298
|
-
yellowgreen: "#9acd32"
|
|
299
|
-
};
|
|
300
|
-
function L(r) {
|
|
301
|
-
let e = { r: 0, g: 0, b: 0 }, t = 1, a = null, s = null, n = null, i = !1, h = !1;
|
|
302
|
-
return typeof r == "string" && (r = U(r)), typeof r == "object" && (g(r.r) && g(r.g) && g(r.b) ? (e = E(r.r, r.g, r.b), i = !0, h = String(r.r).slice(-1) === "%" ? "prgb" : "rgb") : g(r.h) && g(r.s) && g(r.v) ? (a = y(r.s), s = y(r.v), e = O(r.h, a, s), i = !0, h = "hsv") : g(r.h) && g(r.s) && g(r.l) ? (a = y(r.s), n = y(r.l), e = I(r.h, a, n), i = !0, h = "hsl") : g(r.c) && g(r.m) && g(r.y) && g(r.k) && (e = P(r.c, r.m, r.y, r.k), i = !0, h = "cmyk"), Object.prototype.hasOwnProperty.call(r, "a") && (t = r.a)), t = N(t), {
|
|
303
|
-
ok: i,
|
|
304
|
-
format: r.format || h,
|
|
305
|
-
r: Math.min(255, Math.max(e.r, 0)),
|
|
306
|
-
g: Math.min(255, Math.max(e.g, 0)),
|
|
307
|
-
b: Math.min(255, Math.max(e.b, 0)),
|
|
308
|
-
a: t
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
const V = "[-\\+]?\\d+%?", D = "[-\\+]?\\d*\\.\\d+%?", m = "(?:" + D + ")|(?:" + V + ")", S = "[\\s|\\(]+(" + m + ")[,|\\s]+(" + m + ")[,|\\s]+(" + m + ")\\s*\\)?", M = (
|
|
312
|
-
// eslint-disable-next-line prettier/prettier
|
|
313
|
-
"[\\s|\\(]+(" + m + ")[,|\\s]+(" + m + ")[,|\\s]+(" + m + ")[,|\\s]+(" + m + ")\\s*\\)?"
|
|
314
|
-
), c = {
|
|
315
|
-
CSS_UNIT: new RegExp(m),
|
|
316
|
-
rgb: new RegExp("rgb" + S),
|
|
317
|
-
rgba: new RegExp("rgba" + M),
|
|
318
|
-
hsl: new RegExp("hsl" + S),
|
|
319
|
-
hsla: new RegExp("hsla" + M),
|
|
320
|
-
hsv: new RegExp("hsv" + S),
|
|
321
|
-
hsva: new RegExp("hsva" + M),
|
|
322
|
-
cmyk: new RegExp("cmyk" + M),
|
|
323
|
-
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
324
|
-
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
325
|
-
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
326
|
-
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
327
|
-
};
|
|
328
|
-
function U(r) {
|
|
329
|
-
if (r = r.trim().toLowerCase(), r.length === 0)
|
|
330
|
-
return !1;
|
|
331
|
-
let e = !1;
|
|
332
|
-
if (v[r])
|
|
333
|
-
r = v[r], e = !0;
|
|
334
|
-
else if (r === "transparent")
|
|
335
|
-
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
|
336
|
-
let t = c.rgb.exec(r);
|
|
337
|
-
return t ? { r: t[1], g: t[2], b: t[3] } : (t = c.rgba.exec(r), t ? { r: t[1], g: t[2], b: t[3], a: t[4] } : (t = c.hsl.exec(r), t ? { h: t[1], s: t[2], l: t[3] } : (t = c.hsla.exec(r), t ? { h: t[1], s: t[2], l: t[3], a: t[4] } : (t = c.hsv.exec(r), t ? { h: t[1], s: t[2], v: t[3] } : (t = c.hsva.exec(r), t ? { h: t[1], s: t[2], v: t[3], a: t[4] } : (t = c.cmyk.exec(r), t ? {
|
|
338
|
-
c: t[1],
|
|
339
|
-
m: t[2],
|
|
340
|
-
y: t[3],
|
|
341
|
-
k: t[4]
|
|
342
|
-
} : (t = c.hex8.exec(r), t ? {
|
|
343
|
-
r: l(t[1]),
|
|
344
|
-
g: l(t[2]),
|
|
345
|
-
b: l(t[3]),
|
|
346
|
-
a: F(t[4]),
|
|
347
|
-
format: e ? "name" : "hex8"
|
|
348
|
-
} : (t = c.hex6.exec(r), t ? {
|
|
349
|
-
r: l(t[1]),
|
|
350
|
-
g: l(t[2]),
|
|
351
|
-
b: l(t[3]),
|
|
352
|
-
format: e ? "name" : "hex"
|
|
353
|
-
} : (t = c.hex4.exec(r), t ? {
|
|
354
|
-
r: l(t[1] + t[1]),
|
|
355
|
-
g: l(t[2] + t[2]),
|
|
356
|
-
b: l(t[3] + t[3]),
|
|
357
|
-
a: F(t[4] + t[4]),
|
|
358
|
-
format: e ? "name" : "hex8"
|
|
359
|
-
} : (t = c.hex3.exec(r), t ? {
|
|
360
|
-
r: l(t[1] + t[1]),
|
|
361
|
-
g: l(t[2] + t[2]),
|
|
362
|
-
b: l(t[3] + t[3]),
|
|
363
|
-
format: e ? "name" : "hex"
|
|
364
|
-
} : !1))))))))));
|
|
365
|
-
}
|
|
366
|
-
function g(r) {
|
|
367
|
-
return typeof r == "number" ? !Number.isNaN(r) : c.CSS_UNIT.test(r);
|
|
368
|
-
}
|
|
369
|
-
var z = Object.defineProperty, G = (r, e, t) => e in r ? z(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, b = (r, e, t) => G(r, typeof e != "symbol" ? e + "" : e, t);
|
|
370
|
-
class o {
|
|
371
|
-
constructor(e = "", t = {}) {
|
|
372
|
-
if (b(this, "r"), b(this, "g"), b(this, "b"), b(this, "a"), b(this, "format"), b(this, "originalInput"), b(this, "isValid"), b(this, "gradientType"), b(this, "roundA"), e instanceof o)
|
|
373
|
-
return e;
|
|
374
|
-
typeof e == "number" && (e = B(e)), this.originalInput = e;
|
|
375
|
-
const a = L(e);
|
|
376
|
-
this.originalInput = e, this.r = a.r, this.g = a.g, this.b = a.b, this.a = a.a, this.roundA = Math.round(100 * this.a) / 100, this.format = t.format ?? a.format, this.gradientType = t.gradientType, this.r < 1 && (this.r = Math.round(this.r)), this.g < 1 && (this.g = Math.round(this.g)), this.b < 1 && (this.b = Math.round(this.b)), this.isValid = a.ok;
|
|
377
|
-
}
|
|
378
|
-
get ok() {
|
|
379
|
-
return this.isValid;
|
|
380
|
-
}
|
|
381
|
-
isDark() {
|
|
382
|
-
return this.getBrightness() < 128;
|
|
383
|
-
}
|
|
384
|
-
isLight() {
|
|
385
|
-
return !this.isDark();
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Returns the perceived brightness of the color, from 0-255.
|
|
389
|
-
*/
|
|
390
|
-
getBrightness() {
|
|
391
|
-
const e = this.toRgb();
|
|
392
|
-
return (e.r * 299 + e.g * 587 + e.b * 114) / 1e3;
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* Returns the perceived luminance of a color, from 0-1.
|
|
396
|
-
*/
|
|
397
|
-
getLuminance() {
|
|
398
|
-
const e = this.toRgb();
|
|
399
|
-
let t, a, s;
|
|
400
|
-
const n = e.r / 255, i = e.g / 255, h = e.b / 255;
|
|
401
|
-
return n <= 0.03928 ? t = n / 12.92 : t = Math.pow((n + 0.055) / 1.055, 2.4), i <= 0.03928 ? a = i / 12.92 : a = Math.pow((i + 0.055) / 1.055, 2.4), h <= 0.03928 ? s = h / 12.92 : s = Math.pow((h + 0.055) / 1.055, 2.4), 0.2126 * t + 0.7152 * a + 0.0722 * s;
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Returns the alpha value of a color, from 0-1.
|
|
405
|
-
*/
|
|
406
|
-
getAlpha() {
|
|
407
|
-
return this.a;
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Sets the alpha value on the current color.
|
|
411
|
-
*
|
|
412
|
-
* @param alpha - The new alpha value. The accepted range is 0-1.
|
|
413
|
-
*/
|
|
414
|
-
setAlpha(e) {
|
|
415
|
-
return this.a = N(e), this.roundA = Math.round(100 * this.a) / 100, this;
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Returns whether the color is monochrome.
|
|
419
|
-
*/
|
|
420
|
-
isMonochrome() {
|
|
421
|
-
const { s: e } = this.toHsl();
|
|
422
|
-
return e === 0;
|
|
423
|
-
}
|
|
424
|
-
/**
|
|
425
|
-
* Returns the object as a HSVA object.
|
|
426
|
-
*/
|
|
427
|
-
toHsv() {
|
|
428
|
-
const e = $(this.r, this.g, this.b);
|
|
429
|
-
return { h: e.h * 360, s: e.s, v: e.v, a: this.a };
|
|
430
|
-
}
|
|
431
|
-
toHsv_() {
|
|
432
|
-
const e = $(this.r, this.g, this.b);
|
|
433
|
-
return { h: e.h, s: e.s, v: e.v, a: this.a };
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Returns the hsva values interpolated into a string with the following format:
|
|
437
|
-
* "hsva(xxx, xxx, xxx, xx)".
|
|
438
|
-
*/
|
|
439
|
-
toHsvString() {
|
|
440
|
-
const e = $(this.r, this.g, this.b), t = Math.round(e.h * 360), a = Math.round(e.s * 100), s = Math.round(e.v * 100);
|
|
441
|
-
return this.a === 1 ? `hsv(${t}, ${a}%, ${s}%)` : `hsva(${t}, ${a}%, ${s}%, ${this.roundA})`;
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Returns the object as a HSLA object.
|
|
445
|
-
*/
|
|
446
|
-
toHsl() {
|
|
447
|
-
const e = A(this.r, this.g, this.b);
|
|
448
|
-
return { h: e.h * 360, s: e.s, l: e.l, a: this.a };
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Returns the hsla values interpolated into a string with the following format:
|
|
452
|
-
* "hsla(xxx, xxx, xxx, xx)".
|
|
453
|
-
*/
|
|
454
|
-
toHslString() {
|
|
455
|
-
const e = A(this.r, this.g, this.b), t = Math.round(e.h * 360), a = Math.round(e.s * 100), s = Math.round(e.l * 100);
|
|
456
|
-
return this.a === 1 ? `hsl(${t}, ${a}%, ${s}%)` : `hsla(${t}, ${a}%, ${s}%, ${this.roundA})`;
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* Returns the hex value of the color.
|
|
460
|
-
* @param allow3Char will shorten hex value to 3 char if possible
|
|
461
|
-
*/
|
|
462
|
-
toHex(e = !1) {
|
|
463
|
-
return H(this.r, this.g, this.b, e);
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* Returns the hex value of the color -with a # prefixed.
|
|
467
|
-
* @param allow3Char will shorten hex value to 3 char if possible
|
|
468
|
-
*/
|
|
469
|
-
toHexString(e = !1) {
|
|
470
|
-
return `#${this.toHex(e)}`;
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* Returns the hex 8 value of the color.
|
|
474
|
-
* @param allow4Char will shorten hex value to 4 char if possible
|
|
475
|
-
*/
|
|
476
|
-
toHex8(e = !1) {
|
|
477
|
-
return T(this.r, this.g, this.b, this.a, e);
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* Returns the hex 8 value of the color -with a # prefixed.
|
|
481
|
-
* @param allow4Char will shorten hex value to 4 char if possible
|
|
482
|
-
*/
|
|
483
|
-
toHex8String(e = !1) {
|
|
484
|
-
return `#${this.toHex8(e)}`;
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* Returns the shorter hex value of the color depends on its alpha -with a # prefixed.
|
|
488
|
-
* @param allowShortChar will shorten hex value to 3 or 4 char if possible
|
|
489
|
-
*/
|
|
490
|
-
toHexShortString(e = !1) {
|
|
491
|
-
return this.a === 1 ? this.toHexString(e) : this.toHex8String(e);
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Returns the object as a RGBA object.
|
|
495
|
-
*/
|
|
496
|
-
toRgb() {
|
|
497
|
-
return {
|
|
498
|
-
r: Math.round(this.r),
|
|
499
|
-
g: Math.round(this.g),
|
|
500
|
-
b: Math.round(this.b),
|
|
501
|
-
a: this.a
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
toRgba() {
|
|
505
|
-
return this.toRgb();
|
|
506
|
-
}
|
|
507
|
-
toRgbArray() {
|
|
508
|
-
const e = this.toRgb();
|
|
509
|
-
return [e.r, e.g, e.b];
|
|
510
|
-
}
|
|
511
|
-
toRgbArrayString() {
|
|
512
|
-
const e = this.toRgb();
|
|
513
|
-
return `${e.r},${e.g},${e.b}`;
|
|
514
|
-
}
|
|
515
|
-
/**
|
|
516
|
-
* Returns the RGBA values interpolated into a string with the following format:
|
|
517
|
-
* "RGBA(xxx, xxx, xxx, xx)".
|
|
518
|
-
*/
|
|
519
|
-
toRgbString() {
|
|
520
|
-
const e = Math.round(this.r), t = Math.round(this.g), a = Math.round(this.b);
|
|
521
|
-
return this.a === 1 ? `rgb(${e}, ${t}, ${a})` : `rgba(${e}, ${t}, ${a}, ${this.roundA})`;
|
|
522
|
-
}
|
|
523
|
-
toRgbaString() {
|
|
524
|
-
const e = Math.round(this.r), t = Math.round(this.g), a = Math.round(this.b);
|
|
525
|
-
return `rgba(${e}, ${t}, ${a}, ${this.roundA})`;
|
|
526
|
-
}
|
|
527
|
-
/**
|
|
528
|
-
* Returns the object as a RGBA object.
|
|
529
|
-
*/
|
|
530
|
-
toPercentageRgb() {
|
|
531
|
-
const e = (t) => `${Math.round(f(t, 255) * 100)}%`;
|
|
532
|
-
return {
|
|
533
|
-
r: e(this.r),
|
|
534
|
-
g: e(this.g),
|
|
535
|
-
b: e(this.b),
|
|
536
|
-
a: this.a
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
/**
|
|
540
|
-
* Returns the RGBA relative values interpolated into a string
|
|
541
|
-
*/
|
|
542
|
-
toPercentageRgbString() {
|
|
543
|
-
const e = (t) => Math.round(f(t, 255) * 100);
|
|
544
|
-
return this.a === 1 ? `rgb(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%)` : `rgba(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%, ${this.roundA})`;
|
|
545
|
-
}
|
|
546
|
-
toCmyk() {
|
|
547
|
-
return {
|
|
548
|
-
...R(this.r, this.g, this.b)
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
toCmykString() {
|
|
552
|
-
const { c: e, m: t, y: a, k: s } = R(this.r, this.g, this.b);
|
|
553
|
-
return `cmyk(${e}, ${t}, ${a}, ${s})`;
|
|
554
|
-
}
|
|
555
|
-
/**
|
|
556
|
-
* The 'real' name of the color -if there is one.
|
|
557
|
-
*/
|
|
558
|
-
toName() {
|
|
559
|
-
if (this.a === 0)
|
|
560
|
-
return "transparent";
|
|
561
|
-
if (this.a < 1)
|
|
562
|
-
return !1;
|
|
563
|
-
const e = `#${H(this.r, this.g, this.b, !1)}`;
|
|
564
|
-
for (const [t, a] of Object.entries(v))
|
|
565
|
-
if (e === a)
|
|
566
|
-
return t;
|
|
567
|
-
return !1;
|
|
568
|
-
}
|
|
569
|
-
toString(e) {
|
|
570
|
-
const t = !!e;
|
|
571
|
-
e = e ?? this.format;
|
|
572
|
-
let a = !1;
|
|
573
|
-
const s = this.a < 1 && this.a >= 0;
|
|
574
|
-
return !t && s && (e.startsWith("hex") || e === "name") ? e === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (e === "rgb" && (a = this.toRgbString()), e === "prgb" && (a = this.toPercentageRgbString()), (e === "hex" || e === "hex6") && (a = this.toHexString()), e === "hex3" && (a = this.toHexString(!0)), e === "hex4" && (a = this.toHex8String(!0)), e === "hex8" && (a = this.toHex8String()), e === "name" && (a = this.toName()), e === "hsl" && (a = this.toHslString()), e === "hsv" && (a = this.toHsvString()), e === "cmyk" && (a = this.toCmykString()), a || this.toHexString());
|
|
575
|
-
}
|
|
576
|
-
toNumber() {
|
|
577
|
-
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
|
|
578
|
-
}
|
|
579
|
-
clone() {
|
|
580
|
-
return new o(this.toString());
|
|
581
|
-
}
|
|
582
|
-
/**
|
|
583
|
-
* Lighten the color a given amount. Providing 100 will always return white.
|
|
584
|
-
* @param amount - valid between 1-100
|
|
585
|
-
*/
|
|
586
|
-
lighten(e = 10) {
|
|
587
|
-
const t = this.toHsl();
|
|
588
|
-
return t.l += e / 100, t.l = p(t.l), new o(t);
|
|
589
|
-
}
|
|
590
|
-
/**
|
|
591
|
-
* Brighten the color a given amount, from 0 to 100.
|
|
592
|
-
* @param amount - valid between 1-100
|
|
593
|
-
*/
|
|
594
|
-
brighten(e = 10) {
|
|
595
|
-
const t = this.toRgb();
|
|
596
|
-
return t.r = Math.max(
|
|
597
|
-
0,
|
|
598
|
-
Math.min(255, t.r - Math.round(255 * -(e / 100)))
|
|
599
|
-
), t.g = Math.max(
|
|
600
|
-
0,
|
|
601
|
-
Math.min(255, t.g - Math.round(255 * -(e / 100)))
|
|
602
|
-
), t.b = Math.max(
|
|
603
|
-
0,
|
|
604
|
-
Math.min(255, t.b - Math.round(255 * -(e / 100)))
|
|
605
|
-
), new o(t);
|
|
606
|
-
}
|
|
607
|
-
/**
|
|
608
|
-
* Darken the color a given amount, from 0 to 100.
|
|
609
|
-
* Providing 100 will always return black.
|
|
610
|
-
* @param amount - valid between 1-100
|
|
611
|
-
*/
|
|
612
|
-
darken(e = 10) {
|
|
613
|
-
const t = this.toHsl();
|
|
614
|
-
return t.l -= e / 100, t.l = p(t.l), new o(t);
|
|
615
|
-
}
|
|
616
|
-
/**
|
|
617
|
-
* Mix the color with pure white, from 0 to 100.
|
|
618
|
-
* Providing 0 will do nothing, providing 100 will always return white.
|
|
619
|
-
* @param amount - valid between 1-100
|
|
620
|
-
*/
|
|
621
|
-
tint(e = 10) {
|
|
622
|
-
return this.mix("white", e);
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* Mix the color with pure black, from 0 to 100.
|
|
626
|
-
* Providing 0 will do nothing, providing 100 will always return black.
|
|
627
|
-
* @param amount - valid between 1-100
|
|
628
|
-
*/
|
|
629
|
-
shade(e = 10) {
|
|
630
|
-
return this.mix("black", e);
|
|
631
|
-
}
|
|
632
|
-
/**
|
|
633
|
-
* Desaturate the color a given amount, from 0 to 100.
|
|
634
|
-
* Providing 100 will is the same as calling greyscale
|
|
635
|
-
* @param amount - valid between 1-100
|
|
636
|
-
*/
|
|
637
|
-
desaturate(e = 10) {
|
|
638
|
-
const t = this.toHsl();
|
|
639
|
-
return t.s -= e / 100, t.s = p(t.s), new o(t);
|
|
640
|
-
}
|
|
641
|
-
/**
|
|
642
|
-
* Saturate the color a given amount, from 0 to 100.
|
|
643
|
-
* @param amount - valid between 1-100
|
|
644
|
-
*/
|
|
645
|
-
saturate(e = 10) {
|
|
646
|
-
const t = this.toHsl();
|
|
647
|
-
return t.s += e / 100, t.s = p(t.s), new o(t);
|
|
648
|
-
}
|
|
649
|
-
/**
|
|
650
|
-
* Completely desaturates a color into greyscale.
|
|
651
|
-
* Same as calling `desaturate(100)`
|
|
652
|
-
*/
|
|
653
|
-
greyscale() {
|
|
654
|
-
return this.desaturate(100);
|
|
655
|
-
}
|
|
656
|
-
/**
|
|
657
|
-
* Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
658
|
-
* Values outside of this range will be wrapped into this range.
|
|
659
|
-
*/
|
|
660
|
-
spin(e) {
|
|
661
|
-
const t = this.toHsl(), a = (t.h + e) % 360;
|
|
662
|
-
return t.h = a < 0 ? 360 + a : a, new o(t);
|
|
663
|
-
}
|
|
664
|
-
/**
|
|
665
|
-
* Mix the current color a given amount with another color, from 0 to 100.
|
|
666
|
-
* 0 means no mixing (return current color).
|
|
667
|
-
*/
|
|
668
|
-
mix(e, t = 50) {
|
|
669
|
-
const a = this.toRgb(), s = new o(e).toRgb(), n = t / 100, i = {
|
|
670
|
-
r: (s.r - a.r) * n + a.r,
|
|
671
|
-
g: (s.g - a.g) * n + a.g,
|
|
672
|
-
b: (s.b - a.b) * n + a.b,
|
|
673
|
-
a: (s.a - a.a) * n + a.a
|
|
674
|
-
};
|
|
675
|
-
return new o(i);
|
|
676
|
-
}
|
|
677
|
-
analogous(e = 6, t = 30) {
|
|
678
|
-
const a = this.toHsl(), s = 360 / t, n = [this];
|
|
679
|
-
for (a.h = (a.h - (s * e >> 1) + 720) % 360; --e; )
|
|
680
|
-
a.h = (a.h + s) % 360, n.push(new o(a));
|
|
681
|
-
return n;
|
|
682
|
-
}
|
|
683
|
-
/**
|
|
684
|
-
* taken from https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js
|
|
685
|
-
*/
|
|
686
|
-
complement() {
|
|
687
|
-
const e = this.toHsl();
|
|
688
|
-
return e.h = (e.h + 180) % 360, new o(e);
|
|
689
|
-
}
|
|
690
|
-
monochromatic(e = 6) {
|
|
691
|
-
const t = this.toHsv(), { h: a } = t, { s } = t;
|
|
692
|
-
let { v: n } = t;
|
|
693
|
-
const i = [], h = 1 / e;
|
|
694
|
-
for (; e--; )
|
|
695
|
-
i.push(new o({ h: a, s, v: n })), n = (n + h) % 1;
|
|
696
|
-
return i;
|
|
697
|
-
}
|
|
698
|
-
splitcomplement() {
|
|
699
|
-
const e = this.toHsl(), { h: t } = e;
|
|
700
|
-
return [
|
|
701
|
-
this,
|
|
702
|
-
new o({ h: (t + 72) % 360, s: e.s, l: e.l }),
|
|
703
|
-
new o({ h: (t + 216) % 360, s: e.s, l: e.l })
|
|
704
|
-
];
|
|
705
|
-
}
|
|
706
|
-
/**
|
|
707
|
-
* Compute how the color would appear on a background
|
|
708
|
-
*/
|
|
709
|
-
onBackground(e) {
|
|
710
|
-
const t = this.toRgb(), a = new o(e).toRgb(), s = t.a + a.a * (1 - t.a);
|
|
711
|
-
return new o({
|
|
712
|
-
r: (t.r * t.a + a.r * a.a * (1 - t.a)) / s,
|
|
713
|
-
g: (t.g * t.a + a.g * a.a * (1 - t.a)) / s,
|
|
714
|
-
b: (t.b * t.a + a.b * a.a * (1 - t.a)) / s,
|
|
715
|
-
a: s
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
|
-
/**
|
|
719
|
-
* Alias for `polyad(3)`
|
|
720
|
-
*/
|
|
721
|
-
triad() {
|
|
722
|
-
return this.polyad(3);
|
|
723
|
-
}
|
|
724
|
-
/**
|
|
725
|
-
* Alias for `polyad(4)`
|
|
726
|
-
*/
|
|
727
|
-
tetrad() {
|
|
728
|
-
return this.polyad(4);
|
|
729
|
-
}
|
|
730
|
-
/**
|
|
731
|
-
* Get polyad colors, like (for 1, 2, 3, 4, 5, 6, 7, 8, etc...)
|
|
732
|
-
* monad, dyad, triad, tetrad, pentad, hexad, heptad, octad, etc...
|
|
733
|
-
*/
|
|
734
|
-
polyad(e) {
|
|
735
|
-
const t = this.toHsl(), { h: a } = t, s = [this], n = 360 / e;
|
|
736
|
-
for (let i = 1; i < e; i++)
|
|
737
|
-
s.push(
|
|
738
|
-
new o({ h: (a + i * n) % 360, s: t.s, l: t.l })
|
|
739
|
-
);
|
|
740
|
-
return s;
|
|
741
|
-
}
|
|
742
|
-
/**
|
|
743
|
-
* compare color vs current color
|
|
744
|
-
*/
|
|
745
|
-
equals(e) {
|
|
746
|
-
const t = new o(e);
|
|
747
|
-
return this.format === "cmyk" || t.format === "cmyk" ? this.toCmykString() === t.toCmykString() : this.toRgbString() === t.toRgbString();
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
export {
|
|
751
|
-
E as A,
|
|
752
|
-
R as C,
|
|
753
|
-
H,
|
|
754
|
-
L as N,
|
|
755
|
-
B as R,
|
|
756
|
-
O as S,
|
|
757
|
-
A as T,
|
|
758
|
-
T as W,
|
|
759
|
-
o as a,
|
|
760
|
-
l as b,
|
|
761
|
-
q as d,
|
|
762
|
-
v as e,
|
|
763
|
-
F as j,
|
|
764
|
-
I as k,
|
|
765
|
-
$ as l,
|
|
766
|
-
g as n,
|
|
767
|
-
J as p,
|
|
768
|
-
U as w,
|
|
769
|
-
P as y
|
|
770
|
-
};
|