@oxyhq/bloom 0.36.0 → 0.37.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 (235) hide show
  1. package/lib/commonjs/theme/build-theme.js +31 -43
  2. package/lib/commonjs/theme/build-theme.js.map +1 -1
  3. package/lib/commonjs/theme/color-engine/cam16.js +161 -0
  4. package/lib/commonjs/theme/color-engine/cam16.js.map +1 -0
  5. package/lib/commonjs/theme/color-engine/color-role.js +183 -0
  6. package/lib/commonjs/theme/color-engine/color-role.js.map +1 -0
  7. package/lib/commonjs/theme/color-engine/color-roles.js +416 -0
  8. package/lib/commonjs/theme/color-engine/color-roles.js.map +1 -0
  9. package/lib/commonjs/theme/color-engine/color-utils.js +157 -0
  10. package/lib/commonjs/theme/color-engine/color-utils.js.map +1 -0
  11. package/lib/commonjs/theme/color-engine/contrast-curve.js +32 -0
  12. package/lib/commonjs/theme/color-engine/contrast-curve.js.map +1 -0
  13. package/lib/commonjs/theme/color-engine/contrast.js +70 -0
  14. package/lib/commonjs/theme/color-engine/contrast.js.map +1 -0
  15. package/lib/commonjs/theme/color-engine/dislike-analyzer.js +26 -0
  16. package/lib/commonjs/theme/color-engine/dislike-analyzer.js.map +1 -0
  17. package/lib/commonjs/theme/color-engine/dynamic-scheme.js +70 -0
  18. package/lib/commonjs/theme/color-engine/dynamic-scheme.js.map +1 -0
  19. package/lib/commonjs/theme/color-engine/hct-solver.js +236 -0
  20. package/lib/commonjs/theme/color-engine/hct-solver.js.map +1 -0
  21. package/lib/commonjs/theme/color-engine/hct.js +67 -0
  22. package/lib/commonjs/theme/color-engine/hct.js.map +1 -0
  23. package/lib/commonjs/theme/color-engine/index.js +173 -0
  24. package/lib/commonjs/theme/color-engine/index.js.map +1 -0
  25. package/lib/commonjs/theme/color-engine/lab-point-provider.js +32 -0
  26. package/lib/commonjs/theme/color-engine/lab-point-provider.js.map +1 -0
  27. package/lib/commonjs/theme/color-engine/math-utils.js +77 -0
  28. package/lib/commonjs/theme/color-engine/math-utils.js.map +1 -0
  29. package/lib/commonjs/theme/color-engine/quantizer-map.js +24 -0
  30. package/lib/commonjs/theme/color-engine/quantizer-map.js.map +1 -0
  31. package/lib/commonjs/theme/color-engine/quantizer-wu.js +266 -0
  32. package/lib/commonjs/theme/color-engine/quantizer-wu.js.map +1 -0
  33. package/lib/commonjs/theme/color-engine/scheme-variants.js +102 -0
  34. package/lib/commonjs/theme/color-engine/scheme-variants.js.map +1 -0
  35. package/lib/commonjs/theme/color-engine/score.js +80 -0
  36. package/lib/commonjs/theme/color-engine/score.js.map +1 -0
  37. package/lib/commonjs/theme/color-engine/seed-from-image.js +73 -0
  38. package/lib/commonjs/theme/color-engine/seed-from-image.js.map +1 -0
  39. package/lib/commonjs/theme/color-engine/tonal-palette.js +95 -0
  40. package/lib/commonjs/theme/color-engine/tonal-palette.js.map +1 -0
  41. package/lib/commonjs/theme/color-engine/tone-delta-pair.js +26 -0
  42. package/lib/commonjs/theme/color-engine/tone-delta-pair.js.map +1 -0
  43. package/lib/commonjs/theme/color-engine/variant.js +26 -0
  44. package/lib/commonjs/theme/color-engine/variant.js.map +1 -0
  45. package/lib/commonjs/theme/color-engine/viewing-conditions.js +61 -0
  46. package/lib/commonjs/theme/color-engine/viewing-conditions.js.map +1 -0
  47. package/lib/commonjs/theme/color-presets.js +44 -572
  48. package/lib/commonjs/theme/color-presets.js.map +1 -1
  49. package/lib/commonjs/theme/preset-vars.js +64 -47
  50. package/lib/commonjs/theme/preset-vars.js.map +1 -1
  51. package/lib/module/theme/build-theme.js +32 -44
  52. package/lib/module/theme/build-theme.js.map +1 -1
  53. package/lib/module/theme/color-engine/cam16.js +155 -0
  54. package/lib/module/theme/color-engine/cam16.js.map +1 -0
  55. package/lib/module/theme/color-engine/color-role.js +177 -0
  56. package/lib/module/theme/color-engine/color-role.js.map +1 -0
  57. package/lib/module/theme/color-engine/color-roles.js +411 -0
  58. package/lib/module/theme/color-engine/color-roles.js.map +1 -0
  59. package/lib/module/theme/color-engine/color-utils.js +135 -0
  60. package/lib/module/theme/color-engine/color-utils.js.map +1 -0
  61. package/lib/module/theme/color-engine/contrast-curve.js +26 -0
  62. package/lib/module/theme/color-engine/contrast-curve.js.map +1 -0
  63. package/lib/module/theme/color-engine/contrast.js +61 -0
  64. package/lib/module/theme/color-engine/contrast.js.map +1 -0
  65. package/lib/module/theme/color-engine/dislike-analyzer.js +20 -0
  66. package/lib/module/theme/color-engine/dislike-analyzer.js.map +1 -0
  67. package/lib/module/theme/color-engine/dynamic-scheme.js +65 -0
  68. package/lib/module/theme/color-engine/dynamic-scheme.js.map +1 -0
  69. package/lib/module/theme/color-engine/hct-solver.js +231 -0
  70. package/lib/module/theme/color-engine/hct-solver.js.map +1 -0
  71. package/lib/module/theme/color-engine/hct.js +61 -0
  72. package/lib/module/theme/color-engine/hct.js.map +1 -0
  73. package/lib/module/theme/color-engine/index.js +57 -0
  74. package/lib/module/theme/color-engine/index.js.map +1 -0
  75. package/lib/module/theme/color-engine/lab-point-provider.js +25 -0
  76. package/lib/module/theme/color-engine/lab-point-provider.js.map +1 -0
  77. package/lib/module/theme/color-engine/math-utils.js +65 -0
  78. package/lib/module/theme/color-engine/math-utils.js.map +1 -0
  79. package/lib/module/theme/color-engine/quantizer-map.js +20 -0
  80. package/lib/module/theme/color-engine/quantizer-map.js.map +1 -0
  81. package/lib/module/theme/color-engine/quantizer-wu.js +261 -0
  82. package/lib/module/theme/color-engine/quantizer-wu.js.map +1 -0
  83. package/lib/module/theme/color-engine/scheme-variants.js +93 -0
  84. package/lib/module/theme/color-engine/scheme-variants.js.map +1 -0
  85. package/lib/module/theme/color-engine/score.js +75 -0
  86. package/lib/module/theme/color-engine/score.js.map +1 -0
  87. package/lib/module/theme/color-engine/seed-from-image.js +67 -0
  88. package/lib/module/theme/color-engine/seed-from-image.js.map +1 -0
  89. package/lib/module/theme/color-engine/tonal-palette.js +89 -0
  90. package/lib/module/theme/color-engine/tonal-palette.js.map +1 -0
  91. package/lib/module/theme/color-engine/tone-delta-pair.js +21 -0
  92. package/lib/module/theme/color-engine/tone-delta-pair.js.map +1 -0
  93. package/lib/module/theme/color-engine/variant.js +22 -0
  94. package/lib/module/theme/color-engine/variant.js.map +1 -0
  95. package/lib/module/theme/color-engine/viewing-conditions.js +55 -0
  96. package/lib/module/theme/color-engine/viewing-conditions.js.map +1 -0
  97. package/lib/module/theme/color-presets.js +44 -572
  98. package/lib/module/theme/color-presets.js.map +1 -1
  99. package/lib/module/theme/preset-vars.js +64 -46
  100. package/lib/module/theme/preset-vars.js.map +1 -1
  101. package/lib/typescript/commonjs/theme/build-theme.d.ts.map +1 -1
  102. package/lib/typescript/commonjs/theme/color-engine/cam16.d.ts +26 -0
  103. package/lib/typescript/commonjs/theme/color-engine/cam16.d.ts.map +1 -0
  104. package/lib/typescript/commonjs/theme/color-engine/color-role.d.ts +36 -0
  105. package/lib/typescript/commonjs/theme/color-engine/color-role.d.ts.map +1 -0
  106. package/lib/typescript/commonjs/theme/color-engine/color-roles.d.ts +58 -0
  107. package/lib/typescript/commonjs/theme/color-engine/color-roles.d.ts.map +1 -0
  108. package/lib/typescript/commonjs/theme/color-engine/color-utils.d.ts +32 -0
  109. package/lib/typescript/commonjs/theme/color-engine/color-utils.d.ts.map +1 -0
  110. package/lib/typescript/commonjs/theme/color-engine/contrast-curve.d.ts +9 -0
  111. package/lib/typescript/commonjs/theme/color-engine/contrast-curve.d.ts.map +1 -0
  112. package/lib/typescript/commonjs/theme/color-engine/contrast.d.ts +12 -0
  113. package/lib/typescript/commonjs/theme/color-engine/contrast.d.ts.map +1 -0
  114. package/lib/typescript/commonjs/theme/color-engine/dislike-analyzer.d.ts +11 -0
  115. package/lib/typescript/commonjs/theme/color-engine/dislike-analyzer.d.ts.map +1 -0
  116. package/lib/typescript/commonjs/theme/color-engine/dynamic-scheme.d.ts +47 -0
  117. package/lib/typescript/commonjs/theme/color-engine/dynamic-scheme.d.ts.map +1 -0
  118. package/lib/typescript/commonjs/theme/color-engine/hct-solver.d.ts +6 -0
  119. package/lib/typescript/commonjs/theme/color-engine/hct-solver.d.ts.map +1 -0
  120. package/lib/typescript/commonjs/theme/color-engine/hct.d.ts +20 -0
  121. package/lib/typescript/commonjs/theme/color-engine/hct.d.ts.map +1 -0
  122. package/lib/typescript/commonjs/theme/color-engine/index.d.ts +44 -0
  123. package/lib/typescript/commonjs/theme/color-engine/index.d.ts.map +1 -0
  124. package/lib/typescript/commonjs/theme/color-engine/lab-point-provider.d.ts +6 -0
  125. package/lib/typescript/commonjs/theme/color-engine/lab-point-provider.d.ts.map +1 -0
  126. package/lib/typescript/commonjs/theme/color-engine/math-utils.d.ts +46 -0
  127. package/lib/typescript/commonjs/theme/color-engine/math-utils.d.ts.map +1 -0
  128. package/lib/typescript/commonjs/theme/color-engine/quantizer-map.d.ts +3 -0
  129. package/lib/typescript/commonjs/theme/color-engine/quantizer-map.d.ts.map +1 -0
  130. package/lib/typescript/commonjs/theme/color-engine/quantizer-wu.d.ts +3 -0
  131. package/lib/typescript/commonjs/theme/color-engine/quantizer-wu.d.ts.map +1 -0
  132. package/lib/typescript/commonjs/theme/color-engine/scheme-variants.d.ts +23 -0
  133. package/lib/typescript/commonjs/theme/color-engine/scheme-variants.d.ts.map +1 -0
  134. package/lib/typescript/commonjs/theme/color-engine/score.d.ts +8 -0
  135. package/lib/typescript/commonjs/theme/color-engine/score.d.ts.map +1 -0
  136. package/lib/typescript/commonjs/theme/color-engine/seed-from-image.d.ts +13 -0
  137. package/lib/typescript/commonjs/theme/color-engine/seed-from-image.d.ts.map +1 -0
  138. package/lib/typescript/commonjs/theme/color-engine/tonal-palette.d.ts +24 -0
  139. package/lib/typescript/commonjs/theme/color-engine/tonal-palette.d.ts.map +1 -0
  140. package/lib/typescript/commonjs/theme/color-engine/tone-delta-pair.d.ts +19 -0
  141. package/lib/typescript/commonjs/theme/color-engine/tone-delta-pair.d.ts.map +1 -0
  142. package/lib/typescript/commonjs/theme/color-engine/variant.d.ts +19 -0
  143. package/lib/typescript/commonjs/theme/color-engine/variant.d.ts.map +1 -0
  144. package/lib/typescript/commonjs/theme/color-engine/viewing-conditions.d.ts +18 -0
  145. package/lib/typescript/commonjs/theme/color-engine/viewing-conditions.d.ts.map +1 -0
  146. package/lib/typescript/commonjs/theme/color-presets.d.ts +25 -20
  147. package/lib/typescript/commonjs/theme/color-presets.d.ts.map +1 -1
  148. package/lib/typescript/commonjs/theme/preset-vars.d.ts +16 -12
  149. package/lib/typescript/commonjs/theme/preset-vars.d.ts.map +1 -1
  150. package/lib/typescript/module/theme/build-theme.d.ts.map +1 -1
  151. package/lib/typescript/module/theme/color-engine/cam16.d.ts +26 -0
  152. package/lib/typescript/module/theme/color-engine/cam16.d.ts.map +1 -0
  153. package/lib/typescript/module/theme/color-engine/color-role.d.ts +36 -0
  154. package/lib/typescript/module/theme/color-engine/color-role.d.ts.map +1 -0
  155. package/lib/typescript/module/theme/color-engine/color-roles.d.ts +58 -0
  156. package/lib/typescript/module/theme/color-engine/color-roles.d.ts.map +1 -0
  157. package/lib/typescript/module/theme/color-engine/color-utils.d.ts +32 -0
  158. package/lib/typescript/module/theme/color-engine/color-utils.d.ts.map +1 -0
  159. package/lib/typescript/module/theme/color-engine/contrast-curve.d.ts +9 -0
  160. package/lib/typescript/module/theme/color-engine/contrast-curve.d.ts.map +1 -0
  161. package/lib/typescript/module/theme/color-engine/contrast.d.ts +12 -0
  162. package/lib/typescript/module/theme/color-engine/contrast.d.ts.map +1 -0
  163. package/lib/typescript/module/theme/color-engine/dislike-analyzer.d.ts +11 -0
  164. package/lib/typescript/module/theme/color-engine/dislike-analyzer.d.ts.map +1 -0
  165. package/lib/typescript/module/theme/color-engine/dynamic-scheme.d.ts +47 -0
  166. package/lib/typescript/module/theme/color-engine/dynamic-scheme.d.ts.map +1 -0
  167. package/lib/typescript/module/theme/color-engine/hct-solver.d.ts +6 -0
  168. package/lib/typescript/module/theme/color-engine/hct-solver.d.ts.map +1 -0
  169. package/lib/typescript/module/theme/color-engine/hct.d.ts +20 -0
  170. package/lib/typescript/module/theme/color-engine/hct.d.ts.map +1 -0
  171. package/lib/typescript/module/theme/color-engine/index.d.ts +44 -0
  172. package/lib/typescript/module/theme/color-engine/index.d.ts.map +1 -0
  173. package/lib/typescript/module/theme/color-engine/lab-point-provider.d.ts +6 -0
  174. package/lib/typescript/module/theme/color-engine/lab-point-provider.d.ts.map +1 -0
  175. package/lib/typescript/module/theme/color-engine/math-utils.d.ts +46 -0
  176. package/lib/typescript/module/theme/color-engine/math-utils.d.ts.map +1 -0
  177. package/lib/typescript/module/theme/color-engine/quantizer-map.d.ts +3 -0
  178. package/lib/typescript/module/theme/color-engine/quantizer-map.d.ts.map +1 -0
  179. package/lib/typescript/module/theme/color-engine/quantizer-wu.d.ts +3 -0
  180. package/lib/typescript/module/theme/color-engine/quantizer-wu.d.ts.map +1 -0
  181. package/lib/typescript/module/theme/color-engine/scheme-variants.d.ts +23 -0
  182. package/lib/typescript/module/theme/color-engine/scheme-variants.d.ts.map +1 -0
  183. package/lib/typescript/module/theme/color-engine/score.d.ts +8 -0
  184. package/lib/typescript/module/theme/color-engine/score.d.ts.map +1 -0
  185. package/lib/typescript/module/theme/color-engine/seed-from-image.d.ts +13 -0
  186. package/lib/typescript/module/theme/color-engine/seed-from-image.d.ts.map +1 -0
  187. package/lib/typescript/module/theme/color-engine/tonal-palette.d.ts +24 -0
  188. package/lib/typescript/module/theme/color-engine/tonal-palette.d.ts.map +1 -0
  189. package/lib/typescript/module/theme/color-engine/tone-delta-pair.d.ts +19 -0
  190. package/lib/typescript/module/theme/color-engine/tone-delta-pair.d.ts.map +1 -0
  191. package/lib/typescript/module/theme/color-engine/variant.d.ts +19 -0
  192. package/lib/typescript/module/theme/color-engine/variant.d.ts.map +1 -0
  193. package/lib/typescript/module/theme/color-engine/viewing-conditions.d.ts +18 -0
  194. package/lib/typescript/module/theme/color-engine/viewing-conditions.d.ts.map +1 -0
  195. package/lib/typescript/module/theme/color-presets.d.ts +25 -20
  196. package/lib/typescript/module/theme/color-presets.d.ts.map +1 -1
  197. package/lib/typescript/module/theme/preset-vars.d.ts +16 -12
  198. package/lib/typescript/module/theme/preset-vars.d.ts.map +1 -1
  199. package/package.json +1 -1
  200. package/src/__tests__/BloomThemeProvider.test.tsx +9 -4
  201. package/src/__tests__/native-root-vars.test.ts +8 -4
  202. package/src/__tests__/preset-vars.test.ts +66 -37
  203. package/src/__tests__/theme.test.ts +20 -12
  204. package/src/theme/__tests__/__fixtures__/golden-resolved-tokens.json +509 -509
  205. package/src/theme/__tests__/__snapshots__/visual-gallery.test.tsx.snap +613 -613
  206. package/src/theme/__tests__/color-engine-golden.test.ts +81 -0
  207. package/src/theme/__tests__/fixtures/color-engine-golden.json +1 -0
  208. package/src/theme/__tests__/golden-tokens.test.ts +6 -7
  209. package/src/theme/__tests__/runtime-contract.test.ts +8 -8
  210. package/src/theme/__tests__/theme-colors-parity.test.ts +44 -88
  211. package/src/theme/build-theme.ts +32 -44
  212. package/src/theme/color-engine/cam16.ts +179 -0
  213. package/src/theme/color-engine/color-role.ts +217 -0
  214. package/src/theme/color-engine/color-roles.ts +435 -0
  215. package/src/theme/color-engine/color-utils.ts +157 -0
  216. package/src/theme/color-engine/contrast-curve.ts +25 -0
  217. package/src/theme/color-engine/contrast.ts +59 -0
  218. package/src/theme/color-engine/dislike-analyzer.ts +19 -0
  219. package/src/theme/color-engine/dynamic-scheme.ts +90 -0
  220. package/src/theme/color-engine/hct-solver.ts +263 -0
  221. package/src/theme/color-engine/hct.ts +69 -0
  222. package/src/theme/color-engine/index.ts +73 -0
  223. package/src/theme/color-engine/lab-point-provider.ts +26 -0
  224. package/src/theme/color-engine/math-utils.ts +69 -0
  225. package/src/theme/color-engine/quantizer-map.ts +17 -0
  226. package/src/theme/color-engine/quantizer-wu.ts +320 -0
  227. package/src/theme/color-engine/scheme-variants.ts +113 -0
  228. package/src/theme/color-engine/score.ts +82 -0
  229. package/src/theme/color-engine/seed-from-image.ts +64 -0
  230. package/src/theme/color-engine/tonal-palette.ts +94 -0
  231. package/src/theme/color-engine/tone-delta-pair.ts +21 -0
  232. package/src/theme/color-engine/variant.ts +18 -0
  233. package/src/theme/color-engine/viewing-conditions.ts +77 -0
  234. package/src/theme/color-presets.ts +54 -631
  235. package/src/theme/preset-vars.ts +65 -49
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Bloom colour engine — scheme variants.
3
+ *
4
+ * The families of dynamic-colour scheme supported by the engine. Bloom exposes
5
+ * the useful subset (Vibrant, Expressive, TonalSpot, Neutral, Fidelity); the
6
+ * numeric values match Material Color Utilities so ported scheme logic lines up.
7
+ */
8
+ export enum Variant {
9
+ MONOCHROME = 0,
10
+ NEUTRAL = 1,
11
+ TONAL_SPOT = 2,
12
+ VIBRANT = 3,
13
+ EXPRESSIVE = 4,
14
+ FIDELITY = 5,
15
+ CONTENT = 6,
16
+ RAINBOW = 7,
17
+ FRUIT_SALAD = 8,
18
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Bloom colour engine — CAM16 viewing conditions.
3
+ *
4
+ * Faithful port of Material Color Utilities' `ViewingConditions` (Apache-2.0)
5
+ * into Bloom's own code. Caches the CAM16 intermediates that depend only on the
6
+ * environment (white point, adapting luminance, surround) so the appearance
7
+ * model can run fast. Bloom only ever uses the sRGB `DEFAULT`.
8
+ */
9
+ import { whitePointD65, yFromLstar } from './color-utils';
10
+ import { lerp } from './math-utils';
11
+
12
+ export class ViewingConditions {
13
+ private static _default: ViewingConditions | undefined;
14
+ /** sRGB-like viewing conditions (the only ones Bloom uses). */
15
+ static get DEFAULT(): ViewingConditions {
16
+ return (ViewingConditions._default ??= ViewingConditions.make());
17
+ }
18
+
19
+ private constructor(
20
+ readonly n: number,
21
+ readonly aw: number,
22
+ readonly nbb: number,
23
+ readonly ncb: number,
24
+ readonly c: number,
25
+ readonly nc: number,
26
+ readonly rgbD: [number, number, number],
27
+ readonly fl: number,
28
+ readonly fLRoot: number,
29
+ readonly z: number,
30
+ ) {}
31
+
32
+ static make(
33
+ whitePoint: [number, number, number] = whitePointD65(),
34
+ adaptingLuminance: number = ((200.0 / Math.PI) * yFromLstar(50.0)) / 100.0,
35
+ backgroundLstar = 50.0,
36
+ surround = 2.0,
37
+ discountingIlluminant = false,
38
+ ): ViewingConditions {
39
+ const xyz = whitePoint;
40
+ const rW = xyz[0] * 0.401288 + xyz[1] * 0.650173 + xyz[2] * -0.051461;
41
+ const gW = xyz[0] * -0.250268 + xyz[1] * 1.204414 + xyz[2] * 0.045854;
42
+ const bW = xyz[0] * -0.002079 + xyz[1] * 0.048952 + xyz[2] * 0.953127;
43
+ const f = 0.8 + surround / 10.0;
44
+ const c =
45
+ f >= 0.9 ? lerp(0.59, 0.69, (f - 0.9) * 10.0) : lerp(0.525, 0.59, (f - 0.8) * 10.0);
46
+ let d = discountingIlluminant
47
+ ? 1.0
48
+ : f * (1.0 - (1.0 / 3.6) * Math.exp((-adaptingLuminance - 42.0) / 92.0));
49
+ d = d > 1.0 ? 1.0 : d < 0.0 ? 0.0 : d;
50
+ const nc = f;
51
+ const rgbD: [number, number, number] = [
52
+ d * (100.0 / rW) + 1.0 - d,
53
+ d * (100.0 / gW) + 1.0 - d,
54
+ d * (100.0 / bW) + 1.0 - d,
55
+ ];
56
+ const k = 1.0 / (5.0 * adaptingLuminance + 1.0);
57
+ const k4 = k * k * k * k;
58
+ const k4F = 1.0 - k4;
59
+ const fl = k4 * adaptingLuminance + 0.1 * k4F * k4F * Math.cbrt(5.0 * adaptingLuminance);
60
+ const n = yFromLstar(backgroundLstar) / whitePoint[1];
61
+ const z = 1.48 + Math.sqrt(n);
62
+ const nbb = 0.725 / Math.pow(n, 0.2);
63
+ const ncb = nbb;
64
+ const rgbAFactors: [number, number, number] = [
65
+ Math.pow((fl * rgbD[0] * rW) / 100.0, 0.42),
66
+ Math.pow((fl * rgbD[1] * gW) / 100.0, 0.42),
67
+ Math.pow((fl * rgbD[2] * bW) / 100.0, 0.42),
68
+ ];
69
+ const rgbA: [number, number, number] = [
70
+ (400.0 * rgbAFactors[0]) / (rgbAFactors[0] + 27.13),
71
+ (400.0 * rgbAFactors[1]) / (rgbAFactors[1] + 27.13),
72
+ (400.0 * rgbAFactors[2]) / (rgbAFactors[2] + 27.13),
73
+ ];
74
+ const aw = (2.0 * rgbA[0] + rgbA[1] + 0.05 * rgbA[2]) * nbb;
75
+ return new ViewingConditions(n, aw, nbb, ncb, c, nc, rgbD, fl, Math.pow(fl, 0.25), z);
76
+ }
77
+ }