@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
|
@@ -0,0 +1,873 @@
|
|
|
1
|
+
function l(r, t) {
|
|
2
|
+
U(r) && (r = "100%");
|
|
3
|
+
const e = Y(r);
|
|
4
|
+
return r = t === 360 ? r : Math.min(t, Math.max(0, parseFloat(r))), e && (r = parseInt(String(r * t), 10) / 100), Math.abs(r - t) < 1e-6 ? 1 : (t === 360 ? r = (r < 0 ? r % t + t : r % t) / parseFloat(String(t)) : r = r % t / parseFloat(String(t)), r);
|
|
5
|
+
}
|
|
6
|
+
function w(r) {
|
|
7
|
+
return Math.min(1, Math.max(0, r));
|
|
8
|
+
}
|
|
9
|
+
function U(r) {
|
|
10
|
+
return typeof r == "string" && r.indexOf(".") !== -1 && parseFloat(r) === 1;
|
|
11
|
+
}
|
|
12
|
+
function Y(r) {
|
|
13
|
+
return typeof r == "string" && r.indexOf("%") !== -1;
|
|
14
|
+
}
|
|
15
|
+
function q(r) {
|
|
16
|
+
return r = parseFloat(r), (isNaN(r) || r < 0 || r > 1) && (r = 1), r;
|
|
17
|
+
}
|
|
18
|
+
function $(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 J(r, t, e) {
|
|
25
|
+
return {
|
|
26
|
+
r: l(r, 255) * 255,
|
|
27
|
+
g: l(t, 255) * 255,
|
|
28
|
+
b: l(e, 255) * 255
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function z(r, t, e) {
|
|
32
|
+
r = l(r, 255), t = l(t, 255), e = l(e, 255);
|
|
33
|
+
const a = Math.max(r, t, e), n = Math.min(r, t, e);
|
|
34
|
+
let s = 0, i = 0;
|
|
35
|
+
const h = (a + n) / 2;
|
|
36
|
+
if (a === n)
|
|
37
|
+
i = 0, s = 0;
|
|
38
|
+
else {
|
|
39
|
+
const u = a - n;
|
|
40
|
+
switch (i = h > 0.5 ? u / (2 - a - n) : u / (a + n), a) {
|
|
41
|
+
case r:
|
|
42
|
+
s = (t - e) / u + (t < e ? 6 : 0);
|
|
43
|
+
break;
|
|
44
|
+
case t:
|
|
45
|
+
s = (e - r) / u + 2;
|
|
46
|
+
break;
|
|
47
|
+
case e:
|
|
48
|
+
s = (r - t) / u + 4;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
s /= 6;
|
|
52
|
+
}
|
|
53
|
+
return { h: s, s: i, l: h };
|
|
54
|
+
}
|
|
55
|
+
function F(r, t, e) {
|
|
56
|
+
return e < 0 && (e += 1), e > 1 && (e -= 1), e < 1 / 6 ? r + (t - r) * (6 * e) : e < 1 / 2 ? t : e < 2 / 3 ? r + (t - r) * (2 / 3 - e) * 6 : r;
|
|
57
|
+
}
|
|
58
|
+
function K(r, t, e) {
|
|
59
|
+
let a, n, s;
|
|
60
|
+
if (r = l(r, 360), t = l(t, 100), e = l(e, 100), t === 0)
|
|
61
|
+
n = e, s = e, a = e;
|
|
62
|
+
else {
|
|
63
|
+
const i = e < 0.5 ? e * (1 + t) : e + t - e * t, h = 2 * e - i;
|
|
64
|
+
a = F(h, i, r + 1 / 3), n = F(h, i, r), s = F(h, i, r - 1 / 3);
|
|
65
|
+
}
|
|
66
|
+
return { r: a * 255, g: n * 255, b: s * 255 };
|
|
67
|
+
}
|
|
68
|
+
function H(r, t, e) {
|
|
69
|
+
r = l(r, 255), t = l(t, 255), e = l(e, 255);
|
|
70
|
+
const a = Math.max(r, t, e), n = Math.min(r, t, e);
|
|
71
|
+
let s = 0;
|
|
72
|
+
const i = a, h = a - n, u = a === 0 ? 0 : h / a;
|
|
73
|
+
if (a === n)
|
|
74
|
+
s = 0;
|
|
75
|
+
else {
|
|
76
|
+
switch (a) {
|
|
77
|
+
case r:
|
|
78
|
+
s = (t - e) / h + (t < e ? 6 : 0);
|
|
79
|
+
break;
|
|
80
|
+
case t:
|
|
81
|
+
s = (e - r) / h + 2;
|
|
82
|
+
break;
|
|
83
|
+
case e:
|
|
84
|
+
s = (r - t) / h + 4;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
s /= 6;
|
|
88
|
+
}
|
|
89
|
+
return { h: s, s: u, v: i };
|
|
90
|
+
}
|
|
91
|
+
function Q(r, t, e) {
|
|
92
|
+
r = l(r, 360) * 6, t = l(t, 100), e = l(e, 100);
|
|
93
|
+
const a = Math.floor(r), n = r - a, s = e * (1 - t), i = e * (1 - n * t), h = e * (1 - (1 - n) * t), u = a % 6, k = [e, i, s, s, h, e][u], m = [h, e, e, i, s, s][u], S = [s, s, h, e, e, i][u];
|
|
94
|
+
return { r: k * 255, g: m * 255, b: S * 255 };
|
|
95
|
+
}
|
|
96
|
+
function j(r, t, e, a) {
|
|
97
|
+
const n = [
|
|
98
|
+
d(Math.round(r).toString(16)),
|
|
99
|
+
d(Math.round(t).toString(16)),
|
|
100
|
+
d(Math.round(e).toString(16))
|
|
101
|
+
];
|
|
102
|
+
return a && n[0].startsWith(n[0].charAt(1)) && n[1].startsWith(n[1].charAt(1)) && n[2].startsWith(n[2].charAt(1)) ? n[0].charAt(0) + n[1].charAt(0) + n[2].charAt(0) : n.join("");
|
|
103
|
+
}
|
|
104
|
+
function X(r, t, e, a, n) {
|
|
105
|
+
const s = [
|
|
106
|
+
d(Math.round(r).toString(16)),
|
|
107
|
+
d(Math.round(t).toString(16)),
|
|
108
|
+
d(Math.round(e).toString(16)),
|
|
109
|
+
d(W(a))
|
|
110
|
+
];
|
|
111
|
+
return n && s[0].startsWith(s[0].charAt(1)) && s[1].startsWith(s[1].charAt(1)) && s[2].startsWith(s[2].charAt(1)) && s[3].startsWith(s[3].charAt(1)) ? s[0].charAt(0) + s[1].charAt(0) + s[2].charAt(0) + s[3].charAt(0) : s.join("");
|
|
112
|
+
}
|
|
113
|
+
function oe(r, t, e, a) {
|
|
114
|
+
return [
|
|
115
|
+
d(W(a)),
|
|
116
|
+
d(Math.round(r).toString(16)),
|
|
117
|
+
d(Math.round(t).toString(16)),
|
|
118
|
+
d(Math.round(e).toString(16))
|
|
119
|
+
].join("");
|
|
120
|
+
}
|
|
121
|
+
function Z(r, t, e, a) {
|
|
122
|
+
const n = r / 100, s = t / 100, i = e / 100, h = a / 100, u = 255 * (1 - n) * (1 - h), k = 255 * (1 - s) * (1 - h), m = 255 * (1 - i) * (1 - h);
|
|
123
|
+
return { r: u, g: k, b: m };
|
|
124
|
+
}
|
|
125
|
+
function N(r, t, e) {
|
|
126
|
+
let a = 1 - r / 255, n = 1 - t / 255, s = 1 - e / 255, i = Math.min(a, n, s);
|
|
127
|
+
return i === 1 ? (a = 0, n = 0, s = 0) : (a = (a - i) / (1 - i) * 100, n = (n - i) / (1 - i) * 100, s = (s - i) / (1 - i) * 100), i *= 100, {
|
|
128
|
+
c: Math.round(a),
|
|
129
|
+
m: Math.round(n),
|
|
130
|
+
y: Math.round(s),
|
|
131
|
+
k: Math.round(i)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function W(r) {
|
|
135
|
+
return Math.round(parseFloat(r) * 255).toString(16);
|
|
136
|
+
}
|
|
137
|
+
function O(r) {
|
|
138
|
+
return g(r) / 255;
|
|
139
|
+
}
|
|
140
|
+
function g(r) {
|
|
141
|
+
return parseInt(r, 16);
|
|
142
|
+
}
|
|
143
|
+
function _(r) {
|
|
144
|
+
return {
|
|
145
|
+
r: r >> 16,
|
|
146
|
+
g: (r & 65280) >> 8,
|
|
147
|
+
b: r & 255
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
const E = {
|
|
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 ee(r) {
|
|
301
|
+
let t = { r: 0, g: 0, b: 0 }, e = 1, a = null, n = null, s = null, i = !1, h = !1;
|
|
302
|
+
return typeof r == "string" && (r = ae(r)), typeof r == "object" && (f(r.r) && f(r.g) && f(r.b) ? (t = J(r.r, r.g, r.b), i = !0, h = String(r.r).slice(-1) === "%" ? "prgb" : "rgb") : f(r.h) && f(r.s) && f(r.v) ? (a = $(r.s), n = $(r.v), t = Q(r.h, a, n), i = !0, h = "hsv") : f(r.h) && f(r.s) && f(r.l) ? (a = $(r.s), s = $(r.l), t = K(r.h, a, s), i = !0, h = "hsl") : f(r.c) && f(r.m) && f(r.y) && f(r.k) && (t = Z(r.c, r.m, r.y, r.k), i = !0, h = "cmyk"), Object.prototype.hasOwnProperty.call(r, "a") && (e = r.a)), e = q(e), {
|
|
303
|
+
ok: i,
|
|
304
|
+
format: r.format || h,
|
|
305
|
+
r: Math.min(255, Math.max(t.r, 0)),
|
|
306
|
+
g: Math.min(255, Math.max(t.g, 0)),
|
|
307
|
+
b: Math.min(255, Math.max(t.b, 0)),
|
|
308
|
+
a: e
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
const te = "[-\\+]?\\d+%?", re = "[-\\+]?\\d*\\.\\d+%?", p = "(?:" + re + ")|(?:" + te + ")", R = "[\\s|\\(]+(" + p + ")[,|\\s]+(" + p + ")[,|\\s]+(" + p + ")\\s*\\)?", A = (
|
|
312
|
+
// eslint-disable-next-line prettier/prettier
|
|
313
|
+
"[\\s|\\(]+(" + p + ")[,|\\s]+(" + p + ")[,|\\s]+(" + p + ")[,|\\s]+(" + p + ")\\s*\\)?"
|
|
314
|
+
), c = {
|
|
315
|
+
CSS_UNIT: new RegExp(p),
|
|
316
|
+
rgb: new RegExp("rgb" + R),
|
|
317
|
+
rgba: new RegExp("rgba" + A),
|
|
318
|
+
hsl: new RegExp("hsl" + R),
|
|
319
|
+
hsla: new RegExp("hsla" + A),
|
|
320
|
+
hsv: new RegExp("hsv" + R),
|
|
321
|
+
hsva: new RegExp("hsva" + A),
|
|
322
|
+
cmyk: new RegExp("cmyk" + A),
|
|
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 ae(r) {
|
|
329
|
+
if (r = r.trim().toLowerCase(), r.length === 0)
|
|
330
|
+
return !1;
|
|
331
|
+
let t = !1;
|
|
332
|
+
if (E[r])
|
|
333
|
+
r = E[r], t = !0;
|
|
334
|
+
else if (r === "transparent")
|
|
335
|
+
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
|
336
|
+
let e = c.rgb.exec(r);
|
|
337
|
+
return e ? { r: e[1], g: e[2], b: e[3] } : (e = c.rgba.exec(r), e ? { r: e[1], g: e[2], b: e[3], a: e[4] } : (e = c.hsl.exec(r), e ? { h: e[1], s: e[2], l: e[3] } : (e = c.hsla.exec(r), e ? { h: e[1], s: e[2], l: e[3], a: e[4] } : (e = c.hsv.exec(r), e ? { h: e[1], s: e[2], v: e[3] } : (e = c.hsva.exec(r), e ? { h: e[1], s: e[2], v: e[3], a: e[4] } : (e = c.cmyk.exec(r), e ? {
|
|
338
|
+
c: e[1],
|
|
339
|
+
m: e[2],
|
|
340
|
+
y: e[3],
|
|
341
|
+
k: e[4]
|
|
342
|
+
} : (e = c.hex8.exec(r), e ? {
|
|
343
|
+
r: g(e[1]),
|
|
344
|
+
g: g(e[2]),
|
|
345
|
+
b: g(e[3]),
|
|
346
|
+
a: O(e[4]),
|
|
347
|
+
format: t ? "name" : "hex8"
|
|
348
|
+
} : (e = c.hex6.exec(r), e ? {
|
|
349
|
+
r: g(e[1]),
|
|
350
|
+
g: g(e[2]),
|
|
351
|
+
b: g(e[3]),
|
|
352
|
+
format: t ? "name" : "hex"
|
|
353
|
+
} : (e = c.hex4.exec(r), e ? {
|
|
354
|
+
r: g(e[1] + e[1]),
|
|
355
|
+
g: g(e[2] + e[2]),
|
|
356
|
+
b: g(e[3] + e[3]),
|
|
357
|
+
a: O(e[4] + e[4]),
|
|
358
|
+
format: t ? "name" : "hex8"
|
|
359
|
+
} : (e = c.hex3.exec(r), e ? {
|
|
360
|
+
r: g(e[1] + e[1]),
|
|
361
|
+
g: g(e[2] + e[2]),
|
|
362
|
+
b: g(e[3] + e[3]),
|
|
363
|
+
format: t ? "name" : "hex"
|
|
364
|
+
} : !1))))))))));
|
|
365
|
+
}
|
|
366
|
+
function f(r) {
|
|
367
|
+
return typeof r == "number" ? !Number.isNaN(r) : c.CSS_UNIT.test(r);
|
|
368
|
+
}
|
|
369
|
+
var ne = Object.defineProperty, se = (r, t, e) => t in r ? ne(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, b = (r, t, e) => se(r, typeof t != "symbol" ? t + "" : t, e);
|
|
370
|
+
class o {
|
|
371
|
+
constructor(t = "", e = {}) {
|
|
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"), t instanceof o)
|
|
373
|
+
return t;
|
|
374
|
+
typeof t == "number" && (t = _(t)), this.originalInput = t;
|
|
375
|
+
const a = ee(t);
|
|
376
|
+
this.originalInput = t, 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 = e.format ?? a.format, this.gradientType = e.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 t = this.toRgb();
|
|
392
|
+
return (t.r * 299 + t.g * 587 + t.b * 114) / 1e3;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Returns the perceived luminance of a color, from 0-1.
|
|
396
|
+
*/
|
|
397
|
+
getLuminance() {
|
|
398
|
+
const t = this.toRgb();
|
|
399
|
+
let e, a, n;
|
|
400
|
+
const s = t.r / 255, i = t.g / 255, h = t.b / 255;
|
|
401
|
+
return s <= 0.03928 ? e = s / 12.92 : e = Math.pow((s + 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 ? n = h / 12.92 : n = Math.pow((h + 0.055) / 1.055, 2.4), 0.2126 * e + 0.7152 * a + 0.0722 * n;
|
|
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(t) {
|
|
415
|
+
return this.a = q(t), this.roundA = Math.round(100 * this.a) / 100, this;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Returns whether the color is monochrome.
|
|
419
|
+
*/
|
|
420
|
+
isMonochrome() {
|
|
421
|
+
const { s: t } = this.toHsl();
|
|
422
|
+
return t === 0;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Returns the object as a HSVA object.
|
|
426
|
+
*/
|
|
427
|
+
toHsv() {
|
|
428
|
+
const t = H(this.r, this.g, this.b);
|
|
429
|
+
return { h: t.h * 360, s: t.s, v: t.v, a: this.a };
|
|
430
|
+
}
|
|
431
|
+
toHsv_() {
|
|
432
|
+
const t = H(this.r, this.g, this.b);
|
|
433
|
+
return { h: t.h, s: t.s, v: t.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 t = H(this.r, this.g, this.b), e = Math.round(t.h * 360), a = Math.round(t.s * 100), n = Math.round(t.v * 100);
|
|
441
|
+
return this.a === 1 ? `hsv(${e}, ${a}%, ${n}%)` : `hsva(${e}, ${a}%, ${n}%, ${this.roundA})`;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Returns the object as a HSLA object.
|
|
445
|
+
*/
|
|
446
|
+
toHsl() {
|
|
447
|
+
const t = z(this.r, this.g, this.b);
|
|
448
|
+
return { h: t.h * 360, s: t.s, l: t.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 t = z(this.r, this.g, this.b), e = Math.round(t.h * 360), a = Math.round(t.s * 100), n = Math.round(t.l * 100);
|
|
456
|
+
return this.a === 1 ? `hsl(${e}, ${a}%, ${n}%)` : `hsla(${e}, ${a}%, ${n}%, ${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(t = !1) {
|
|
463
|
+
return j(this.r, this.g, this.b, t);
|
|
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(t = !1) {
|
|
470
|
+
return `#${this.toHex(t)}`;
|
|
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(t = !1) {
|
|
477
|
+
return X(this.r, this.g, this.b, this.a, t);
|
|
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(t = !1) {
|
|
484
|
+
return `#${this.toHex8(t)}`;
|
|
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(t = !1) {
|
|
491
|
+
return this.a === 1 ? this.toHexString(t) : this.toHex8String(t);
|
|
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 t = this.toRgb();
|
|
509
|
+
return [t.r, t.g, t.b];
|
|
510
|
+
}
|
|
511
|
+
toRgbArrayString() {
|
|
512
|
+
const t = this.toRgb();
|
|
513
|
+
return `${t.r},${t.g},${t.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 t = Math.round(this.r), e = Math.round(this.g), a = Math.round(this.b);
|
|
521
|
+
return this.a === 1 ? `rgb(${t}, ${e}, ${a})` : `rgba(${t}, ${e}, ${a}, ${this.roundA})`;
|
|
522
|
+
}
|
|
523
|
+
toRgbaString() {
|
|
524
|
+
const t = Math.round(this.r), e = Math.round(this.g), a = Math.round(this.b);
|
|
525
|
+
return `rgba(${t}, ${e}, ${a}, ${this.roundA})`;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Returns the object as a RGBA object.
|
|
529
|
+
*/
|
|
530
|
+
toPercentageRgb() {
|
|
531
|
+
const t = (e) => `${Math.round(l(e, 255) * 100)}%`;
|
|
532
|
+
return {
|
|
533
|
+
r: t(this.r),
|
|
534
|
+
g: t(this.g),
|
|
535
|
+
b: t(this.b),
|
|
536
|
+
a: this.a
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Returns the RGBA relative values interpolated into a string
|
|
541
|
+
*/
|
|
542
|
+
toPercentageRgbString() {
|
|
543
|
+
const t = (e) => Math.round(l(e, 255) * 100);
|
|
544
|
+
return this.a === 1 ? `rgb(${t(this.r)}%, ${t(this.g)}%, ${t(this.b)}%)` : `rgba(${t(this.r)}%, ${t(this.g)}%, ${t(this.b)}%, ${this.roundA})`;
|
|
545
|
+
}
|
|
546
|
+
toCmyk() {
|
|
547
|
+
return {
|
|
548
|
+
...N(this.r, this.g, this.b)
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
toCmykString() {
|
|
552
|
+
const { c: t, m: e, y: a, k: n } = N(this.r, this.g, this.b);
|
|
553
|
+
return `cmyk(${t}, ${e}, ${a}, ${n})`;
|
|
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 t = `#${j(this.r, this.g, this.b, !1)}`;
|
|
564
|
+
for (const [e, a] of Object.entries(E))
|
|
565
|
+
if (t === a)
|
|
566
|
+
return e;
|
|
567
|
+
return !1;
|
|
568
|
+
}
|
|
569
|
+
toString(t) {
|
|
570
|
+
const e = !!t;
|
|
571
|
+
t = t ?? this.format;
|
|
572
|
+
let a = !1;
|
|
573
|
+
const n = this.a < 1 && this.a >= 0;
|
|
574
|
+
return !e && n && (t.startsWith("hex") || t === "name") ? t === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (t === "rgb" && (a = this.toRgbString()), t === "prgb" && (a = this.toPercentageRgbString()), (t === "hex" || t === "hex6") && (a = this.toHexString()), t === "hex3" && (a = this.toHexString(!0)), t === "hex4" && (a = this.toHex8String(!0)), t === "hex8" && (a = this.toHex8String()), t === "name" && (a = this.toName()), t === "hsl" && (a = this.toHslString()), t === "hsv" && (a = this.toHsvString()), t === "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(t = 10) {
|
|
587
|
+
const e = this.toHsl();
|
|
588
|
+
return e.l += t / 100, e.l = w(e.l), new o(e);
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Brighten the color a given amount, from 0 to 100.
|
|
592
|
+
* @param amount - valid between 1-100
|
|
593
|
+
*/
|
|
594
|
+
brighten(t = 10) {
|
|
595
|
+
const e = this.toRgb();
|
|
596
|
+
return e.r = Math.max(
|
|
597
|
+
0,
|
|
598
|
+
Math.min(255, e.r - Math.round(255 * -(t / 100)))
|
|
599
|
+
), e.g = Math.max(
|
|
600
|
+
0,
|
|
601
|
+
Math.min(255, e.g - Math.round(255 * -(t / 100)))
|
|
602
|
+
), e.b = Math.max(
|
|
603
|
+
0,
|
|
604
|
+
Math.min(255, e.b - Math.round(255 * -(t / 100)))
|
|
605
|
+
), new o(e);
|
|
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(t = 10) {
|
|
613
|
+
const e = this.toHsl();
|
|
614
|
+
return e.l -= t / 100, e.l = w(e.l), new o(e);
|
|
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(t = 10) {
|
|
622
|
+
return this.mix("white", t);
|
|
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(t = 10) {
|
|
630
|
+
return this.mix("black", t);
|
|
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(t = 10) {
|
|
638
|
+
const e = this.toHsl();
|
|
639
|
+
return e.s -= t / 100, e.s = w(e.s), new o(e);
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Saturate the color a given amount, from 0 to 100.
|
|
643
|
+
* @param amount - valid between 1-100
|
|
644
|
+
*/
|
|
645
|
+
saturate(t = 10) {
|
|
646
|
+
const e = this.toHsl();
|
|
647
|
+
return e.s += t / 100, e.s = w(e.s), new o(e);
|
|
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(t) {
|
|
661
|
+
const e = this.toHsl(), a = (e.h + t) % 360;
|
|
662
|
+
return e.h = a < 0 ? 360 + a : a, new o(e);
|
|
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(t, e = 50) {
|
|
669
|
+
const a = this.toRgb(), n = new o(t).toRgb(), s = e / 100, i = {
|
|
670
|
+
r: (n.r - a.r) * s + a.r,
|
|
671
|
+
g: (n.g - a.g) * s + a.g,
|
|
672
|
+
b: (n.b - a.b) * s + a.b,
|
|
673
|
+
a: (n.a - a.a) * s + a.a
|
|
674
|
+
};
|
|
675
|
+
return new o(i);
|
|
676
|
+
}
|
|
677
|
+
analogous(t = 6, e = 30) {
|
|
678
|
+
const a = this.toHsl(), n = 360 / e, s = [this];
|
|
679
|
+
for (a.h = (a.h - (n * t >> 1) + 720) % 360; --t; )
|
|
680
|
+
a.h = (a.h + n) % 360, s.push(new o(a));
|
|
681
|
+
return s;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* taken from https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js
|
|
685
|
+
*/
|
|
686
|
+
complement() {
|
|
687
|
+
const t = this.toHsl();
|
|
688
|
+
return t.h = (t.h + 180) % 360, new o(t);
|
|
689
|
+
}
|
|
690
|
+
monochromatic(t = 6) {
|
|
691
|
+
const e = this.toHsv(), { h: a } = e, { s: n } = e;
|
|
692
|
+
let { v: s } = e;
|
|
693
|
+
const i = [], h = 1 / t;
|
|
694
|
+
for (; t--; )
|
|
695
|
+
i.push(new o({ h: a, s: n, v: s })), s = (s + h) % 1;
|
|
696
|
+
return i;
|
|
697
|
+
}
|
|
698
|
+
splitcomplement() {
|
|
699
|
+
const t = this.toHsl(), { h: e } = t;
|
|
700
|
+
return [
|
|
701
|
+
this,
|
|
702
|
+
new o({ h: (e + 72) % 360, s: t.s, l: t.l }),
|
|
703
|
+
new o({ h: (e + 216) % 360, s: t.s, l: t.l })
|
|
704
|
+
];
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Compute how the color would appear on a background
|
|
708
|
+
*/
|
|
709
|
+
onBackground(t) {
|
|
710
|
+
const e = this.toRgb(), a = new o(t).toRgb(), n = e.a + a.a * (1 - e.a);
|
|
711
|
+
return new o({
|
|
712
|
+
r: (e.r * e.a + a.r * a.a * (1 - e.a)) / n,
|
|
713
|
+
g: (e.g * e.a + a.g * a.a * (1 - e.a)) / n,
|
|
714
|
+
b: (e.b * e.a + a.b * a.a * (1 - e.a)) / n,
|
|
715
|
+
a: n
|
|
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(t) {
|
|
735
|
+
const e = this.toHsl(), { h: a } = e, n = [this], s = 360 / t;
|
|
736
|
+
for (let i = 1; i < t; i++)
|
|
737
|
+
n.push(
|
|
738
|
+
new o({ h: (a + i * s) % 360, s: e.s, l: e.l })
|
|
739
|
+
);
|
|
740
|
+
return n;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* compare color vs current color
|
|
744
|
+
*/
|
|
745
|
+
equals(t) {
|
|
746
|
+
const e = new o(t);
|
|
747
|
+
return this.format === "cmyk" || e.format === "cmyk" ? this.toCmykString() === e.toCmykString() : this.toRgbString() === e.toRgbString();
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
const y = 10, M = {
|
|
751
|
+
red: { name: { zh: "浪漫红", en: "Red" }, value: "#F53F3F" },
|
|
752
|
+
orangered: { name: { zh: "晚秋红", en: "Orange Red" }, value: "#FF702E" },
|
|
753
|
+
orange: { name: { zh: "活力橙", en: "Orange" }, value: "#FFA500" },
|
|
754
|
+
gold: { name: { zh: "黄昏", en: "Gold" }, value: "#FFBD14" },
|
|
755
|
+
yellow: { name: { zh: "柠檬黄", en: "Yellow" }, value: "#FFE014" },
|
|
756
|
+
lime: { name: { zh: "新生绿", en: "Lime" }, value: "#A1E619" },
|
|
757
|
+
green: { name: { zh: "仙野绿", en: "Green" }, value: "#00B82B" },
|
|
758
|
+
cyan: { name: { zh: "碧涛青", en: "Cyan" }, value: "#0BD0D0" },
|
|
759
|
+
blue: { name: { zh: "海蔚蓝", en: "Blue" }, value: "#2E8FFF" },
|
|
760
|
+
pqbblue: { name: { zh: "极致蓝", en: "Pqb Blue" }, value: "#1A5EFF" },
|
|
761
|
+
purple: { name: { zh: "暗夜紫", en: "Purple" }, value: "#7126D9" },
|
|
762
|
+
pinkpurple: { name: { zh: "青春紫", en: "Pink Purple" }, value: "#D91AD9" },
|
|
763
|
+
magenta: { name: { zh: "品红", en: "Magenta" }, value: "#FF299F" },
|
|
764
|
+
gray: { name: { zh: "中性灰", en: "Gray" }, value: "#6B6C6D" }
|
|
765
|
+
}, { gray: le, ...ie } = M, P = Object.fromEntries(
|
|
766
|
+
Object.entries(ie).map(([r, t], e, a) => [r, t.value])
|
|
767
|
+
), T = {
|
|
768
|
+
light: [
|
|
769
|
+
"#F7F8F9",
|
|
770
|
+
"#F2F3F4",
|
|
771
|
+
"#E5E6E7",
|
|
772
|
+
"#C9CACB",
|
|
773
|
+
"#A9ABAC",
|
|
774
|
+
"#868788",
|
|
775
|
+
M.gray.value,
|
|
776
|
+
"#4D4E4F",
|
|
777
|
+
"#28292A",
|
|
778
|
+
"#1E1F20"
|
|
779
|
+
],
|
|
780
|
+
dark: [
|
|
781
|
+
"#121213",
|
|
782
|
+
"#1C1C1D",
|
|
783
|
+
"#404142",
|
|
784
|
+
"#5E5F60",
|
|
785
|
+
"#797A7B",
|
|
786
|
+
"#9C9E9F",
|
|
787
|
+
"#BCBDBE",
|
|
788
|
+
"#D8D9DB",
|
|
789
|
+
"#E4E6E8",
|
|
790
|
+
"#E8EBEE"
|
|
791
|
+
],
|
|
792
|
+
primary: M.gray.value,
|
|
793
|
+
name: M.gray.name
|
|
794
|
+
}, he = Object.fromEntries(
|
|
795
|
+
Object.entries(M).map(([r, t], e, a) => {
|
|
796
|
+
const n = t.value;
|
|
797
|
+
return [
|
|
798
|
+
r,
|
|
799
|
+
{
|
|
800
|
+
light: L({ color: n, length: y }),
|
|
801
|
+
dark: G({ color: n, length: y }),
|
|
802
|
+
primary: n,
|
|
803
|
+
name: t.name
|
|
804
|
+
}
|
|
805
|
+
];
|
|
806
|
+
}).concat([["gray", T]])
|
|
807
|
+
);
|
|
808
|
+
function C(r = {}) {
|
|
809
|
+
const t = ((r == null ? void 0 : r.length) ?? y) / 2 + 1, e = (r == null ? void 0 : r.level) ?? t;
|
|
810
|
+
let a = new o(r == null ? void 0 : r.color);
|
|
811
|
+
const n = a.toHsv(), s = n.h, i = n.s, h = n.v, u = s === 0 && i === 0, k = e < t, m = Math.abs(t - e), S = 1, B = 0.1;
|
|
812
|
+
let v = i;
|
|
813
|
+
v > B && (k ? v = i - (i - B) / (t - 1) * m : v = i + (S - i) / (t - 1) * m), u && (v = i);
|
|
814
|
+
const V = u ? 0.97 : 1, D = 0.1;
|
|
815
|
+
let x = h;
|
|
816
|
+
return x > D && (k ? x = h + (V - h) / (t - 1) * m : x = h - (h - D) / (t - 1) * m), a = new o({
|
|
817
|
+
h: s,
|
|
818
|
+
s: v,
|
|
819
|
+
v: x
|
|
820
|
+
}), r.dark && (a = a.darken(r.amount ?? 10)), a.toHexString();
|
|
821
|
+
}
|
|
822
|
+
function I(r = {}) {
|
|
823
|
+
return C({ ...r, dark: !0 });
|
|
824
|
+
}
|
|
825
|
+
function L(r = {}) {
|
|
826
|
+
return new Array((r == null ? void 0 : r.length) ?? y).fill(0).map((t, e, a) => {
|
|
827
|
+
const n = e + 1;
|
|
828
|
+
return C({ ...r, level: n });
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
function G(r = {}) {
|
|
832
|
+
return new Array((r == null ? void 0 : r.length) ?? y).fill(0).map((t, e, a) => {
|
|
833
|
+
const n = e + 1;
|
|
834
|
+
return I({
|
|
835
|
+
...r,
|
|
836
|
+
level: y - n + 1
|
|
837
|
+
});
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
const ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
841
|
+
__proto__: null,
|
|
842
|
+
LENGTH: y,
|
|
843
|
+
colorPresets: he,
|
|
844
|
+
colors: P,
|
|
845
|
+
default: P,
|
|
846
|
+
generate: L,
|
|
847
|
+
generateDark: G,
|
|
848
|
+
grayPresets: T,
|
|
849
|
+
palette: C,
|
|
850
|
+
paletteDark: I
|
|
851
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
852
|
+
export {
|
|
853
|
+
J as A,
|
|
854
|
+
N as C,
|
|
855
|
+
j as H,
|
|
856
|
+
ee as N,
|
|
857
|
+
ue as P,
|
|
858
|
+
_ as R,
|
|
859
|
+
Q as S,
|
|
860
|
+
z as T,
|
|
861
|
+
X as W,
|
|
862
|
+
o as a,
|
|
863
|
+
g as b,
|
|
864
|
+
W as d,
|
|
865
|
+
E as e,
|
|
866
|
+
O as j,
|
|
867
|
+
K as k,
|
|
868
|
+
H as l,
|
|
869
|
+
f as n,
|
|
870
|
+
oe as p,
|
|
871
|
+
ae as w,
|
|
872
|
+
Z as y
|
|
873
|
+
};
|