@oscarpalmer/atoms 0.188.0 → 0.189.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.
Files changed (130) hide show
  1. package/dist/array/difference.d.mts +0 -1
  2. package/dist/array/exists.d.mts +0 -1
  3. package/dist/array/filter.d.mts +0 -1
  4. package/dist/array/find.d.mts +0 -1
  5. package/dist/array/first.d.mts +0 -1
  6. package/dist/array/flatten.d.mts +0 -1
  7. package/dist/array/get.d.mts +0 -1
  8. package/dist/array/group-by.d.mts +0 -1
  9. package/dist/array/last.d.mts +0 -1
  10. package/dist/array/match.d.mts +0 -1
  11. package/dist/array/match.mjs +3 -3
  12. package/dist/array/move.d.mts +0 -1
  13. package/dist/array/partition.d.mts +0 -1
  14. package/dist/array/select.d.mts +0 -1
  15. package/dist/array/select.mjs +2 -1
  16. package/dist/array/single.d.mts +0 -1
  17. package/dist/array/slice.d.mts +0 -1
  18. package/dist/array/sort.d.mts +1 -2
  19. package/dist/array/sort.mjs +0 -1
  20. package/dist/array/swap.d.mts +0 -1
  21. package/dist/array/to-map.d.mts +0 -1
  22. package/dist/array/to-record.d.mts +0 -1
  23. package/dist/array/to-set.d.mts +0 -1
  24. package/dist/array/toggle.d.mts +0 -1
  25. package/dist/array/unique.d.mts +0 -1
  26. package/dist/array/update.d.mts +0 -1
  27. package/dist/color/constants.d.mts +9 -10
  28. package/dist/color/constants.mjs +15 -7
  29. package/dist/color/index.d.mts +9 -9
  30. package/dist/color/index.mjs +8 -7
  31. package/dist/color/instance.d.mts +35 -8
  32. package/dist/color/instance.mjs +53 -13
  33. package/dist/color/misc/alpha.d.mts +0 -1
  34. package/dist/color/misc/alpha.mjs +5 -5
  35. package/dist/color/misc/get.d.mts +42 -13
  36. package/dist/color/misc/get.mjs +45 -24
  37. package/dist/color/misc/index.d.mts +4 -4
  38. package/dist/color/misc/index.mjs +12 -12
  39. package/dist/color/misc/is.d.mts +56 -3
  40. package/dist/color/misc/is.mjs +72 -4
  41. package/dist/color/misc/state.d.mts +2 -2
  42. package/dist/color/misc/state.mjs +79 -43
  43. package/dist/color/models.d.mts +18 -2
  44. package/dist/color/space/hex.d.mts +38 -5
  45. package/dist/color/space/hex.mjs +57 -9
  46. package/dist/color/space/hsl.d.mts +33 -7
  47. package/dist/color/space/hsl.mjs +65 -14
  48. package/dist/color/space/hwb.d.mts +52 -0
  49. package/dist/color/space/hwb.mjs +99 -0
  50. package/dist/color/space/rgb.d.mts +26 -5
  51. package/dist/color/space/rgb.mjs +82 -28
  52. package/dist/function/assert.d.mts +1 -2
  53. package/dist/function/limit.d.mts +0 -1
  54. package/dist/function/memoize.d.mts +0 -1
  55. package/dist/function/once.d.mts +0 -1
  56. package/dist/function/retry.d.mts +0 -1
  57. package/dist/function/work.d.mts +0 -1
  58. package/dist/herald.d.mts +0 -1
  59. package/dist/index.d.mts +296 -51
  60. package/dist/index.mjs +664 -265
  61. package/dist/internal/array/callbacks.d.mts +0 -1
  62. package/dist/internal/array/callbacks.mjs +0 -1
  63. package/dist/internal/array/group.d.mts +0 -1
  64. package/dist/internal/array/index-of.d.mts +0 -1
  65. package/dist/internal/function/timer.d.mts +0 -1
  66. package/dist/internal/is.d.mts +0 -1
  67. package/dist/internal/is.mjs +1 -1
  68. package/dist/internal/math/aggregate.d.mts +0 -1
  69. package/dist/internal/math/misc.d.mts +12 -0
  70. package/dist/internal/math/misc.mjs +19 -0
  71. package/dist/internal/result.d.mts +0 -1
  72. package/dist/internal/value/compare.d.mts +0 -1
  73. package/dist/internal/value/equal.d.mts +0 -1
  74. package/dist/internal/value/get.d.mts +0 -1
  75. package/dist/internal/value/handlers.d.mts +0 -1
  76. package/dist/internal/value/has.d.mts +0 -1
  77. package/dist/internal/value/misc.d.mts +0 -1
  78. package/dist/internal/value/set.d.mts +0 -1
  79. package/dist/is.d.mts +0 -1
  80. package/dist/math.d.mts +1 -9
  81. package/dist/math.mjs +1 -16
  82. package/dist/models.d.mts +6 -6
  83. package/dist/promise/delay.d.mts +0 -1
  84. package/dist/promise/helpers.d.mts +0 -1
  85. package/dist/promise/index.d.mts +0 -1
  86. package/dist/promise/misc.d.mts +0 -1
  87. package/dist/promise/models.d.mts +4 -5
  88. package/dist/promise/models.mjs +1 -1
  89. package/dist/promise/timed.d.mts +0 -1
  90. package/dist/query.d.mts +0 -1
  91. package/dist/query.mjs +1 -1
  92. package/dist/queue.d.mts +0 -1
  93. package/dist/random.d.mts +0 -1
  94. package/dist/result/index.d.mts +0 -1
  95. package/dist/result/index.mjs +2 -1
  96. package/dist/result/match.d.mts +0 -1
  97. package/dist/result/misc.d.mts +0 -1
  98. package/dist/result/models.d.mts +0 -1
  99. package/dist/result/work/flow.d.mts +0 -1
  100. package/dist/result/work/pipe.d.mts +0 -1
  101. package/dist/string/fuzzy.d.mts +0 -1
  102. package/dist/string/index.d.mts +0 -1
  103. package/dist/string/index.mjs +8 -7
  104. package/dist/string/template.d.mts +0 -1
  105. package/dist/value/clone.d.mts +0 -1
  106. package/dist/value/freeze.d.mts +1 -2
  107. package/dist/value/merge.d.mts +0 -1
  108. package/dist/value/omit.d.mts +0 -1
  109. package/dist/value/pick.d.mts +0 -1
  110. package/dist/value/shake.d.mts +1 -2
  111. package/dist/value/smush.d.mts +1 -2
  112. package/dist/value/transform.d.mts +1 -2
  113. package/dist/value/unsmush.d.mts +1 -2
  114. package/package.json +5 -5
  115. package/src/color/constants.ts +17 -13
  116. package/src/color/index.ts +21 -6
  117. package/src/color/instance.ts +67 -14
  118. package/src/color/misc/alpha.ts +6 -10
  119. package/src/color/misc/get.ts +70 -16
  120. package/src/color/misc/index.ts +18 -17
  121. package/src/color/misc/is.ts +86 -3
  122. package/src/color/misc/state.ts +126 -40
  123. package/src/color/models.ts +19 -1
  124. package/src/color/space/hex.ts +55 -8
  125. package/src/color/space/hsl.ts +80 -14
  126. package/src/color/space/hwb.ts +123 -0
  127. package/src/color/space/rgb.ts +108 -27
  128. package/src/internal/math/misc.ts +28 -0
  129. package/src/math.ts +2 -29
  130. package/src/string/index.ts +13 -11
package/dist/index.mjs CHANGED
@@ -4,7 +4,6 @@ function getArrayCallback(value) {
4
4
  case "function": return value;
5
5
  case "number":
6
6
  case "string": return typeof value === "string" && value.includes(".") ? void 0 : (obj) => obj[value];
7
- default: break;
8
7
  }
9
8
  }
10
9
  function getArrayCallbacks(bool, key, value) {
@@ -350,7 +349,7 @@ function isTemplateStringsArray(value) {
350
349
  * @returns `true` if the value is a typed array, otherwise `false`
351
350
  */
352
351
  function isTypedArray(value) {
353
- isTypedArray.types ??= new Set([
352
+ isTypedArray.types ??= /* @__PURE__ */ new Set([
354
353
  Int8Array,
355
354
  Uint8Array,
356
355
  Uint8ClampedArray,
@@ -609,11 +608,11 @@ const COMPARISON_INVALID = "invalid";
609
608
  const COMPARISON_OUTSIDE = "outside";
610
609
  const COMPARISON_SAME = "same";
611
610
  const COMPARISON_START = "start";
612
- const endings = new Set([COMPARISON_END, COMPARISON_SAME]);
611
+ const endings = /* @__PURE__ */ new Set([COMPARISON_END, COMPARISON_SAME]);
613
612
  const invalid = [-1, COMPARISON_INVALID];
614
613
  const outside = [-1, COMPARISON_OUTSIDE];
615
- const outsides = new Set([COMPARISON_INVALID, COMPARISON_OUTSIDE]);
616
- const starts = new Set([COMPARISON_START, COMPARISON_SAME]);
614
+ const outsides = /* @__PURE__ */ new Set([COMPARISON_INVALID, COMPARISON_OUTSIDE]);
615
+ const starts = /* @__PURE__ */ new Set([COMPARISON_START, COMPARISON_SAME]);
617
616
  //#endregion
618
617
  //#region src/array/push.ts
619
618
  /**
@@ -1207,7 +1206,6 @@ function getSorter(value, modifier) {
1207
1206
  case typeof value === "function": return getComparisonSorter(value, modifier);
1208
1207
  case typeof value === "string": return getValueSorter(value, modifier);
1209
1208
  case isPlainObject(value): return getObjectSorter(value, modifier);
1210
- default: break;
1211
1209
  }
1212
1210
  }
1213
1211
  function getSorters(value, modifier) {
@@ -3061,23 +3059,22 @@ function dedent(value, ...values) {
3061
3059
  */
3062
3060
  function getUuid(html) {
3063
3061
  const forHTML = html === true;
3064
- let uuid;
3065
3062
  while (true) {
3066
- const bytes = new Uint8Array(16);
3063
+ const bytes = /* @__PURE__ */ new Uint8Array(16);
3067
3064
  crypto.getRandomValues(bytes);
3068
3065
  bytes[6] = bytes[6] & 15 | 64;
3069
3066
  bytes[8] = bytes[8] & 63 | 128;
3070
3067
  const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, ZERO)).join("");
3071
- uuid = [
3072
- hex.substring(0, 8),
3068
+ const first = hex.substring(0, 8);
3069
+ if (forHTML && NUMERICAL_PREFIX_PATTERN.test(first)) continue;
3070
+ return [
3071
+ first,
3073
3072
  hex.substring(8, 12),
3074
3073
  hex.substring(12, 16),
3075
3074
  hex.substring(16, 20),
3076
3075
  hex.substring(20, 32)
3077
- ].join("-");
3078
- if (!forHTML || !NUMERICAL_PREFIX_PATTERN.test(uuid)) break;
3076
+ ].join(forHTML ? DELIMITER_UUID_HTML : DELIMITER_UUID_DEFAULT);
3079
3077
  }
3080
- return uuid;
3081
3078
  }
3082
3079
  /**
3083
3080
  * Parse a JSON string into its proper value _(or `undefined` if it fails)_
@@ -3119,6 +3116,8 @@ function truncate(value, length, suffix) {
3119
3116
  const truncatedLength = length - actualSuffixLength;
3120
3117
  return `${value.slice(0, truncatedLength)}${actualSuffix}`;
3121
3118
  }
3119
+ const DELIMITER_UUID_DEFAULT = "-";
3120
+ const DELIMITER_UUID_HTML = "_";
3122
3121
  const NUMERICAL_PREFIX_PATTERN = /^\d/;
3123
3122
  const ZERO = "0";
3124
3123
  //#endregion
@@ -4064,15 +4063,52 @@ const MESSAGE_BEACON = "Cannot retrieve observable from a destroyed beacon";
4064
4063
  const MESSAGE_OBSERVABLE = "Cannot subscribe to a destroyed observable";
4065
4064
  const TYPE_ERROR = "error";
4066
4065
  const TYPE_NEXT = "next";
4066
+ //#endregion
4067
+ //#region src/internal/math/misc.ts
4068
+ /**
4069
+ * Round a number
4070
+ *
4071
+ * @param value Number to round
4072
+ * @param decimals Number of decimal places to round to _(defaults to `0`)_
4073
+ * @returns Rounded number, or `Number.NaN` if the value if unable to be rounded
4074
+ */
4075
+ function round(value, decimals) {
4076
+ return roundNumber(Math.round, value, decimals);
4077
+ }
4078
+ function roundNumber(callback, value, decimals) {
4079
+ if (typeof value !== "number") return NaN;
4080
+ if (typeof decimals !== "number" || decimals < 1) return callback(value);
4081
+ const mod = 10 ** decimals;
4082
+ return callback((value + Number.EPSILON) * mod) / mod;
4083
+ }
4084
+ //#endregion
4085
+ //#region src/color/misc/index.ts
4086
+ function formatHslColor(color, alpha) {
4087
+ const { hue, lightness, saturation } = color.hsl;
4088
+ return `hsl(${hue}deg ${saturation}% ${lightness}%${alpha ? ` / ${color.alpha}%` : ""})`;
4089
+ }
4090
+ function formatHwbColor(color, alpha) {
4091
+ const { blackness, hue, whiteness } = color.hwb;
4092
+ return `hwb(${hue}deg ${whiteness}% ${blackness}%${alpha ? ` / ${color.alpha}%` : ""})`;
4093
+ }
4094
+ function formatRgbColor(color, alpha) {
4095
+ const { blue, green, red } = color.rgb;
4096
+ return `rgb(${red} ${green} ${blue}${alpha ? ` / ${color.alpha}%` : ""})`;
4097
+ }
4067
4098
  const ALPHA_FULL_HEX_LONG = `ff`;
4068
4099
  const DEFAULT_ALPHA = {
4069
4100
  hex: ALPHA_FULL_HEX_LONG,
4070
- value: 1
4101
+ value: 100
4071
4102
  };
4072
4103
  const DEFAULT_HSL = {
4073
4104
  hue: 0,
4074
- lightness: 0,
4075
- saturation: 0
4105
+ saturation: 0,
4106
+ lightness: 0
4107
+ };
4108
+ const DEFAULT_HWB = {
4109
+ hue: 0,
4110
+ whiteness: 0,
4111
+ blackness: 100
4076
4112
  };
4077
4113
  const DEFAULT_RGB = {
4078
4114
  blue: 0,
@@ -4090,6 +4126,12 @@ const KEYS_HSL = [
4090
4126
  "lightness"
4091
4127
  ];
4092
4128
  const KEYS_HSLA = [...KEYS_HSL, "alpha"];
4129
+ const KEYS_HWB = [
4130
+ "hue",
4131
+ "whiteness",
4132
+ "blackness"
4133
+ ];
4134
+ const KEYS_HWBA = [...KEYS_HWB, "alpha"];
4093
4135
  const KEYS_RGB = [
4094
4136
  "red",
4095
4137
  "green",
@@ -4101,18 +4143,6 @@ const SRGB_LUMINANCE_MODIFIER = 1.055;
4101
4143
  const SRGB_LUMINANCE_MULTIPLIER = 12.92;
4102
4144
  const SRGB_LUMINANCE_OFFSET = .055;
4103
4145
  //#endregion
4104
- //#region src/color/misc/index.ts
4105
- function formatColor(space, color, alpha) {
4106
- const suffix = alpha ? ` / ${color.alpha}` : "";
4107
- const value = color[space];
4108
- return `${space}(${join(keys[space].map((key) => value[key]), SPACE)}${suffix})`;
4109
- }
4110
- const SPACE = " ";
4111
- const keys = {
4112
- hsl: KEYS_HSL,
4113
- rgb: KEYS_RGB
4114
- };
4115
- //#endregion
4116
4146
  //#region src/color/misc/alpha.ts
4117
4147
  function getAlpha(value) {
4118
4148
  if (typeof value === "number") return getAlphaFromValue(value);
@@ -4124,8 +4154,8 @@ function getAlpha(value) {
4124
4154
  }
4125
4155
  function getAlphaHexadecimal(value) {
4126
4156
  if (value === 0) return "00";
4127
- if (value === 1) return ALPHA_FULL_HEX_LONG;
4128
- return Math.round(value * 255).toString(16);
4157
+ if (value === 100) return ALPHA_FULL_HEX_LONG;
4158
+ return round(value * 255).toString(16);
4129
4159
  }
4130
4160
  function getAlphaFromValue(value) {
4131
4161
  const alpha = getAlphaValue(value);
@@ -4135,9 +4165,147 @@ function getAlphaFromValue(value) {
4135
4165
  };
4136
4166
  }
4137
4167
  function getAlphaValue(original) {
4138
- if (Number.isNaN(original) || original >= 100 || original === 1) return 1;
4139
- if (original < 0) return 0;
4140
- return original <= 1 ? original : original / 100;
4168
+ if (Number.isNaN(original) || original >= 100) return 100;
4169
+ return original <= 0 ? 0 : original;
4170
+ }
4171
+ //#endregion
4172
+ //#region src/color/misc/get.ts
4173
+ function getClampedValue(value, minimum, maximum, rounding) {
4174
+ return typeof value === "number" && !Number.isNaN(value) ? clamp(rounding ?? false ? round(value) : value, minimum, maximum) : minimum;
4175
+ }
4176
+ function getForegroundColor(value, hex) {
4177
+ const { blue, green, red } = getColorState(value).rgb;
4178
+ const values = [
4179
+ blue / 255,
4180
+ green / 255,
4181
+ red / 255
4182
+ ];
4183
+ const { length } = values;
4184
+ for (let index = 0; index < length; index += 1) {
4185
+ const color = values[index];
4186
+ if (color <= .03928) values[index] /= SRGB_LUMINANCE_MULTIPLIER;
4187
+ else values[index] = ((color + SRGB_LUMINANCE_OFFSET) / SRGB_LUMINANCE_MODIFIER) ** SRGB_LUMINANCE_EXPONENT;
4188
+ }
4189
+ const color = .2126 * values[2] + .7152 * values[1] + .0722 * values[0] > .625 ? HEX_BLACK : HEX_WHITE;
4190
+ return hex === true ? color : new Color(color);
4191
+ }
4192
+ /**
4193
+ * Get the hex color _(with alpha channel, i.e., opacity)_ from any kind of value
4194
+ *
4195
+ * - Values that can be parsed are: hex(a) color strings, as well as _HSL(A)_, _HWB(A)_, and _RGB(A)_ color objects
4196
+ * - If the value cannot be parsed, a black hex color will be returned
4197
+ *
4198
+ * @param value Original value
4199
+ * @returns Hex color string
4200
+ */
4201
+ function getHexaColor(value) {
4202
+ const { alpha, hex } = getColorState(value);
4203
+ return `${hex}${alpha.hex}`;
4204
+ }
4205
+ /**
4206
+ * Get the hex color from any kind of value
4207
+ *
4208
+ * - Values that can be parsed are: hex(a) color strings, as well as _HSL(A)_, _HWB(A)_, and _RGB(A)_ color objects
4209
+ * - If the value cannot be parsed, a black hex color will be returned
4210
+ *
4211
+ * @param value Original value
4212
+ * @returns Hex color string
4213
+ */
4214
+ function getHexColor(value) {
4215
+ return getColorState(value).hex;
4216
+ }
4217
+ function getHexValue(value) {
4218
+ return getClampedValue(value, 0, 255, true);
4219
+ }
4220
+ function getDegrees(value) {
4221
+ return getClampedValue(value, 0, 360);
4222
+ }
4223
+ /**
4224
+ * Get the _HSLA_ color from any kind of value
4225
+ *
4226
+ * - Values that can be parsed are: hex(a) color strings, as well as _HSL(A)_, _HWB(A)_, and _RGB(A)_ color objects
4227
+ * - If the value cannot be parsed, a black _HSLA_ color will be returned
4228
+ *
4229
+ * @param value Original value
4230
+ * @returns _HSLA_ color
4231
+ */
4232
+ function getHslaColor(value) {
4233
+ const { alpha, hsl } = getColorState(value);
4234
+ return {
4235
+ ...hsl,
4236
+ alpha: alpha.value
4237
+ };
4238
+ }
4239
+ /**
4240
+ * Get the _HWB_ color from any kind of value
4241
+ *
4242
+ * - Values that can be parsed are: hex(a) color strings, as well as _HSL(A)_, _HWB(A)_, and _RGB(A)_ color objects
4243
+ * - If the value cannot be parsed, a black _HWB_ color will be returned
4244
+ *
4245
+ * @param value Original value
4246
+ * @returns _HWB_ color
4247
+ */
4248
+ function getHwbColor(value) {
4249
+ return getColorState(value).hwb;
4250
+ }
4251
+ /**
4252
+ * Get the _HWBA_ color from any kind of value
4253
+ *
4254
+ * - Values that can be parsed are: hex(a) color strings, as well as _HSL(A)_, _HWB(A)_, and _RGB(A)_ color objects
4255
+ * - If the value cannot be parsed, a black _HWBA_ color will be returned
4256
+ *
4257
+ * @param value Original value
4258
+ * @returns _HWBA_ color
4259
+ */
4260
+ function getHwbaColor(value) {
4261
+ const { alpha, hwb } = getColorState(value);
4262
+ return {
4263
+ ...hwb,
4264
+ alpha: alpha.value
4265
+ };
4266
+ }
4267
+ /**
4268
+ * Get the _HSL_ color from any kind of value
4269
+ *
4270
+ * - Values that can be parsed are: hex(a) color strings, as well as _HSL(A)_, _HWB(A)_, and _RGB(A)_ color objects
4271
+ * - If the value cannot be parsed, a black _HSL_ color will be returned
4272
+ *
4273
+ * @param value Original value
4274
+ * @returns _HSL_ color
4275
+ */
4276
+ function getHslColor(value) {
4277
+ return getColorState(value).hsl;
4278
+ }
4279
+ function getPercentage(value) {
4280
+ return getClampedValue(value, 0, 100);
4281
+ }
4282
+ /**
4283
+ * Get the _RGBA_ color from any kind of value
4284
+ *
4285
+ * - Values that can be parsed are: hex(a) color strings, as well as _HSL(A)_, _HWB(A)_, and _RGB(A)_ color objects
4286
+ * - If the value cannot be parsed, a black _RGBA_ color will be returned
4287
+ *
4288
+ * @param value Original value
4289
+ * @returns _RGBA_ color
4290
+ */
4291
+ function getRgbaColor(value) {
4292
+ const { alpha, rgb } = getColorState(value);
4293
+ return {
4294
+ ...rgb,
4295
+ alpha: alpha.value
4296
+ };
4297
+ }
4298
+ /**
4299
+ * Get the _RGB_ color from any kind of value
4300
+ *
4301
+ * - Values that can be parsed are: hex(a) color strings, as well as _HSL(A)_, _HWB(A)_, and _RGB(A)_ color objects
4302
+ * - If the value cannot be parsed, a black _RGB_ color will be returned
4303
+ *
4304
+ * @param value Original value
4305
+ * @returns _RGB_ color
4306
+ */
4307
+ function getRgbColor(value) {
4308
+ return getColorState(value).rgb;
4141
4309
  }
4142
4310
  //#endregion
4143
4311
  //#region src/color/misc/is.ts
@@ -4145,7 +4313,7 @@ function hasKeys(value, keys) {
4145
4313
  return typeof value === "object" && value !== null && keys.every((key) => key in value);
4146
4314
  }
4147
4315
  function isAlpha(value) {
4148
- return typeof value === "number" && between(value, 0, 1);
4316
+ return typeof value === "number" && between(value, 0, 100);
4149
4317
  }
4150
4318
  function isBytey(value) {
4151
4319
  return typeof value === "number" && between(value, 0, 255);
@@ -4213,161 +4381,92 @@ function isHslaColor(value) {
4213
4381
  function isHslColor(value) {
4214
4382
  return isColorValue(value, KEYS_HSLA) || isColorValue(value, KEYS_HSL);
4215
4383
  }
4216
- function isHslLike(value) {
4217
- return hasKeys(value, KEYS_HSL);
4218
- }
4219
4384
  /**
4220
- * Is the value an _RGBA_ color?
4385
+ * Is the value like an _HSL_ color?
4221
4386
  *
4222
4387
  * @param value Value to check
4223
- * @returns `true` if the value is an _RGBA_ color, otherwise `false`
4388
+ * @returns `true` if the value is like an _HSL_ color, otherwise `false`
4224
4389
  */
4225
- function isRgbaColor(value) {
4226
- return isColorValue(value, KEYS_RGBA);
4390
+ function isHslLike(value) {
4391
+ return hasKeys(value, KEYS_HSL);
4227
4392
  }
4228
4393
  /**
4229
- * Is the value an _RGB_ color?
4394
+ * Is the value an _HWBA_ color?
4230
4395
  *
4231
4396
  * @param value Value to check
4232
- * @returns `true` if the value is an _RGB_ color, otherwise `false`
4397
+ * @returns `true` if the value is an _HWBA_ color, otherwise `false`
4233
4398
  */
4234
- function isRgbColor(value) {
4235
- return isColorValue(value, KEYS_RGBA) || isColorValue(value, KEYS_RGB);
4236
- }
4237
- function isRgbLike(value) {
4238
- return hasKeys(value, KEYS_RGB);
4239
- }
4240
- function isPercentage(value) {
4241
- return typeof value === "number" && between(value, 0, 100);
4242
- }
4243
- const validators = {
4244
- alpha: isAlpha,
4245
- blue: isBytey,
4246
- green: isBytey,
4247
- hue: isDegree,
4248
- lightness: isPercentage,
4249
- saturation: isPercentage,
4250
- red: isBytey
4251
- };
4252
- //#endregion
4253
- //#region src/color/misc/get.ts
4254
- function getClampedValue(value, minimum, maximum) {
4255
- return typeof value === "number" ? clamp(value, minimum, maximum) : minimum;
4399
+ function isHwbaColor(value) {
4400
+ return isColorValue(value, KEYS_HWBA);
4256
4401
  }
4257
4402
  /**
4258
- * Get a foreground color _(usually text)_ based on a background color's luminance
4259
- *
4260
- * - Values that can be parsed are: hex(a) color strings, _HSL(A)_ color objects, and _RGB(A)_ color objects
4261
- * - If the value cannot be parsed, a white foreground color will be returned
4403
+ * Is the value like an _HWBA_ color?
4262
4404
  *
4263
- * @param value Original value
4264
- * @returns Foreground color
4405
+ * @param value Value to check
4406
+ * @returns `true` if the value is like an _HWBA_ color, otherwise `false`
4265
4407
  */
4266
- function getForegroundColor(value) {
4267
- const { blue, green, red } = getColorState(value).rgb;
4268
- const values = [
4269
- blue / 255,
4270
- green / 255,
4271
- red / 255
4272
- ];
4273
- const { length } = values;
4274
- for (let index = 0; index < length; index += 1) {
4275
- const color = values[index];
4276
- if (color <= .03928) values[index] /= SRGB_LUMINANCE_MULTIPLIER;
4277
- else values[index] = ((color + SRGB_LUMINANCE_OFFSET) / SRGB_LUMINANCE_MODIFIER) ** SRGB_LUMINANCE_EXPONENT;
4278
- }
4279
- return new Color(.2126 * values[2] + .7152 * values[1] + .0722 * values[0] > .625 ? HEX_BLACK : HEX_WHITE);
4408
+ function isHwbaLike(value) {
4409
+ return hasKeys(value, KEYS_HWBA);
4280
4410
  }
4281
4411
  /**
4282
- * Get the hex color _(with alpha channel, i.e., opacity)_ from any kind of value
4412
+ * Is the value an _HWB_ color?
4283
4413
  *
4284
- * - Values that can be parsed are: hex(a) color strings, _HSL(A)_ color objects, and _RGB(A)_ color objects
4285
- * - If the value cannot be parsed, a black hex color with an alpha channel of `0` will be returned
4286
- *
4287
- * @param value Original value
4288
- * @returns Hex color string
4414
+ * @param value Value to check
4415
+ * @returns `true` if the value is an _HWB_ color, otherwise `false`
4289
4416
  */
4290
- function getHexaColor(value) {
4291
- const { alpha, hex } = getColorState(value);
4292
- return `${hex}${alpha.hex}`;
4417
+ function isHwbColor(value) {
4418
+ return isColorValue(value, KEYS_HWB) || isColorValue(value, KEYS_HWBA);
4293
4419
  }
4294
4420
  /**
4295
- * Get the hex color from any kind of value
4296
- *
4297
- * - Values that can be parsed are: hex(a) color strings, _HSL(A)_ color objects, and _RGB(A)_ color objects
4298
- * - If the value cannot be parsed, a black hex color will be returned
4421
+ * Is the value like an _HWB_ color?
4299
4422
  *
4300
- * @param value Original value
4301
- * @returns Hex color string
4423
+ * @param value Value to check
4424
+ * @returns `true` if the value is like an _HWB_ color, otherwise `false`
4302
4425
  */
4303
- function getHexColor(value) {
4304
- return getColorState(value).hex;
4305
- }
4306
- function getHexValue(value) {
4307
- return getClampedValue(value, 0, 255);
4308
- }
4309
- function getDegrees(value) {
4310
- return getClampedValue(value, 0, 360);
4426
+ function isHwbLike(value) {
4427
+ return hasKeys(value, KEYS_HWB);
4311
4428
  }
4312
4429
  /**
4313
- * Get the _HSLA_ color from any kind of value
4314
- *
4315
- * - Values that can be parsed are: hex(a) color strings, _HSL(A)_ color objects, and _RGB(A)_ color objects
4316
- * - If the value cannot be parsed, a black _HSLA_ color with an alpha channel _(opacity)_ of `0` will be returned
4430
+ * Is the value an _RGBA_ color?
4317
4431
  *
4318
- * @param value Original value
4319
- * @returns _HSLA_ color
4432
+ * @param value Value to check
4433
+ * @returns `true` if the value is an _RGBA_ color, otherwise `false`
4320
4434
  */
4321
- function getHslaColor(value) {
4322
- const { alpha, hsl } = getColorState(value);
4323
- return {
4324
- ...hsl,
4325
- alpha: alpha.value
4326
- };
4435
+ function isRgbaColor(value) {
4436
+ return isColorValue(value, KEYS_RGBA);
4327
4437
  }
4328
4438
  /**
4329
- * Get the _HSL_ color from any kind of value
4330
- *
4331
- * - Values that can be parsed are: hex(a) color strings, _HSL(A)_ color objects, and _RGB(A)_ color objects
4332
- * - If the value cannot be parsed, a black _HSL_ color will be returned
4439
+ * Is the value an _RGB_ color?
4333
4440
  *
4334
- * @param value Original value
4335
- * @returns _HSL_ color
4441
+ * @param value Value to check
4442
+ * @returns `true` if the value is an _RGB_ color, otherwise `false`
4336
4443
  */
4337
- function getHslColor(value) {
4338
- return getColorState(value).hsl;
4339
- }
4340
- function getPercentage(value) {
4341
- return getClampedValue(value, 0, 100);
4444
+ function isRgbColor(value) {
4445
+ return isColorValue(value, KEYS_RGBA) || isColorValue(value, KEYS_RGB);
4342
4446
  }
4343
4447
  /**
4344
- * Get the _RGBA_ color from any kind of value
4345
- *
4346
- * - Values that can be parsed are: hex(a) color strings, _HSL(A)_ color objects, and _RGB(A)_ color objects
4347
- * - If the value cannot be parsed, a black _RGBA_ color with an alpha channel _(opacity)_ of `0` will be returned
4448
+ * Is the value like an _RGB_ color?
4348
4449
  *
4349
- * @param value Original value
4350
- * @returns _RGBA_ color
4450
+ * @param value Value to check
4451
+ * @returns `true` if the value is like an _RGB_ color, otherwise `false`
4351
4452
  */
4352
- function getRgbaColor(value) {
4353
- const { alpha, rgb } = getColorState(value);
4354
- return {
4355
- ...rgb,
4356
- alpha: alpha.value
4357
- };
4453
+ function isRgbLike(value) {
4454
+ return hasKeys(value, KEYS_RGB);
4358
4455
  }
4359
- /**
4360
- * Get the _RGB_ color from any kind of value
4361
- *
4362
- * - Values that can be parsed are: hex(a) color strings, _HSL(A)_ color objects, and _RGB(A)_ color objects
4363
- * - If the value cannot be parsed, a black _RGB_ color will be returned
4364
- *
4365
- * @param value Original value
4366
- * @returns _RGB_ color
4367
- */
4368
- function getRgbColor(value) {
4369
- return getColorState(value).rgb;
4456
+ function isPercentage(value) {
4457
+ return typeof value === "number" && between(value, 0, 100);
4370
4458
  }
4459
+ const validators = {
4460
+ alpha: isAlpha,
4461
+ blackness: isPercentage,
4462
+ blue: isBytey,
4463
+ green: isBytey,
4464
+ hue: isDegree,
4465
+ lightness: isPercentage,
4466
+ saturation: isPercentage,
4467
+ red: isBytey,
4468
+ whiteness: isPercentage
4469
+ };
4371
4470
  //#endregion
4372
4471
  //#region src/color/space/rgb.ts
4373
4472
  function convertRgbToHex(rgb, alpha) {
@@ -4384,38 +4483,46 @@ function convertRgbToHex(rgb, alpha) {
4384
4483
  return `${hex}${a}`;
4385
4484
  }
4386
4485
  function convertRgbToHsla(value) {
4387
- const rgb = isRgbLike(value) ? getRgbValue(value) : { ...DEFAULT_RGB };
4388
- const blue = rgb.blue / 255;
4389
- const green = rgb.green / 255;
4390
- const red = rgb.red / 255;
4391
- const maxHex = Math.max(blue, green, red);
4392
- const minHex = Math.min(blue, green, red);
4393
- const delta = maxHex - minHex;
4394
- const lightness = (minHex + maxHex) / 2;
4486
+ const values = getRgbValues(isRgbLike(value) ? getRgbValue(value) : { ...DEFAULT_RGB });
4487
+ const { delta, max, min } = values;
4488
+ const lightness = (min + max) / 2;
4395
4489
  let hue = 0;
4396
4490
  let saturation = 0;
4397
4491
  if (delta !== 0) {
4398
- saturation = (maxHex - lightness) / Math.min(lightness, 1 - lightness);
4399
- switch (maxHex) {
4400
- case blue:
4401
- hue = (red - green) / delta + 4;
4402
- break;
4403
- case green:
4404
- hue = (blue - red) / delta + 2;
4405
- break;
4406
- case red:
4407
- hue = (green - blue) / delta + (green < blue ? 6 : 0);
4408
- break;
4409
- }
4492
+ saturation = (max - lightness) / Math.min(lightness, 1 - lightness);
4493
+ hue = getRgbHue(values);
4494
+ hue *= 60;
4495
+ }
4496
+ return {
4497
+ hue,
4498
+ saturation: saturation * 100,
4499
+ lightness: lightness * 100,
4500
+ alpha: getAlphaValue(value?.alpha ?? 100)
4501
+ };
4502
+ }
4503
+ function convertRgbToHwba(value) {
4504
+ const values = getRgbValues(isRgbLike(value) ? getRgbValue(value) : { ...DEFAULT_RGB });
4505
+ const { delta, max, min } = values;
4506
+ let hue = 0;
4507
+ if (delta !== 0) {
4508
+ hue = getRgbHue(values);
4410
4509
  hue *= 60;
4411
4510
  }
4412
4511
  return {
4413
- alpha: getAlphaValue(value.alpha ?? 1),
4414
- hue: +hue.toFixed(2),
4415
- lightness: +(lightness * 100).toFixed(2),
4416
- saturation: +(saturation * 100).toFixed(2)
4512
+ hue,
4513
+ whiteness: min * 100,
4514
+ blackness: (1 - max) * 100,
4515
+ alpha: getAlphaValue(value?.alpha ?? 100)
4417
4516
  };
4418
4517
  }
4518
+ function getRgbHue(values) {
4519
+ const { blue, delta, green, max, red } = values;
4520
+ switch (max) {
4521
+ case blue: return (red - green) / delta + 4;
4522
+ case green: return (blue - red) / delta + 2;
4523
+ default: return (green - blue) / delta + (green < blue ? 6 : 0);
4524
+ }
4525
+ }
4419
4526
  function getRgbValue(value) {
4420
4527
  return {
4421
4528
  blue: getHexValue(value.blue),
@@ -4423,6 +4530,21 @@ function getRgbValue(value) {
4423
4530
  red: getHexValue(value.red)
4424
4531
  };
4425
4532
  }
4533
+ function getRgbValues(rgb) {
4534
+ const blue = rgb.blue / 255;
4535
+ const green = rgb.green / 255;
4536
+ const red = rgb.red / 255;
4537
+ const max = Math.max(blue, green, red);
4538
+ const min = Math.min(blue, green, red);
4539
+ return {
4540
+ blue,
4541
+ delta: max - min,
4542
+ green,
4543
+ max,
4544
+ min,
4545
+ red
4546
+ };
4547
+ }
4426
4548
  /**
4427
4549
  * Convert an _RGB(A)_ color to a hex color _(with optional alpha channel, i.e., opacity)_
4428
4550
  *
@@ -4438,7 +4560,7 @@ function rgbToHex(rgb, alpha) {
4438
4560
  /**
4439
4561
  * Convert an _RGB(A)_ color to an _HSL_ color
4440
4562
  *
4441
- * _If the value is unable to be converted, a black HSL color will be returned_
4563
+ * _If the value is unable to be converted, a black _HSL_ color will be returned_
4442
4564
  *
4443
4565
  * _Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L26_
4444
4566
  *
@@ -4456,7 +4578,7 @@ function rgbToHsl(rgb) {
4456
4578
  /**
4457
4579
  * Convert an _RGB(A)_ color to an _HSLA_ color
4458
4580
  *
4459
- * _If the value is unable to be converted, a black _HSLA_ color with an alpha channel (opacity) of `0` will be returned_
4581
+ * _If the value is unable to be converted, a black _HSLA_ color will be returned_
4460
4582
  *
4461
4583
  * _Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L26_
4462
4584
  *
@@ -4466,6 +4588,37 @@ function rgbToHsl(rgb) {
4466
4588
  function rgbToHsla(rgb) {
4467
4589
  return convertRgbToHsla(rgb);
4468
4590
  }
4591
+ /**
4592
+ * Convert an _RGB(A)_ color to an _HWB_ color
4593
+ *
4594
+ * _If the value is unable to be converted, a black _HWB_ color will be returned_
4595
+ *
4596
+ * _Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L26_
4597
+ *
4598
+ * @param rgb _RGB(A)_ color
4599
+ * @returns _HWB_ color
4600
+ */
4601
+ function rgbToHwb(rgb) {
4602
+ const { blackness, hue, whiteness } = convertRgbToHwba(rgb);
4603
+ return {
4604
+ hue,
4605
+ whiteness,
4606
+ blackness
4607
+ };
4608
+ }
4609
+ /**
4610
+ * Convert an _RGB(A)_ color to an _HWBA_ color
4611
+
4612
+ * _If the value is unable to be converted, a black _HWBA_ color will be returned_
4613
+ *
4614
+ * _Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L26_
4615
+ *
4616
+ * @param rgb _RGB(A)_ color
4617
+ * @returns _HWBA_ color
4618
+ */
4619
+ function rgbToHwba(rgb) {
4620
+ return convertRgbToHwba(rgb);
4621
+ }
4469
4622
  //#endregion
4470
4623
  //#region src/color/space/hex.ts
4471
4624
  function convertHexToRgba(value) {
@@ -4475,10 +4628,10 @@ function convertHexToRgba(value) {
4475
4628
  const { length } = pairs;
4476
4629
  for (let index = 1; index < length; index += 1) values.push(Number.parseInt(pairs[index], 16));
4477
4630
  return {
4478
- alpha: values[3] / 255,
4479
- blue: values[2],
4480
- green: values[1],
4481
- red: values[0]
4631
+ alpha: getPercentage(values[3] / 255 * 100),
4632
+ blue: getHexValue(values[2]),
4633
+ green: getHexValue(values[1]),
4634
+ red: getHexValue(values[0])
4482
4635
  };
4483
4636
  }
4484
4637
  /**
@@ -4497,6 +4650,14 @@ function getNormalizedHex(value, alpha) {
4497
4650
  if (normalized.length < 6) return join(`${normalized.slice(0, 3)}${includeAlpha ? normalized[3] ?? "f" : ""}`.split("").map((character) => character.repeat(2)));
4498
4651
  return `${normalized.slice(0, 6)}${includeAlpha ? normalized.slice(6) || ALPHA_FULL_HEX_LONG : ""}`;
4499
4652
  }
4653
+ /**
4654
+ * Convert a hex color string to a _HSL_ color
4655
+ *
4656
+ * _If the value is unable to be converted, a black _HSL_ color will be returned_
4657
+ *
4658
+ * @param value Hex color string
4659
+ * @returns _HSL_ color
4660
+ */
4500
4661
  function hexToHsl(value) {
4501
4662
  const { hue, lightness, saturation } = hexToHsla(value);
4502
4663
  return {
@@ -4505,13 +4666,48 @@ function hexToHsl(value) {
4505
4666
  saturation
4506
4667
  };
4507
4668
  }
4669
+ /**
4670
+ * Convert a hex color string to a _HSLA_ color
4671
+ *
4672
+ * _If the value is unable to be converted, a black _HSLA_ color will be returned_
4673
+ *
4674
+ * @param value Hex color string
4675
+ * @returns _HSLA_ color
4676
+ */
4508
4677
  function hexToHsla(value) {
4509
4678
  return convertRgbToHsla(convertHexToRgba(value));
4510
4679
  }
4511
4680
  /**
4681
+ * Convert a hex color string to a _HWB_ color
4682
+ *
4683
+ * _If the value is unable to be converted, a black _HWB_ color will be returned_
4684
+ *
4685
+ * @param value Hex color string
4686
+ * @returns _HWB_ color
4687
+ */
4688
+ function hexToHwb(value) {
4689
+ const { blackness, hue, whiteness } = hexToHwba(value);
4690
+ return {
4691
+ hue,
4692
+ whiteness,
4693
+ blackness
4694
+ };
4695
+ }
4696
+ /**
4697
+ * Convert a hex color string to a _HWBA_ color
4698
+ *
4699
+ * _If the value is unable to be converted, a black _HWBA_ color will be returned_
4700
+ *
4701
+ * @param value Hex color string
4702
+ * @returns _HWBA_ color
4703
+ */
4704
+ function hexToHwba(value) {
4705
+ return convertRgbToHwba(convertHexToRgba(value));
4706
+ }
4707
+ /**
4512
4708
  * Convert a hex color to an _RGB_ color
4513
4709
  *
4514
- * _If the value is unable to be converted, a black RGB color will be returned_
4710
+ * _If the value is unable to be converted, a black _RGB_ color will be returned_
4515
4711
  *
4516
4712
  * @param value Original value
4517
4713
  * @returns _RGB_ color
@@ -4527,7 +4723,7 @@ function hexToRgb(value) {
4527
4723
  /**
4528
4724
  * Convert a hex color to an _RGBA_ color
4529
4725
  *
4530
- * _If the value is unable to be converted, a black RGBA color with an alpha channel (opacity) of `0` will be returned_
4726
+ * _If the value is unable to be converted, a black _RGBA_ color will be returned_
4531
4727
  *
4532
4728
  * @param value Original value
4533
4729
  * @returns _RGBA_ color
@@ -4537,16 +4733,31 @@ function hexToRgba(value) {
4537
4733
  }
4538
4734
  //#endregion
4539
4735
  //#region src/color/space/hsl.ts
4540
- function convertHslToRgba(value) {
4541
- const hsl = isHslLike(value) ? getHslValue(value) : { ...DEFAULT_HSL };
4736
+ function convertHslToHwba(input) {
4737
+ let { hue, lightness, saturation } = isHslLike(input) ? getHslValue(input) : { ...DEFAULT_HSL };
4738
+ lightness /= 100;
4739
+ saturation /= 100;
4740
+ const value = lightness + saturation * Math.min(lightness, 1 - lightness);
4741
+ if (value === 0) saturation = 0;
4742
+ else saturation = 2 * (1 - lightness / value);
4743
+ const blackness = 1 - value;
4744
+ return {
4745
+ hue,
4746
+ whiteness: (1 - saturation) * value * 100,
4747
+ blackness: blackness * 100,
4748
+ alpha: getAlphaValue(input?.alpha ?? 100)
4749
+ };
4750
+ }
4751
+ function convertHslToRgba(input) {
4752
+ const hsl = isHslLike(input) ? getHslValue(input) : { ...DEFAULT_HSL };
4542
4753
  const hue = hsl.hue % 360;
4543
4754
  const saturation = hsl.saturation / 100;
4544
4755
  const lightness = hsl.lightness / 100;
4545
4756
  return {
4546
- alpha: getAlphaValue(value.alpha ?? 1),
4547
- blue: getHexValue(Math.round(getHexyValue(hue, lightness, saturation, 4))),
4548
- green: getHexValue(Math.round(getHexyValue(hue, lightness, saturation, 8))),
4549
- red: getHexValue(Math.round(getHexyValue(hue, lightness, saturation, 0)))
4757
+ alpha: getAlphaValue(input?.alpha ?? 100),
4758
+ blue: getHexValue(getHexyValue(hue, lightness, saturation, 4)),
4759
+ green: getHexValue(getHexyValue(hue, lightness, saturation, 8)),
4760
+ red: getHexValue(getHexyValue(hue, lightness, saturation, 0))
4550
4761
  };
4551
4762
  }
4552
4763
  function getHexyValue(hue, lightness, saturation, value) {
@@ -4556,22 +4767,58 @@ function getHexyValue(hue, lightness, saturation, value) {
4556
4767
  function getHslValue(value) {
4557
4768
  return {
4558
4769
  hue: getDegrees(value.hue),
4559
- lightness: getPercentage(value.lightness),
4560
- saturation: getPercentage(value.saturation)
4770
+ saturation: getPercentage(value.saturation),
4771
+ lightness: getPercentage(value.lightness)
4561
4772
  };
4562
4773
  }
4774
+ /**
4775
+ * Convert an _HSL(A)_ color to a hex color _(with optional alpha channel, i.e., opacity)_
4776
+ *
4777
+ * _If the value is unable to be converted, a black hex color will be returned_
4778
+ *
4779
+ * @param hsl _HSL(A)_ color
4780
+ * @param alpha Include alpha channel _(opacity)_? _(defaults to `false`)_
4781
+ * @returns Hex color string
4782
+ */
4563
4783
  function hslToHex(hsl, alpha) {
4564
4784
  return convertRgbToHex(convertHslToRgba(hsl), alpha ?? false);
4565
4785
  }
4566
4786
  /**
4787
+ * Convert an _HSL(A)_ color to an _HWB_ color
4788
+ *
4789
+ * _If the value is unable to be converted, a black _HWB_ color will be returned_
4790
+ *
4791
+ * @param hsl HSL(A) color
4792
+ * @returns _HWB_ color
4793
+ */
4794
+ function hslToHwb(hsl) {
4795
+ const { blackness, hue, whiteness } = convertHslToHwba(hsl);
4796
+ return {
4797
+ hue,
4798
+ whiteness,
4799
+ blackness
4800
+ };
4801
+ }
4802
+ /**
4803
+ * Convert an _HSL(A)_ color to an _HWBA_ color
4804
+ *
4805
+ * _If the value is unable to be converted, a black _HWBA_ color will be returned_
4806
+ *
4807
+ * @param hsl HSL(A) color
4808
+ * @returns _HWBA_ color
4809
+ */
4810
+ function hslToHwba(hsl) {
4811
+ return convertHslToHwba(hsl);
4812
+ }
4813
+ /**
4567
4814
  * Convert an _HSL(A)_ color to an _RGB_ color
4568
4815
  *
4569
- * _If the value is unable to be converted, a black RGB color will be returned_
4816
+ * _If the value is unable to be converted, a black _RGB_ color will be returned_
4570
4817
  *
4571
4818
  * _Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L61_
4572
4819
  *
4573
4820
  * @param hsl HSL(A) color
4574
- * @returns RGB color
4821
+ * @returns _RGB_ color
4575
4822
  */
4576
4823
  function hslToRgb(hsl) {
4577
4824
  const { blue, green, red } = convertHslToRgba(hsl);
@@ -4584,79 +4831,204 @@ function hslToRgb(hsl) {
4584
4831
  /**
4585
4832
  * Convert an _HSL(A)_ color to an _RGBA_ color
4586
4833
  *
4587
- * _If the value is unable to be converted, a black RGBA color with an alpha channel (opactiy) of `0` will be returned_
4834
+ * _If the value is unable to be converted, a black _RGBA_ color will be returned_
4588
4835
  *
4589
4836
  * _Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L61_
4590
4837
  *
4591
4838
  * @param hsl HSL(A) color
4592
- * @returns RGBA color
4839
+ * @returns _RGBA_ color
4593
4840
  */
4594
4841
  function hslToRgba(hsl) {
4595
4842
  return convertHslToRgba(hsl);
4596
4843
  }
4597
4844
  //#endregion
4845
+ //#region src/color/space/hwb.ts
4846
+ function convertHwbToHsl(input) {
4847
+ let { blackness, hue, whiteness } = isHwbLike(input) ? getHwbValue(input) : DEFAULT_HWB;
4848
+ blackness /= 100;
4849
+ whiteness /= 100;
4850
+ if (blackness + whiteness > 1) {
4851
+ const total = blackness + whiteness;
4852
+ blackness /= total;
4853
+ whiteness /= total;
4854
+ }
4855
+ const lightness = (1 - blackness + whiteness) / 2;
4856
+ return {
4857
+ hue,
4858
+ saturation: getHwbSaturation(blackness, whiteness, lightness) * 100,
4859
+ lightness: lightness * 100,
4860
+ alpha: getAlphaValue(input?.alpha ?? 100)
4861
+ };
4862
+ }
4863
+ function getHwbSaturation(blackness, whiteness, lightness) {
4864
+ const hue = 1 - blackness - whiteness;
4865
+ if (hue <= 0) return 0;
4866
+ return hue / Math.min(2 * lightness, 2 - 2 * lightness);
4867
+ }
4868
+ function getHwbValue(value) {
4869
+ return {
4870
+ hue: getDegrees(value.hue),
4871
+ whiteness: getPercentage(value.whiteness),
4872
+ blackness: getPercentage(value.blackness)
4873
+ };
4874
+ }
4875
+ /**
4876
+ * Convert an _HWB(A)_ color to a hex color _(with optional alpha channel, i.e., opacity)_
4877
+ *
4878
+ * _If the value is unable to be converted, a black hex color will be returned_
4879
+ *
4880
+ * @param hwb _HWB(A)_ color
4881
+ * @param alpha Include alpha channel _(opacity)_? _(defaults to `false`)_
4882
+ * @returns Hex color string
4883
+ */
4884
+ function hwbToHex(hwb, alpha) {
4885
+ return rgbToHex(hwbToRgb(hwb), alpha);
4886
+ }
4887
+ /**
4888
+ * Convert an _HWB(A)_ color to an _RGB_ color
4889
+ *
4890
+ * _If the value is unable to be converted, a black _RGB_ color will be returned_
4891
+ *
4892
+ * @param hwb _HWB(A)_ color
4893
+ * @returns _RGB_ color
4894
+ */
4895
+ function hwbToHsl(hwb) {
4896
+ const { hue, lightness, saturation } = convertHwbToHsl(hwb);
4897
+ return {
4898
+ hue,
4899
+ lightness,
4900
+ saturation
4901
+ };
4902
+ }
4903
+ /**
4904
+ * Convert an _HWB(A)_ color to an _HSLA_ color
4905
+ *
4906
+ * _If the value is unable to be converted, a black _HSLA_ color will be returned_
4907
+ *
4908
+ * @param hwb _HWB(A)_ color
4909
+ * @returns _HSLA_ color
4910
+ */
4911
+ function hwbToHsla(hwb) {
4912
+ return convertHwbToHsl(hwb);
4913
+ }
4914
+ /**
4915
+ * Convert an _HWB(A)_ color to an _RGB_ color
4916
+ *
4917
+ * _If the value is unable to be converted, a black _RGB_ color will be returned_
4918
+ *
4919
+ * @param hwb _HWB(A)_ color
4920
+ * @returns _RGB_ color
4921
+ */
4922
+ function hwbToRgb(hwb) {
4923
+ return hslToRgb(hwbToHsl(hwb));
4924
+ }
4925
+ /**
4926
+ * Convert an _HWB(A)_ color to an _RGBA_ color
4927
+ *
4928
+ * _If the value is unable to be converted, a black _RGBA_ color will be returned_
4929
+ *
4930
+ * @param hwb _HWB(A)_ color
4931
+ * @returns _RGBA_ color
4932
+ */
4933
+ function hwbToRgba(hwb) {
4934
+ return hslToRgba(hwbToHsla(hwb));
4935
+ }
4936
+ //#endregion
4598
4937
  //#region src/color/misc/state.ts
4599
4938
  function getColorState(value) {
4600
- if (typeof value === "string") {
4601
- const normalized = getNormalizedHex(value, true);
4602
- const hex = normalized.slice(0, 6);
4603
- const rgb = hexToRgb(hex);
4604
- return {
4605
- hex,
4606
- rgb,
4607
- alpha: getAlpha(normalized.slice(6)),
4608
- hsl: rgbToHsl(rgb)
4609
- };
4610
- }
4939
+ if (typeof value === "string") return getColorStateForHex(value);
4611
4940
  if (isColor(value)) return {
4612
4941
  hex: value.hex,
4613
4942
  hsl: value.hsl,
4943
+ hwb: value.hwb,
4614
4944
  rgb: value.rgb,
4615
4945
  alpha: getAlpha(value.alpha)
4616
4946
  };
4617
4947
  const state = {};
4618
4948
  if (typeof value === "object" && value !== null) {
4619
4949
  state.alpha = getAlpha(value.alpha);
4620
- if (KEYS_HSL.every((key) => key in value)) {
4621
- state.hsl = getHslValue(value);
4622
- state.rgb = hslToRgb(state.hsl);
4623
- state.hex = rgbToHex(state.rgb);
4624
- return state;
4625
- }
4626
- if (KEYS_RGB.every((key) => key in value)) {
4627
- state.rgb = getRgbValue(value);
4628
- state.hex = rgbToHex(state.rgb);
4629
- state.hsl = rgbToHsl(state.rgb);
4630
- return state;
4631
- }
4950
+ if (KEYS_HSL.every((key) => key in value)) return getColorStateForHsl(state, value);
4951
+ if (KEYS_HWB.every((key) => key in value)) return getColorStateForHwb(state, value);
4952
+ if (KEYS_RGB.every((key) => key in value)) return getColorStateForRgb(state, value);
4632
4953
  }
4633
- state.alpha ??= getAlpha(1);
4634
- state.hex ??= HEX_BLACK;
4635
- state.hsl ??= { ...DEFAULT_HSL };
4636
- state.rgb ??= { ...DEFAULT_RGB };
4954
+ return getDefaultColorState(state);
4955
+ }
4956
+ function getColorStateForHex(value) {
4957
+ const normalized = getNormalizedHex(value, true);
4958
+ const hex = normalized.slice(0, 6);
4959
+ const hsl = hexToHsl(hex);
4960
+ return {
4961
+ hex,
4962
+ hsl,
4963
+ alpha: getAlpha(normalized.slice(6)),
4964
+ hwb: hslToHwb(hsl),
4965
+ rgb: hslToRgb(hsl)
4966
+ };
4967
+ }
4968
+ function getColorStateForHsl(state, value) {
4969
+ state.hsl = getHslValue(value);
4970
+ state.rgb = hslToRgb(state.hsl);
4971
+ state.hex = hslToHex(state.hsl);
4972
+ state.hwb = hslToHwb(state.hsl);
4973
+ return state;
4974
+ }
4975
+ function getColorStateForHwb(state, value) {
4976
+ state.hwb = getHwbValue(value);
4977
+ state.hsl = hwbToHsl(state.hwb);
4978
+ state.rgb = hwbToRgb(state.hwb);
4979
+ state.hex = hwbToHex(state.hwb);
4980
+ return state;
4981
+ }
4982
+ function getColorStateForRgb(state, value) {
4983
+ state.rgb = getRgbValue(value);
4984
+ state.hex = rgbToHex(state.rgb);
4985
+ state.hsl = rgbToHsl(state.rgb);
4986
+ state.hwb = rgbToHwb(state.rgb);
4987
+ return state;
4988
+ }
4989
+ function getDefaultColorState(state) {
4990
+ state.alpha = getAlpha(100);
4991
+ state.hex = HEX_BLACK;
4992
+ state.hsl = { ...DEFAULT_HSL };
4993
+ state.hwb = { ...DEFAULT_HWB };
4994
+ state.rgb = { ...DEFAULT_RGB };
4637
4995
  return state;
4638
4996
  }
4639
4997
  function setHexColor(state, value, alpha) {
4640
4998
  if (!isHexColor(value) || !alpha && value === state.hex) return;
4641
4999
  const normalized = getNormalizedHex(value, true);
4642
5000
  const hex = normalized.slice(0, 6);
4643
- const rgb = hexToRgb(hex);
5001
+ const hsl = hexToHsl(hex);
4644
5002
  state.hex = hex;
4645
- state.hsl = rgbToHsl(rgb);
4646
- state.rgb = rgb;
5003
+ state.hsl = hsl;
5004
+ state.rgb = hslToRgb(hsl);
5005
+ state.hwb = hslToHwb(hsl);
4647
5006
  if (alpha) state.alpha = getAlpha(normalized.slice(6));
4648
5007
  }
4649
5008
  function setHSLColor(state, value, alpha) {
4650
5009
  if (!isHslLike(value)) return;
4651
5010
  const hsl = {
4652
5011
  hue: getDegrees(value.hue),
4653
- lightness: getPercentage(value.lightness),
4654
- saturation: getPercentage(value.saturation)
5012
+ saturation: getPercentage(value.saturation),
5013
+ lightness: getPercentage(value.lightness)
4655
5014
  };
4656
- const rgb = hslToRgb(hsl);
4657
- state.hex = rgbToHex(rgb);
4658
5015
  state.hsl = hsl;
4659
- state.rgb = rgb;
5016
+ state.hex = hslToHex(hsl);
5017
+ state.hwb = hslToHwb(hsl);
5018
+ state.rgb = hslToRgb(hsl);
5019
+ if (alpha) state.alpha = getAlpha(value.alpha);
5020
+ }
5021
+ function setHWBColor(state, value, alpha) {
5022
+ if (!isHwbLike(value)) return;
5023
+ const hwb = {
5024
+ hue: getDegrees(value.hue),
5025
+ whiteness: getPercentage(value.whiteness),
5026
+ blackness: getPercentage(value.blackness)
5027
+ };
5028
+ state.hwb = hwb;
5029
+ state.hex = hwbToHex(hwb);
5030
+ state.hsl = hwbToHsl(hwb);
5031
+ state.rgb = hwbToRgb(hwb);
4660
5032
  if (alpha) state.alpha = getAlpha(value.alpha);
4661
5033
  }
4662
5034
  function setRGBColor(state, value, alpha) {
@@ -4666,9 +5038,11 @@ function setRGBColor(state, value, alpha) {
4666
5038
  green: getHexValue(value.green),
4667
5039
  red: getHexValue(value.red)
4668
5040
  };
4669
- state.hex = rgbToHex(rgb);
4670
- state.hsl = rgbToHsl(rgb);
5041
+ const hsl = rgbToHsl(rgb);
5042
+ state.hsl = hsl;
4671
5043
  state.rgb = rgb;
5044
+ state.hex = hslToHex(hsl);
5045
+ state.hwb = hslToHwb(hsl);
4672
5046
  if (alpha) state.alpha = getAlpha(value.alpha);
4673
5047
  }
4674
5048
  //#endregion
@@ -4679,18 +5053,15 @@ function setRGBColor(state, value, alpha) {
4679
5053
  var Color = class {
4680
5054
  #state;
4681
5055
  /**
4682
- * Get the alpha channel _(opacity)_ of the color
5056
+ * Get the alpha channel _(opacity)_ of the color as a percentage between `0` and `100`
4683
5057
  *
4684
- * @returns Current alpha channel value between `0` and `1`
5058
+ * @returns Current alpha channel value
4685
5059
  */
4686
5060
  get alpha() {
4687
5061
  return this.#state.alpha.value;
4688
5062
  }
4689
5063
  /**
4690
- * Set the alpha channel _(opacity)_ of the color, as:
4691
- *
4692
- * - A number between `0` and `1`, where `0` is fully transparent and `1` is fully opaque
4693
- * - A number between `0` and `100`, where `0` is fully transparent and `100` is fully opaque
5064
+ * Set the alpha channel _(opacity)_ of the color as a percentage between `0` and `100`
4694
5065
  *
4695
5066
  * @param value New alpha channel value
4696
5067
  */
@@ -4745,7 +5116,7 @@ var Color = class {
4745
5116
  * @returns Current color as an _HSL_ color
4746
5117
  */
4747
5118
  get hsl() {
4748
- return this.#state.hsl;
5119
+ return { ...this.#state.hsl };
4749
5120
  }
4750
5121
  /**
4751
5122
  * Set colors from an _HSL_ color
@@ -4775,12 +5146,47 @@ var Color = class {
4775
5146
  setHSLColor(this.#state, value, true);
4776
5147
  }
4777
5148
  /**
5149
+ * Get the color as an _HWB_ color
5150
+ *
5151
+ * @returns Current color as an _HWB_ color
5152
+ */
5153
+ get hwb() {
5154
+ return { ...this.#state.hwb };
5155
+ }
5156
+ /**
5157
+ * Set colors from an _HWB_ color
5158
+ *
5159
+ * @param value New _HWB_ color
5160
+ */
5161
+ set hwb(value) {
5162
+ setHWBColor(this.#state, value, false);
5163
+ }
5164
+ /**
5165
+ * Get the color as an _HWBA_ color
5166
+ *
5167
+ * @returns Current color as an _HWBA_ color
5168
+ */
5169
+ get hwba() {
5170
+ return {
5171
+ ...this.#state.hwb,
5172
+ alpha: this.#state.alpha.value
5173
+ };
5174
+ }
5175
+ /**
5176
+ * Set colors and alpha from an _HWBA_ color
5177
+ *
5178
+ * @param value New _HWBA_ color
5179
+ */
5180
+ set hwba(value) {
5181
+ setHWBColor(this.#state, value, true);
5182
+ }
5183
+ /**
4778
5184
  * Get the color as an _RGB_ color
4779
5185
  *
4780
5186
  * @returns Current color as an _RGB_ color
4781
5187
  */
4782
5188
  get rgb() {
4783
- return this.#state.rgb;
5189
+ return { ...this.#state.rgb };
4784
5190
  }
4785
5191
  /**
4786
5192
  * Set colors from an _RGB_ color
@@ -4829,7 +5235,16 @@ var Color = class {
4829
5235
  * @returns _HSL(A)_ color string
4830
5236
  */
4831
5237
  toHslString(alpha) {
4832
- return formatColor("hsl", this, alpha === true);
5238
+ return formatHslColor(this, alpha === true);
5239
+ }
5240
+ /**
5241
+ * Get the color as an _HWB(A)_ string
5242
+ *
5243
+ * @param alpha Include alpha channel _(opacity)_? _(defaults to `false`)_
5244
+ * @returns _HWB(A)_ color string
5245
+ */
5246
+ toHwbString(alpha) {
5247
+ return formatHwbColor(this, alpha === true);
4833
5248
  }
4834
5249
  /**
4835
5250
  * Get the color as an _RGB(A)_ string
@@ -4838,7 +5253,7 @@ var Color = class {
4838
5253
  * @returns _RGB(A)_ color string
4839
5254
  */
4840
5255
  toRgbString(alpha) {
4841
- return formatColor("rgb", this, alpha === true);
5256
+ return formatRgbColor(this, alpha === true);
4842
5257
  }
4843
5258
  /**
4844
5259
  * Get the color as a hex color string
@@ -4854,7 +5269,7 @@ var Color = class {
4854
5269
  /**
4855
5270
  * Get a _Color_ from any kind of value
4856
5271
  *
4857
- * - Values that can be parsed are: hex(a) color strings, _HSL(A)_ color objects, and _RGB(A)_ color objects
5272
+ * - Values that can be parsed are: hex(a) color strings, as well as _HSL(A)_, _HWB(A)_, and _RGB(A)_ color objects
4858
5273
  * - If the value is unable to be parsed, a black _Color_ will be returned
4859
5274
  *
4860
5275
  * @param value Original value
@@ -5003,22 +5418,6 @@ function median(array, key) {
5003
5418
  function min(array, key) {
5004
5419
  return getAggregated("min", array, key);
5005
5420
  }
5006
- /**
5007
- * Round a number
5008
- *
5009
- * @param value Number to round
5010
- * @param decimals Number of decimal places to round to _(defaults to `0`)_
5011
- * @returns Rounded number, or `Number.NaN` if the value if unable to be rounded
5012
- */
5013
- function round(value, decimals) {
5014
- return roundNumber(Math.round, value, decimals);
5015
- }
5016
- function roundNumber(callback, value, decimals) {
5017
- if (typeof value !== "number") return NaN;
5018
- if (typeof decimals !== "number" || decimals < 1) return callback(value);
5019
- const mod = 10 ** decimals;
5020
- return callback((value + Number.EPSILON) * mod) / mod;
5021
- }
5022
5421
  function sum(array, key) {
5023
5422
  return getAggregated("sum", array, key);
5024
5423
  }
@@ -5062,7 +5461,7 @@ const PROMISE_MESSAGE_EXPECTATION_ATTEMPT = "Attempt expected a function or a pr
5062
5461
  const PROMISE_MESSAGE_EXPECTATION_RESULT = "toResult expected a Promise";
5063
5462
  const PROMISE_MESSAGE_EXPECTATION_TIMED = "Timed function expected a Promise";
5064
5463
  const PROMISE_MESSAGE_TIMEOUT = "Promise timed out";
5065
- const PROMISE_STRATEGY_ALL = new Set(["complete", "first"]);
5464
+ const PROMISE_STRATEGY_ALL = /* @__PURE__ */ new Set(["complete", "first"]);
5066
5465
  const PROMISE_STRATEGY_DEFAULT = "complete";
5067
5466
  const PROMISE_TYPE_FULFILLED = "fulfilled";
5068
5467
  const PROMISE_TYPE_REJECTED = "rejected";
@@ -5354,7 +5753,7 @@ const EQUAL = "=";
5354
5753
  const EXPRESSION_ARRAY_SUFFIX = /\[\]$/;
5355
5754
  const EXPRESSION_BOOLEAN = /^(false|true)$/;
5356
5755
  const TRUE = "true";
5357
- const TYPES = new Set([
5756
+ const TYPES = /* @__PURE__ */ new Set([
5358
5757
  "boolean",
5359
5758
  "number",
5360
5759
  "string"
@@ -5957,4 +6356,4 @@ var SizedSet = class extends Set {
5957
6356
  }
5958
6357
  };
5959
6358
  //#endregion
5960
- export { CancelablePromise, Logger, PROMISE_ABORT_EVENT, PROMISE_ABORT_OPTIONS, PROMISE_ERROR_NAME, PROMISE_MESSAGE_EXPECTATION_ATTEMPT, PROMISE_MESSAGE_EXPECTATION_RESULT, PROMISE_MESSAGE_EXPECTATION_TIMED, PROMISE_MESSAGE_TIMEOUT, PROMISE_STRATEGY_ALL, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED, PromiseTimeoutError, RetryError, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, SizedMap, SizedSet, assert, assertCondition, assertDefined, assertInstanceOf, assertIs, assertProperty, assign, asyncAttempt, asyncDebounce, asyncFlow, asyncMatchResult, asyncOnce, asyncPipe, asyncThrottle, attempt, attemptAsyncFlow, attemptAsyncPipe, attemptFlow, attemptPipe, attemptPromise, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, copy, count, debounce, deburr, dedent, delay, deregisterCloner, deregisterComparator, deregisterEqualizer, diff, difference, drop, endsWith, endsWithArray, equal, error, exclude, exists, filter, find, findLast, first, firstOrDefault, flatFreeze, flatten, floor, flow, freeze, fromQuery, toPromise as fromResult, toPromise, fuzzy, fuzzyMatch, getArray, getArrayComparison, getColor, getError, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloatingNumber as getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getSortedIndex, getString, getTimedPromise, getUuid, getValue, groupArraysBy, groupBy, handleResult, hasValue, hasValueResult, herald, hexToHsl, hexToHsla, hexToRgb, hexToRgba, hslToHex, hslToRgb, hslToRgba, ignoreKey, inMap, inSet, includes, includesArray, indexOf, indexOfArray, initializeAssigner, initializeEqualizer, initializeMerger, initializeNormalizer, initializeSorter, initializeTemplater, initializeTransformer, insert, interpolate, intersection, isArrayOrPlainObject, isColor, isConstructor, isEmpty, isError, isFrozen, isFulfilled, isHexColor, isHslColor, isHslLike, isHslaColor, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonEmpty, isNonInstanceOf, isNonKey, isNonNullable, isNonNullableOrEmpty, isNonNullableOrWhitespace, isNonNumber, isNonNumerical, isNonObject, isNonPlainObject, isNonPrimitive, isNonTypedArray, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isOk, isPlainObject, isPrimitive, isRejected, isResult, isRgbColor, isRgbLike, isRgbaColor, isSorted, isTypedArray, join, kebabCase, keyedQueue, last, lastIndexOf, lastOrDefault, lowerCase, matchResult, max, median, memoize, merge, min, move, moveIndices, moveToIndex, noop, normalize, ok, omit, once, parse, partition, pascalCase, pick, pipe, promises, push, queue, range, registerCloner, registerComparator, registerEqualizer, resultPromises, retry, reverse, rgbToHex, rgbToHsl, rgbToHsla, round, select, setValue, settlePromise, shake, shuffle, single, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toResult, toSet, toggle, transform, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };
6359
+ export { CancelablePromise, Logger, PROMISE_ABORT_EVENT, PROMISE_ABORT_OPTIONS, PROMISE_ERROR_NAME, PROMISE_MESSAGE_EXPECTATION_ATTEMPT, PROMISE_MESSAGE_EXPECTATION_RESULT, PROMISE_MESSAGE_EXPECTATION_TIMED, PROMISE_MESSAGE_TIMEOUT, PROMISE_STRATEGY_ALL, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED, PromiseTimeoutError, RetryError, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, SizedMap, SizedSet, assert, assertCondition, assertDefined, assertInstanceOf, assertIs, assertProperty, assign, asyncAttempt, asyncDebounce, asyncFlow, asyncMatchResult, asyncOnce, asyncPipe, asyncThrottle, attempt, attemptAsyncFlow, attemptAsyncPipe, attemptFlow, attemptPipe, attemptPromise, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, copy, count, debounce, deburr, dedent, delay, deregisterCloner, deregisterComparator, deregisterEqualizer, diff, difference, drop, endsWith, endsWithArray, equal, error, exclude, exists, filter, find, findLast, first, firstOrDefault, flatFreeze, flatten, floor, flow, freeze, fromQuery, toPromise as fromResult, toPromise, fuzzy, fuzzyMatch, getArray, getArrayComparison, getColor, getError, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloatingNumber as getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getSortedIndex, getString, getTimedPromise, getUuid, getValue, groupArraysBy, groupBy, handleResult, hasValue, hasValueResult, herald, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba, hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba, hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba, ignoreKey, inMap, inSet, includes, includesArray, indexOf, indexOfArray, initializeAssigner, initializeEqualizer, initializeMerger, initializeNormalizer, initializeSorter, initializeTemplater, initializeTransformer, insert, interpolate, intersection, isArrayOrPlainObject, isColor, isConstructor, isEmpty, isError, isFrozen, isFulfilled, isHexColor, isHslColor, isHslLike, isHslaColor, isHwbColor, isHwbLike, isHwbaColor, isHwbaLike, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonEmpty, isNonInstanceOf, isNonKey, isNonNullable, isNonNullableOrEmpty, isNonNullableOrWhitespace, isNonNumber, isNonNumerical, isNonObject, isNonPlainObject, isNonPrimitive, isNonTypedArray, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isOk, isPlainObject, isPrimitive, isRejected, isResult, isRgbColor, isRgbLike, isRgbaColor, isSorted, isTypedArray, join, kebabCase, keyedQueue, last, lastIndexOf, lastOrDefault, lowerCase, matchResult, max, median, memoize, merge, min, move, moveIndices, moveToIndex, noop, normalize, ok, omit, once, parse, partition, pascalCase, pick, pipe, promises, push, queue, range, registerCloner, registerComparator, registerEqualizer, resultPromises, retry, reverse, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba, round, select, setValue, settlePromise, shake, shuffle, single, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toResult, toSet, toggle, transform, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };