toolbox-x 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/dist/Color-B3mgF9Dh.d.cts +486 -0
- package/dist/Color-D38Xrw65.d.mts +486 -0
- package/dist/Stylog-Df7eq3-j.d.cts +519 -0
- package/dist/Stylog-jvlLcMQq.d.mts +519 -0
- package/dist/array-DvW0zIu6.d.mts +130 -0
- package/dist/array-rUnEVisO.d.cts +130 -0
- package/dist/basics-D_eSv0cu.cjs +132 -0
- package/dist/basics-Dp_aEK81.mjs +115 -0
- package/dist/basics-WEYWlnRO.d.cts +95 -0
- package/dist/basics-uBSfkBEI.d.mts +95 -0
- package/dist/case-BWIt8Ash.mjs +449 -0
- package/dist/case-C-S-b5YP.d.cts +327 -0
- package/dist/case-CS8Ii3A7.cjs +526 -0
- package/dist/case-CybASFPD.d.mts +327 -0
- package/dist/change-case.cjs +32 -0
- package/dist/change-case.d.cts +18 -0
- package/dist/change-case.d.mts +18 -0
- package/dist/change-case.mjs +19 -0
- package/dist/colors.cjs +574 -0
- package/dist/colors.d.cts +355 -0
- package/dist/colors.d.mts +355 -0
- package/dist/colors.mjs +547 -0
- package/dist/constants-2gAw23_7.mjs +144 -0
- package/dist/constants-B34K0QPi.d.cts +21 -0
- package/dist/constants-BIBDKY1u.cjs +924 -0
- package/dist/constants-BWT-810U.cjs +158 -0
- package/dist/constants-BwbHnXlM.mjs +662 -0
- package/dist/constants-BxN9l5el.cjs +74 -0
- package/dist/constants-CLS_bgKD.d.mts +847 -0
- package/dist/constants-D73iFu8g.mjs +171 -0
- package/dist/constants-DAfRxaa8.mjs +62 -0
- package/dist/constants-DQYeCjlx.cjs +207 -0
- package/dist/constants-Deeie-iH.d.mts +21 -0
- package/dist/constants-DpTG9RP6.d.mts +29 -0
- package/dist/constants-DqwnkJ_d.cjs +740 -0
- package/dist/constants-DvRUY_FY.cjs +150 -0
- package/dist/constants-VcRtQu0K.d.cts +29 -0
- package/dist/constants-X5hm1UtB.mjs +912 -0
- package/dist/constants-eNd-iYsV.mjs +134 -0
- package/dist/constants-qm8FafmD.d.cts +847 -0
- package/dist/constants.cjs +415 -0
- package/dist/constants.d.cts +184 -0
- package/dist/constants.d.mts +184 -0
- package/dist/constants.mjs +378 -0
- package/dist/convert-BOCgUv2D.cjs +252 -0
- package/dist/convert-Bn4jFomQ.mjs +169 -0
- package/dist/convert-BrzlG-m_.cjs +475 -0
- package/dist/convert-DhaUoPVU.mjs +368 -0
- package/dist/converter-1P90_RcP.d.mts +402 -0
- package/dist/converter-CmkcAppi.d.cts +402 -0
- package/dist/converter.cjs +780 -0
- package/dist/converter.d.cts +29 -0
- package/dist/converter.d.mts +29 -0
- package/dist/converter.mjs +771 -0
- package/dist/countries-CIpmtEzV.cjs +1469 -0
- package/dist/countries-Cy0xiqS3.mjs +1463 -0
- package/dist/css-colors-Bx947Ng3.d.cts +179 -0
- package/dist/css-colors-CXCDqQbG.cjs +186 -0
- package/dist/css-colors-CXTp1vvy.d.mts +179 -0
- package/dist/css-colors-DfUW3nTR.mjs +180 -0
- package/dist/date.cjs +332 -0
- package/dist/date.d.cts +213 -0
- package/dist/date.d.mts +213 -0
- package/dist/date.mjs +298 -0
- package/dist/dom.cjs +461 -0
- package/dist/dom.d.cts +228 -0
- package/dist/dom.d.mts +228 -0
- package/dist/dom.mjs +429 -0
- package/dist/form-BMFVGUrN.d.mts +118 -0
- package/dist/form-DRFbryvK.d.cts +118 -0
- package/dist/guards-3kaUX66g.mjs +157 -0
- package/dist/guards-C8gkvIHb.cjs +240 -0
- package/dist/guards-DdyU4h4o.mjs +110 -0
- package/dist/guards-Efhp1mNy.cjs +151 -0
- package/dist/guards.cjs +172 -0
- package/dist/guards.d.cts +399 -0
- package/dist/guards.d.mts +399 -0
- package/dist/guards.mjs +75 -0
- package/dist/hash-B6JPEyAz.d.mts +131 -0
- package/dist/hash-NTpeKYB_.d.cts +131 -0
- package/dist/hash.cjs +2126 -0
- package/dist/hash.d.cts +1239 -0
- package/dist/hash.d.mts +1239 -0
- package/dist/hash.mjs +2095 -0
- package/dist/http-status-BAZdtr7-.d.mts +65 -0
- package/dist/http-status-U_3MtoGb.d.cts +65 -0
- package/dist/http-status.cjs +173 -0
- package/dist/http-status.d.cts +142 -0
- package/dist/http-status.d.mts +142 -0
- package/dist/http-status.mjs +171 -0
- package/dist/index.cjs +2551 -0
- package/dist/index.d.cts +1493 -0
- package/dist/index.d.mts +1493 -0
- package/dist/index.mjs +2357 -0
- package/dist/object-B0TV3eHx.d.mts +8052 -0
- package/dist/object-Blq0Amdv.d.cts +8052 -0
- package/dist/objectify-CDs0Fbr1.mjs +417 -0
- package/dist/objectify-DIJ-OBmo.cjs +524 -0
- package/dist/paginator.cjs +245 -0
- package/dist/paginator.d.cts +144 -0
- package/dist/paginator.d.mts +144 -0
- package/dist/paginator.mjs +243 -0
- package/dist/parse-2ubxXZRp.cjs +211 -0
- package/dist/parse-N7g942uy.mjs +164 -0
- package/dist/pluralizer-BjMIc6uT.d.mts +42 -0
- package/dist/pluralizer-Cb6ZmrDl.d.cts +42 -0
- package/dist/pluralizer.cjs +678 -0
- package/dist/pluralizer.d.cts +152 -0
- package/dist/pluralizer.d.mts +152 -0
- package/dist/pluralizer.mjs +676 -0
- package/dist/primitives-B26uZolQ.cjs +228 -0
- package/dist/primitives-KsFUp3kQ.mjs +144 -0
- package/dist/specials-D48_IZbd.d.mts +108 -0
- package/dist/specials-DzLr1ZgU.cjs +477 -0
- package/dist/specials-LVONlKbQ.d.cts +108 -0
- package/dist/specials-uhDuRg8H.mjs +292 -0
- package/dist/string-CBAbxaG1.d.mts +258 -0
- package/dist/string-CsNsm_65.d.cts +258 -0
- package/dist/stylog.cjs +621 -0
- package/dist/stylog.d.cts +49 -0
- package/dist/stylog.d.mts +49 -0
- package/dist/stylog.mjs +614 -0
- package/dist/timezone-B2OYK6Fh.mjs +5589 -0
- package/dist/timezone-Beh9IGpw.cjs +5625 -0
- package/dist/types/array.cjs +16 -0
- package/dist/types/array.d.cts +18 -0
- package/dist/types/array.d.mts +18 -0
- package/dist/types/array.mjs +17 -0
- package/dist/types/colors.cjs +16 -0
- package/dist/types/colors.d.cts +18 -0
- package/dist/types/colors.d.mts +18 -0
- package/dist/types/colors.mjs +17 -0
- package/dist/types/converter.cjs +16 -0
- package/dist/types/converter.d.cts +18 -0
- package/dist/types/converter.d.mts +18 -0
- package/dist/types/converter.mjs +17 -0
- package/dist/types/form.cjs +16 -0
- package/dist/types/form.d.cts +18 -0
- package/dist/types/form.d.mts +18 -0
- package/dist/types/form.mjs +17 -0
- package/dist/types/hash.cjs +16 -0
- package/dist/types/hash.d.cts +18 -0
- package/dist/types/hash.d.mts +18 -0
- package/dist/types/hash.mjs +17 -0
- package/dist/types/http-status.cjs +16 -0
- package/dist/types/http-status.d.cts +18 -0
- package/dist/types/http-status.d.mts +18 -0
- package/dist/types/http-status.mjs +17 -0
- package/dist/types/index.cjs +16 -0
- package/dist/types/index.d.cts +18 -0
- package/dist/types/index.d.mts +18 -0
- package/dist/types/index.mjs +17 -0
- package/dist/types/number.cjs +16 -0
- package/dist/types/number.d.cts +18 -0
- package/dist/types/number.d.mts +18 -0
- package/dist/types/number.mjs +17 -0
- package/dist/types/object.cjs +16 -0
- package/dist/types/object.d.cts +18 -0
- package/dist/types/object.d.mts +18 -0
- package/dist/types/object.mjs +17 -0
- package/dist/types/pluralizer.cjs +16 -0
- package/dist/types/pluralizer.d.cts +18 -0
- package/dist/types/pluralizer.d.mts +18 -0
- package/dist/types/pluralizer.mjs +17 -0
- package/dist/types/string.cjs +16 -0
- package/dist/types/string.d.cts +18 -0
- package/dist/types/string.d.mts +18 -0
- package/dist/types/string.mjs +17 -0
- package/dist/types/stylog.cjs +16 -0
- package/dist/types/stylog.d.cts +18 -0
- package/dist/types/stylog.d.mts +18 -0
- package/dist/types/stylog.mjs +17 -0
- package/dist/types/utils.cjs +16 -0
- package/dist/types/utils.d.cts +18 -0
- package/dist/types/utils.d.mts +18 -0
- package/dist/types/utils.mjs +17 -0
- package/dist/types/verbalizer.cjs +16 -0
- package/dist/types/verbalizer.d.cts +30 -0
- package/dist/types/verbalizer.d.mts +30 -0
- package/dist/types/verbalizer.mjs +17 -0
- package/dist/utilities-CLUmdQeV.cjs +140 -0
- package/dist/utilities-m5yFKqLd.mjs +105 -0
- package/dist/utils-ClW9LA6f.mjs +449 -0
- package/dist/utils-DLFRgXUC.cjs +568 -0
- package/dist/verbalizer.cjs +998 -0
- package/dist/verbalizer.d.cts +148 -0
- package/dist/verbalizer.d.mts +148 -0
- package/dist/verbalizer.mjs +996 -0
- package/package.json +249 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the license notice for easier identification
|
|
187
|
+
within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 - present Nazmul Hassan
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { $ as Maybe, V as Branded, rn as Percent } from "./object-Blq0Amdv.cjs";
|
|
18
|
+
import { t as CSS_COLORS } from "./css-colors-Bx947Ng3.cjs";
|
|
19
|
+
|
|
20
|
+
//#region src/types/colors.d.ts
|
|
21
|
+
/** - A string, number for generating color. */
|
|
22
|
+
type ColorInput = string | number;
|
|
23
|
+
/** - An array of strings/numbers or nested arrays of strings/numbers for generating colors. */
|
|
24
|
+
type ColorInputArray = Array<ColorInput | ColorInputArray>;
|
|
25
|
+
/**
|
|
26
|
+
* * Represents a hexadecimal color code.
|
|
27
|
+
* * Format: `#3C6945`
|
|
28
|
+
*/
|
|
29
|
+
type Hex = `#${string}`;
|
|
30
|
+
/**
|
|
31
|
+
* * Represents a hexadecimal color code.
|
|
32
|
+
* * Format: `#3C6945`
|
|
33
|
+
*/
|
|
34
|
+
type Hex6 = Branded<Hex, 'Hex6'>;
|
|
35
|
+
/**
|
|
36
|
+
* * Represents an RGB color string.
|
|
37
|
+
* * Format: `rgb(R, G, B)`
|
|
38
|
+
*
|
|
39
|
+
* - R (Red): 0-255
|
|
40
|
+
* - G (Green): 0-255
|
|
41
|
+
* - B (Blue): 0-255
|
|
42
|
+
*/
|
|
43
|
+
type RGB = `rgb(${number}, ${number}, ${number})` | `rgb(${number},${number},${number})`;
|
|
44
|
+
/**
|
|
45
|
+
* * Represents an HSL color string.
|
|
46
|
+
* * Format: `hsl(H, S%, L%)`
|
|
47
|
+
*
|
|
48
|
+
* - H (Hue): 0-360
|
|
49
|
+
* - S (Saturation): 0-100%
|
|
50
|
+
* - L (Lightness): 0-100%
|
|
51
|
+
*/
|
|
52
|
+
type HSL = `hsl(${number}, ${number}%, ${number}%)` | `hsl(${number},${number}%,${number}%)`;
|
|
53
|
+
/**
|
|
54
|
+
* * Represents a hexadecimal color code with optional alpha channel.
|
|
55
|
+
* * Format: `#3C6945FF`
|
|
56
|
+
*/
|
|
57
|
+
type Hex8 = Branded<Hex, 'Hex8'>;
|
|
58
|
+
/**
|
|
59
|
+
* * Represents an RGBA color string, now includes optional alpha (opacity).
|
|
60
|
+
* * Format: `rgba(R, G, B, A)`
|
|
61
|
+
*/
|
|
62
|
+
type RGBA = `rgba(${number}, ${number}, ${number}, ${number})` | `rgba(${number},${number},${number},${number})`;
|
|
63
|
+
/**
|
|
64
|
+
* * Represents an HSLA color string with optional alpha channel.
|
|
65
|
+
* * Format: `hsla(H, S%, L%, A)`
|
|
66
|
+
*/
|
|
67
|
+
type HSLA = `hsla(${number}, ${number}%, ${number}%, ${number})` | `hsla(${number},${number}%,${number}%,${number})`;
|
|
68
|
+
/** Represents an object with `hex` (`hex6`) and `rgb` color */
|
|
69
|
+
type RandomHexRGB = {
|
|
70
|
+
/** Represents a hexadecimal color code. */hex: Hex6; /** Represents an RGB color string. */
|
|
71
|
+
rgb: RGB;
|
|
72
|
+
};
|
|
73
|
+
/** Basic color type: `hex`, `rgb` or `hsl`. */
|
|
74
|
+
type $ColorType = 'hex' | 'rgb' | 'hsl';
|
|
75
|
+
/** Options for random color generation. */
|
|
76
|
+
interface RandomColorOptions<C extends $ColorType> {
|
|
77
|
+
/** The type of expected return type of color: `hex`, `rgb` or `hsl`. Default is `'hex'`. */
|
|
78
|
+
colorType?: C | $ColorType;
|
|
79
|
+
/** The maximum number of recent colors to store in memory. Default is `16`. */
|
|
80
|
+
maxColors?: number;
|
|
81
|
+
}
|
|
82
|
+
/** Infers random color type (`Hex6`, `RGB`, or `HSL`) based on the provided color type `C`. */
|
|
83
|
+
type RandomColor<C extends Maybe<$ColorType> = undefined> = C extends undefined | 'hex' ? Hex6 : C extends 'hsl' ? HSL : C extends 'rgb' ? RGB : Hex6;
|
|
84
|
+
/** * Union type representing a color in Hex6, RGB, or HSL format. */
|
|
85
|
+
type ColorTypeSolid = Hex6 | RGB | HSL;
|
|
86
|
+
/** * Union type representing a color in Hex8, RGBA, or HSLA format. */
|
|
87
|
+
type ColorTypeAlpha = Hex8 | RGBA | HSLA;
|
|
88
|
+
/** * Union of Alpha & Solid `Hex`, `RGB` and `HSL` */
|
|
89
|
+
type ColorType = Hex | Hex6 | RGB | HSL | Hex8 | RGBA | HSLA;
|
|
90
|
+
/** - Colors Object that includes `Hex8`, `RGBA` and `HSLA` formats of the same color. */
|
|
91
|
+
interface SolidColors {
|
|
92
|
+
/** Represents a normal Hex color */
|
|
93
|
+
hex: Hex6;
|
|
94
|
+
/** Represents a normal RGB color */
|
|
95
|
+
rgb: RGB;
|
|
96
|
+
/** Represents a normal HSL color */
|
|
97
|
+
hsl: HSL;
|
|
98
|
+
}
|
|
99
|
+
/** - Colors Object that includes `Hex`, `RGB` and `HSL` formats of the same color. */
|
|
100
|
+
interface AlphaColors {
|
|
101
|
+
/** Represents a Hex color with alpha channel */
|
|
102
|
+
hex8: Hex8;
|
|
103
|
+
/** Represents a RGBA color with alpha channel */
|
|
104
|
+
rgba: RGBA;
|
|
105
|
+
/** Represents a HSLA color with alpha channel */
|
|
106
|
+
hsla: HSLA;
|
|
107
|
+
}
|
|
108
|
+
/** * Represents a tuple of three numerical values corresponding to RGB or HSL color components. */
|
|
109
|
+
type SolidValues = [number, number, number];
|
|
110
|
+
/** * Represents a tuple of four numerical values corresponding to RGBA or HSLA color components. */
|
|
111
|
+
type AlphaValues = [number, number, number, number];
|
|
112
|
+
/**
|
|
113
|
+
* * Represents the converted color formats for a given color type.
|
|
114
|
+
*
|
|
115
|
+
* - If the input is `Hex`, the output includes `RGB` and `HSL`.
|
|
116
|
+
* - If the input is `RGB`, the output includes `Hex` and `HSL`.
|
|
117
|
+
* - If the input is `HSL`, the output includes `Hex` and `RGB`.
|
|
118
|
+
*/
|
|
119
|
+
interface ConvertedColors<T extends ColorType> extends Record<string, ColorType> {
|
|
120
|
+
/** - The Hex representation (excluded if the input is already Hex). */
|
|
121
|
+
hex: T extends Hex6 | ColorTypeAlpha ? never : Hex6;
|
|
122
|
+
/** - The RGB representation (excluded if the input is already RGB). */
|
|
123
|
+
rgb: T extends RGB | ColorTypeAlpha ? never : RGB;
|
|
124
|
+
/** - The HSL representation (excluded if the input is already HSL). */
|
|
125
|
+
hsl: T extends HSL | ColorTypeAlpha ? never : HSL;
|
|
126
|
+
/** - The Hex8 representation with opacity (excluded if the input is already Hex8). */
|
|
127
|
+
hex8: T extends Hex8 | ColorTypeSolid ? never : Hex8;
|
|
128
|
+
/** - The RGBA representation (excluded if the input is already RGBA). */
|
|
129
|
+
rgba: T extends RGBA | ColorTypeSolid ? never : RGBA;
|
|
130
|
+
/** - The HSLA representation (excluded if the input is already HSLA). */
|
|
131
|
+
hsla: T extends HSLA | ColorTypeSolid ? never : HSLA;
|
|
132
|
+
}
|
|
133
|
+
/** Represents an alpha value between 0 and 1 */
|
|
134
|
+
type AlphaValue = Branded<number, 'AlphaValue'>;
|
|
135
|
+
/** An Object representing all the colors from `Color` constructor. */
|
|
136
|
+
interface Colors {
|
|
137
|
+
/** - `Hex` color (e.g., `#ff5733`) */
|
|
138
|
+
hex: Hex6;
|
|
139
|
+
/** - `Hex8` color (Hex with opacity, e.g., `#ff573380`) */
|
|
140
|
+
hex8: Hex8;
|
|
141
|
+
/** - `RGB` color (e.g., `rgb(255, 87, 51)`) */
|
|
142
|
+
rgb: RGB;
|
|
143
|
+
/** - `RGBA` color (e.g., `rgba(255, 87, 51, 1)`) */
|
|
144
|
+
rgba: RGBA;
|
|
145
|
+
/** - `HSL` color (e.g., `hsl(14, 100%, 60%)`) */
|
|
146
|
+
hsl: HSL;
|
|
147
|
+
/** - `HSLA` color (e.g., `hsla(14, 100%, 60%, 1)`) */
|
|
148
|
+
hsla: HSLA;
|
|
149
|
+
}
|
|
150
|
+
/** Analogous colors */
|
|
151
|
+
type Analogous = [Color, Color, Color];
|
|
152
|
+
/** Triad color */
|
|
153
|
+
type Triad = [Color, Color, Color];
|
|
154
|
+
/** Tetrad color */
|
|
155
|
+
type Tetrad = [Color, Color, Color, Color];
|
|
156
|
+
/** CSS named color, also includes different response colors */
|
|
157
|
+
type CSSColor = keyof typeof CSS_COLORS;
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/colors/Color.d.ts
|
|
160
|
+
/**
|
|
161
|
+
* @class Represents a color in {@link Hex6 Hex}, {@link Hex8}, {@link RGB}, {@link RGBA}, {@link HSL}, and {@link HSLA} formats.
|
|
162
|
+
*
|
|
163
|
+
* @remarks
|
|
164
|
+
* - Instance methods allow transforming, adjusting, and deriving new colors.
|
|
165
|
+
* - Static methods provide format validation and type-guard–style checks for supported color representations.
|
|
166
|
+
*
|
|
167
|
+
* @property `hex` - {@link Hex6 Hex} color representation (without alpha).
|
|
168
|
+
* @property `hex8` - {@link Hex8} color representation including alpha.
|
|
169
|
+
* @property `rgb` - {@link RGB} color representation (without alpha).
|
|
170
|
+
* @property `rgba` - {@link RGBA} color representation including alpha.
|
|
171
|
+
* @property `hsl` - {@link HSL} color representation (without alpha).
|
|
172
|
+
* @property `hsla` - {@link HSLA} color representation including alpha.
|
|
173
|
+
*/
|
|
174
|
+
declare class Color {
|
|
175
|
+
#private;
|
|
176
|
+
readonly hex: Hex6;
|
|
177
|
+
readonly hex8: Hex8;
|
|
178
|
+
readonly rgb: RGB;
|
|
179
|
+
readonly rgba: RGBA;
|
|
180
|
+
readonly hsl: HSL;
|
|
181
|
+
readonly hsla: HSLA;
|
|
182
|
+
/**
|
|
183
|
+
* * Creates a new `Color` instance with a random color and automatically converts the generated color to all other supported formats: {@link Hex6 Hex}, {@link Hex8}, {@link RGB}, {@link RGBA}, {@link HSL}, and {@link HSLA}.
|
|
184
|
+
*
|
|
185
|
+
* @description
|
|
186
|
+
* The `Color` class generates a random color in six common color representations:
|
|
187
|
+
* - {@link Hex6 Hex} (e.g., `#ff5733`)
|
|
188
|
+
* - {@link Hex8} (Hex with opacity, e.g., `#ff573380`)
|
|
189
|
+
* - {@link RGB} (e.g., `rgb(255, 87, 51)`)
|
|
190
|
+
* - {@link RGBA} (e.g., `rgba(255, 87, 51, 1)`)
|
|
191
|
+
* - {@link HSL} (e.g., `hsl(14, 100%, 60%)`)
|
|
192
|
+
* - {@link HSLA} (e.g., `hsla(14, 100%, 60%, 1)`)
|
|
193
|
+
*
|
|
194
|
+
* @remarks
|
|
195
|
+
* - Instance methods allow transforming, adjusting, and deriving new colors.
|
|
196
|
+
* - Static methods provide format validation and type-guard–style checks for supported color representations.
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* // Generate a random color
|
|
200
|
+
* const randomColor = new Color();
|
|
201
|
+
* console.log(randomColor.hex, randomColor.rgb, randomColor.hsl);
|
|
202
|
+
*
|
|
203
|
+
* @returns Instance of `Color`.
|
|
204
|
+
*/
|
|
205
|
+
constructor();
|
|
206
|
+
/**
|
|
207
|
+
* * Creates a new `Color` instance with the input color and automatically converts it to all other supported formats: {@link Hex6 Hex}, {@link Hex8}, {@link RGB}, {@link RGBA}, {@link HSL}, and {@link HSLA}.
|
|
208
|
+
*
|
|
209
|
+
* @description
|
|
210
|
+
* The `Color` class allows seamless transformation between six common color representations:
|
|
211
|
+
* - {@link Hex6 Hex} (e.g., `#ff5733`)
|
|
212
|
+
* - {@link Hex8} (Hex with opacity, e.g., `#ff573380`)
|
|
213
|
+
* - {@link RGB} (e.g., `rgb(255, 87, 51)`)
|
|
214
|
+
* - {@link RGBA} (e.g., `rgba(255, 87, 51, 1)`)
|
|
215
|
+
* - {@link HSL} (e.g., `hsl(14, 100%, 60%)`)
|
|
216
|
+
* - {@link HSLA} (e.g., `hsla(14, 100%, 60%, 1)`)
|
|
217
|
+
*
|
|
218
|
+
* You can create a color from any of these formats, and the class will populate the rest.
|
|
219
|
+
*
|
|
220
|
+
* @remarks
|
|
221
|
+
* - Instance methods allow transforming, adjusting, and deriving new colors.
|
|
222
|
+
* - Static methods provide format validation and type-guard–style checks for supported color representations.
|
|
223
|
+
*
|
|
224
|
+
* @param color - A color string in any supported format (`Hex`, `Hex8`, `RGB`, `RGBA`, `HSL`, or `HSLA`) to convert in all other formats (includes the current format).
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* // Convert an existing Hex color to all other formats
|
|
228
|
+
* const color = new Color("#ff5733");
|
|
229
|
+
* console.log(color.rgb); // 'rgb(255, 87, 51)'
|
|
230
|
+
* console.log(color.hsl); // 'hsl(14, 100%, 60%)'
|
|
231
|
+
* console.log(color.rgba); // 'rgba(255, 87, 51, 1)'
|
|
232
|
+
* console.log(color.hsla); // 'hsla(14, 100%, 60%, 1)'
|
|
233
|
+
* console.log(color.hex8); // '#FF5733FF'
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* // Handle a color with alpha
|
|
237
|
+
* const alphaColor = new Color("rgba(255, 0, 0, 0.5)");
|
|
238
|
+
* console.log(alphaColor.hex8); // '#FF000080'
|
|
239
|
+
* console.log(alphaColor.hsla); // 'hsla(0, 100%, 50%, 0.5)'
|
|
240
|
+
*
|
|
241
|
+
* @returns Instance of `Color`.
|
|
242
|
+
*/
|
|
243
|
+
constructor(color: ColorType);
|
|
244
|
+
/**
|
|
245
|
+
* * Creates a new `Color` instance using a standard (CSS) named color and automatically converts it to all other supported formats: {@link Hex6 Hex}, {@link Hex8}, {@link RGB}, {@link RGBA}, {@link HSL}, and {@link HSLA}.
|
|
246
|
+
*
|
|
247
|
+
* @description
|
|
248
|
+
* This allows you to use any valid named color from standard `150+` CSS color names (e.g., `"red"`, `"blue"`, `"rebeccapurple"`)
|
|
249
|
+
*
|
|
250
|
+
* @param color - A named color string from standard `150+` CSS color names ({@link CSSColor}).
|
|
251
|
+
*
|
|
252
|
+
* @remarks
|
|
253
|
+
* - Instance methods allow transforming, adjusting, and deriving new colors.
|
|
254
|
+
* - Static methods provide format validation and type-guard–style checks for supported color representations.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* // Using a CSS named color
|
|
258
|
+
* const sky = new Color("skyblue");
|
|
259
|
+
* console.log(sky.hex); // '#87CEEB'
|
|
260
|
+
* console.log(sky.rgba); // 'rgba(135, 206, 235, 1)'
|
|
261
|
+
*
|
|
262
|
+
* @returns Instance of `Color`.
|
|
263
|
+
*/
|
|
264
|
+
constructor(color: CSSColor);
|
|
265
|
+
/**
|
|
266
|
+
* * Creates a new `Color` instance and automatically converts the input color to all other supported formats: {@link Hex6 Hex}, {@link Hex8}, {@link RGB}, {@link RGBA}, {@link HSL}, and {@link HSLA}.
|
|
267
|
+
*
|
|
268
|
+
* @description
|
|
269
|
+
* The `Color` class allows seamless transformation between six common color representations:
|
|
270
|
+
* - {@link Hex6 Hex} (e.g., `#ff5733`)
|
|
271
|
+
* - {@link Hex8} (Hex with opacity, e.g., `#ff573380`)
|
|
272
|
+
* - {@link RGB} (e.g., `rgb(255, 87, 51)`)
|
|
273
|
+
* - {@link RGBA} (e.g., `rgba(255, 87, 51, 1)`)
|
|
274
|
+
* - {@link HSL} (e.g., `hsl(14, 100%, 60%)`)
|
|
275
|
+
* - {@link HSLA} (e.g., `hsla(14, 100%, 60%, 1)`)
|
|
276
|
+
*
|
|
277
|
+
* You can create a color from any of these formats, and the class will populate the rest.
|
|
278
|
+
* If no color is passed, a random color will be generated.
|
|
279
|
+
*
|
|
280
|
+
* @remarks
|
|
281
|
+
* - Instance methods allow transforming, adjusting, and deriving new colors.
|
|
282
|
+
* - Static methods provide format validation and type-guard–style checks for supported color representations.
|
|
283
|
+
*
|
|
284
|
+
* @param color - An optional input color string in any supported format (`Hex`, `Hex8`, `RGB`, `RGBA`, `HSL`, or `HSLA`) or a named color string from standard `150+` CSS color names ({@link CSSColor}) to convert in all other (includes the current format) formats.
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* // Convert an existing Hex color to all other formats
|
|
288
|
+
* const color = new Color("#ff5733");
|
|
289
|
+
* console.log(color.rgb); // 'rgb(255, 87, 51)'
|
|
290
|
+
* console.log(color.hsl); // 'hsl(14, 100%, 60%)'
|
|
291
|
+
* console.log(color.rgba); // 'rgba(255, 87, 51, 1)'
|
|
292
|
+
* console.log(color.hsla); // 'hsla(14, 100%, 60%, 1)'
|
|
293
|
+
* console.log(color.hex8); // '#FF5733FF'
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* // Handle a color with alpha
|
|
297
|
+
* const alphaColor = new Color("rgba(255, 0, 0, 0.5)");
|
|
298
|
+
* console.log(alphaColor.hex8); // '#FF000080'
|
|
299
|
+
* console.log(alphaColor.hsla); // 'hsla(0, 100%, 50%, 0.5)'
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* // Generate a random color
|
|
303
|
+
* const randomColor = new Color();
|
|
304
|
+
* console.log(randomColor.hex, randomColor.rgb, randomColor.hsl);
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* // Using a CSS named color
|
|
308
|
+
* const sky = new Color("skyblue");
|
|
309
|
+
* console.log(sky.hex); // '#87CEEB'
|
|
310
|
+
* console.log(sky.rgba); // 'rgba(135, 206, 235, 1)'
|
|
311
|
+
*
|
|
312
|
+
* @returns Instance of `Color`.
|
|
313
|
+
*/
|
|
314
|
+
constructor(color?: ColorType | CSSColor);
|
|
315
|
+
/** Iterates over the color representations (`Hex`, `RGB`, `HSL`). */
|
|
316
|
+
[Symbol.iterator](): Generator<Hex6 | Hex8 | RGB | RGBA | HSL | HSLA, void, unknown>;
|
|
317
|
+
/**
|
|
318
|
+
* @instance Applies or modifies the opacity of a color and returns a new instance.
|
|
319
|
+
*
|
|
320
|
+
* @remarks
|
|
321
|
+
* - For solid colors ({@link Hex6}/{@link RGB}/{@link HSL}): Adds an alpha channel with the specified opacity.
|
|
322
|
+
* - For alpha colors ({@link Hex8}/{@link RGBA}/{@link HSLA}): Updates the existing alpha channel.
|
|
323
|
+
*
|
|
324
|
+
* @param opacity - A number between `0-100` representing the opacity percentage.
|
|
325
|
+
* @returns A new instance of `Color` containing all color formats with the applied opacity.
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* const color = new Color("#ff0000");
|
|
329
|
+
* const alpha50 = color.applyOpacity(50); // 50% opacity
|
|
330
|
+
* console.log(alpha50.rgba); // rgba(255, 0, 0, 0.5)
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* const alphaColor = new Color("#ff000080"); // Color with 50% opacity
|
|
334
|
+
* const alpha75 = alphaColor.applyOpacity(75); // Change to 75% opacity
|
|
335
|
+
* console.log(alpha75.hex8); // #FF0000BF
|
|
336
|
+
*/
|
|
337
|
+
applyOpacity(opacity: Percent): Color;
|
|
338
|
+
/**
|
|
339
|
+
* @instance Darkens the color by reducing the lightness by the given percentage.
|
|
340
|
+
* @param percent - The percentage to darken (`0–100`).
|
|
341
|
+
* @returns A new `Color` instance with the modified darkness.
|
|
342
|
+
*/
|
|
343
|
+
applyDarkness(percent: Percent): Color;
|
|
344
|
+
/**
|
|
345
|
+
* @instance Lightens the color by increasing the lightness by the given percentage.
|
|
346
|
+
* @param percent - The percentage to brighten (`0–100`).
|
|
347
|
+
* @returns A new `Color` instance with the modified lightness.
|
|
348
|
+
*/
|
|
349
|
+
applyBrightness(percent: Percent): Color;
|
|
350
|
+
/**
|
|
351
|
+
* @instance Reduces the saturation of the color to make it appear duller.
|
|
352
|
+
* @param percent - The percentage to reduce saturation (`0–100`).
|
|
353
|
+
* @returns A new `Color` instance with the modified saturation.
|
|
354
|
+
*/
|
|
355
|
+
applyDullness(percent: Percent): Color;
|
|
356
|
+
/**
|
|
357
|
+
* @instance Softens the color toward white by reducing saturation and increasing lightness based on a percentage.
|
|
358
|
+
*
|
|
359
|
+
* @remarks
|
|
360
|
+
* This creates a soft UI-like white shade effect (similar to some UI libraries' light color scale).
|
|
361
|
+
*
|
|
362
|
+
* @param percent - Value from `0` to `100` representing how far to push the color toward white.
|
|
363
|
+
* @returns A new `Color` instance shifted toward white.
|
|
364
|
+
*/
|
|
365
|
+
applyWhiteShade(percent: Percent): Color;
|
|
366
|
+
/**
|
|
367
|
+
* @instance Blends the current color with another color based on the given weight.
|
|
368
|
+
*
|
|
369
|
+
* @remarks
|
|
370
|
+
* If any of the input colors has opacity (alpha channel), it might be lost or distorted from the generated alpha variants of the respective color formats.
|
|
371
|
+
*
|
|
372
|
+
* @param other - The color in any of 6 ({@link Hex6 Hex}, {@link Hex8}, {@link RGB}, {@link RGBA}, {@link HSL} or {@link HSLA}) formats or a {@link CSSColor} to blend with.
|
|
373
|
+
* @param weight - A number from `0` to `1` indicating the weight of the other color. Defaults to `0.5`.
|
|
374
|
+
* - `weight = 0` → only the original color.
|
|
375
|
+
* - `weight = 1` → only the other color.
|
|
376
|
+
* - `weight = 0.5` → equal blend between the two.
|
|
377
|
+
* @returns A new `Color` instance representing the blended result, with proper alpha blending.
|
|
378
|
+
*/
|
|
379
|
+
blendWith(other: ColorType | CSSColor, weight?: number): Color;
|
|
380
|
+
/**
|
|
381
|
+
* @instance Calculates the contrast ratio between this color and another color (WCAG).
|
|
382
|
+
* @param other - The other color to compare against.
|
|
383
|
+
* @returns A number representing the contrast ratio (rounded to 2 decimal places).
|
|
384
|
+
*/
|
|
385
|
+
contrastRatio(other: ColorType | CSSColor): number;
|
|
386
|
+
/**
|
|
387
|
+
* @instance Returns the complementary color by rotating the hue 180 degrees.
|
|
388
|
+
* @returns A new `Color` that is the complement of the current color.
|
|
389
|
+
*/
|
|
390
|
+
getComplementaryColor(): Color;
|
|
391
|
+
/**
|
|
392
|
+
* @instance Generates a color scheme of analogous colors, including the base color.
|
|
393
|
+
*
|
|
394
|
+
* @remarks
|
|
395
|
+
* Analogous colors are next to each other on the color wheel (±30°).
|
|
396
|
+
*
|
|
397
|
+
* @returns An array of three `Color` instances: `[base, left, right]`.
|
|
398
|
+
*/
|
|
399
|
+
getAnalogousColors(): Analogous;
|
|
400
|
+
/**
|
|
401
|
+
* @instance Generates a color triad scheme including the base color.
|
|
402
|
+
*
|
|
403
|
+
* @remarks
|
|
404
|
+
* Triadic colors are evenly spaced (120° apart) on the color wheel.
|
|
405
|
+
*
|
|
406
|
+
* @returns An array of three `Color` instances: `[base, triad1, triad2]`.
|
|
407
|
+
*/
|
|
408
|
+
getTriadColors(): Triad;
|
|
409
|
+
/**
|
|
410
|
+
* @instance Generates a tetradic color scheme including the base color.
|
|
411
|
+
*
|
|
412
|
+
* @remarks
|
|
413
|
+
* Tetradic colors form a rectangle on the color wheel (90° apart).
|
|
414
|
+
*
|
|
415
|
+
* @returns An array of four `Color` instances: `[base, tetrad1, tetrad2, tetrad3]`.
|
|
416
|
+
*/
|
|
417
|
+
getTetradColors(): Tetrad;
|
|
418
|
+
/**
|
|
419
|
+
* @instance Gets the `WCAG` accessibility rating between this and another color.
|
|
420
|
+
* @param other - The other color to test contrast against.
|
|
421
|
+
* @returns `'Fail'`, `'AA'`, or `'AAA'` based on `WCAG 2.1` contrast standards.
|
|
422
|
+
*/
|
|
423
|
+
getWCAGRating(other: ColorType | CSSColor): 'Fail' | 'AA' | 'AAA';
|
|
424
|
+
/**
|
|
425
|
+
* @instance Determines if the color is light based on its perceived brightness.
|
|
426
|
+
* @param threshold Optional brightness threshold (`0–255`). Defaults to `127.5`.
|
|
427
|
+
* @remarks The brightness {@link threshold} is clamped to the valid *RGB range* (`0–255`) to prevent invalid comparisons.
|
|
428
|
+
* @returns `true` if light, `false` if dark.
|
|
429
|
+
*/
|
|
430
|
+
isLightColor(threshold?: number): boolean;
|
|
431
|
+
/**
|
|
432
|
+
* @static Checks if a color is in {@link Hex6} format.
|
|
433
|
+
*
|
|
434
|
+
* @param color Color to check.
|
|
435
|
+
* @returns Boolean: `true` if it's a {@link Hex6} color, `false` if not.
|
|
436
|
+
*/
|
|
437
|
+
static isHex6(color: string): color is Hex6;
|
|
438
|
+
/**
|
|
439
|
+
* @static Checks if a color is in {@link Hex8} format.
|
|
440
|
+
*
|
|
441
|
+
* @param color Color to check.
|
|
442
|
+
* @returns Boolean: `true` if it's a {@link Hex8} color, `false` if not.
|
|
443
|
+
*/
|
|
444
|
+
static isHex8(color: string): color is Hex8;
|
|
445
|
+
/**
|
|
446
|
+
* @static Checks if a color is in {@link RGB} format and within valid ranges.
|
|
447
|
+
*
|
|
448
|
+
* @param color Color to check.
|
|
449
|
+
* @returns `true` if it's a {@link RGB} color, `false` if not.
|
|
450
|
+
*/
|
|
451
|
+
static isRGB(color: string): color is RGB;
|
|
452
|
+
/**
|
|
453
|
+
* @static Checks if a color is in {@link RGBA} format and within valid ranges.
|
|
454
|
+
*
|
|
455
|
+
* @param color Color to check.
|
|
456
|
+
* @returns `true` if it's a {@link RGBA} color, `false` if not.
|
|
457
|
+
*/
|
|
458
|
+
static isRGBA(color: string): color is RGBA;
|
|
459
|
+
/**
|
|
460
|
+
* @static Checks if a color is in {@link HSL} format and within valid ranges.
|
|
461
|
+
*
|
|
462
|
+
* @param color Color to check.
|
|
463
|
+
* @returns `true` if it's a {@link HSL} color, `false` if not.
|
|
464
|
+
*/
|
|
465
|
+
static isHSL(color: string): color is HSL;
|
|
466
|
+
/**
|
|
467
|
+
* @static Checks if a color is in {@link HSLA} format and within valid ranges.
|
|
468
|
+
*
|
|
469
|
+
* @param color Color to check.
|
|
470
|
+
* @returns `true` if it's a {@link HSLA} color, `false` if not.
|
|
471
|
+
*/
|
|
472
|
+
static isHSLA(color: string): color is HSLA;
|
|
473
|
+
/**
|
|
474
|
+
* @static Checks if a color is a valid CSS color name ({@link CSSColor}).
|
|
475
|
+
*
|
|
476
|
+
* @remarks
|
|
477
|
+
* - This method checks against a predefined list of CSS color names.
|
|
478
|
+
* - It does not validate format types like `Hex`, `RGB`, or `HSL` or their alpha channels.
|
|
479
|
+
*
|
|
480
|
+
* @param color - The color to check.
|
|
481
|
+
* @returns `true` if the color is a valid CSS color name, `false` otherwise.
|
|
482
|
+
*/
|
|
483
|
+
static isCSSColor(color: string): color is CSSColor;
|
|
484
|
+
}
|
|
485
|
+
//#endregion
|
|
486
|
+
export { RandomColorOptions as C, Tetrad as D, SolidValues as E, Triad as O, RandomColor as S, SolidColors as T, Hex as _, AlphaValues as a, RGB as b, ColorInput as c, ColorTypeAlpha as d, ColorTypeSolid as f, HSLA as g, HSL as h, AlphaValue as i, ColorInputArray as l, ConvertedColors as m, $ColorType as n, Analogous as o, Colors as p, AlphaColors as r, CSSColor as s, Color as t, ColorType as u, Hex6 as v, RandomHexRGB as w, RGBA as x, Hex8 as y };
|