framework7 8.3.4 → 9.0.0-beta.1

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 (307) hide show
  1. package/components/actions/actions-ios.less +22 -15
  2. package/components/actions/actions-rtl.css +1 -1
  3. package/components/actions/actions-vars.less +4 -7
  4. package/components/actions/actions.css +1 -1
  5. package/components/actions/actions.js +2 -8
  6. package/components/actions/actions.less +0 -3
  7. package/components/app/app-class.d.ts +2 -0
  8. package/components/app/app-class.js +19 -15
  9. package/components/app/app-vars.less +41 -6
  10. package/components/app/app.less +1 -1
  11. package/components/area-chart/area-chart-class.js +18 -31
  12. package/components/area-chart/area-chart-rtl.css +1 -1
  13. package/components/area-chart/area-chart.css +1 -1
  14. package/components/autocomplete/autocomplete-class.js +13 -14
  15. package/components/autocomplete/autocomplete-ios.less +16 -0
  16. package/components/autocomplete/autocomplete-rtl.css +1 -1
  17. package/components/autocomplete/autocomplete.css +1 -1
  18. package/components/autocomplete/autocomplete.d.ts +3 -3
  19. package/components/autocomplete/autocomplete.js +3 -3
  20. package/components/autocomplete/autocomplete.less +7 -1
  21. package/components/block/block-vars.less +6 -6
  22. package/components/breadcrumbs/breadcrumbs-rtl.css +1 -1
  23. package/components/breadcrumbs/breadcrumbs.css +1 -1
  24. package/components/button/button-vars.less +13 -12
  25. package/components/button/button.less +2 -1
  26. package/components/calendar/calendar-class.js +20 -17
  27. package/components/calendar/calendar-ios.less +43 -0
  28. package/components/calendar/calendar-md.less +3 -0
  29. package/components/calendar/calendar-rtl.css +1 -1
  30. package/components/calendar/calendar-vars.less +24 -19
  31. package/components/calendar/calendar.css +1 -1
  32. package/components/calendar/calendar.d.ts +1 -1
  33. package/components/calendar/calendar.js +5 -8
  34. package/components/calendar/calendar.less +4 -2
  35. package/components/card/card-rtl.css +1 -1
  36. package/components/card/card-vars.less +5 -5
  37. package/components/card/card.css +1 -1
  38. package/components/card/card.js +3 -18
  39. package/components/card/card.less +1 -1
  40. package/components/color-picker/color-picker-class.js +11 -23
  41. package/components/color-picker/color-picker-ios.less +9 -0
  42. package/components/color-picker/color-picker-md.less +15 -0
  43. package/components/color-picker/color-picker-rtl.css +1 -1
  44. package/components/color-picker/color-picker-vars.less +9 -3
  45. package/components/color-picker/color-picker.css +1 -1
  46. package/components/color-picker/color-picker.d.ts +1 -2
  47. package/components/color-picker/color-picker.js +3 -7
  48. package/components/color-picker/color-picker.less +5 -25
  49. package/components/color-picker/modules/alpha-slider.js +2 -0
  50. package/components/color-picker/modules/brightness-slider.js +2 -0
  51. package/components/color-picker/modules/hs-spectrum.js +1 -2
  52. package/components/color-picker/modules/hsb-sliders.js +6 -0
  53. package/components/color-picker/modules/hue-slider.js +2 -0
  54. package/components/color-picker/modules/rgb-bars.js +6 -0
  55. package/components/color-picker/modules/rgb-sliders.js +6 -0
  56. package/components/color-picker/modules/sb-spectrum.js +1 -2
  57. package/components/color-picker/modules/wheel.js +1 -2
  58. package/components/data-table/data-table-class.js +1 -4
  59. package/components/data-table/data-table-ios.less +1 -1
  60. package/components/data-table/data-table-md.less +4 -2
  61. package/components/data-table/data-table-rtl.css +1 -1
  62. package/components/data-table/data-table.css +1 -1
  63. package/components/data-table/data-table.less +4 -4
  64. package/components/dialog/dialog-class.js +6 -3
  65. package/components/dialog/dialog-ios.less +10 -34
  66. package/components/dialog/dialog-md.less +2 -22
  67. package/components/dialog/dialog-rtl.css +1 -1
  68. package/components/dialog/dialog-vars.less +8 -10
  69. package/components/dialog/dialog.css +1 -1
  70. package/components/dialog/dialog.js +9 -27
  71. package/components/dialog/dialog.less +6 -25
  72. package/components/fab/fab-ios.less +2 -0
  73. package/components/fab/fab-rtl.css +1 -1
  74. package/components/fab/fab-vars.less +30 -6
  75. package/components/fab/fab.css +1 -1
  76. package/components/fab/fab.js +3 -12
  77. package/components/gauge/gauge-class.js +2 -8
  78. package/components/icon/icon-ios.less +10 -0
  79. package/components/icon/icon-md.less +9 -0
  80. package/components/icon/icon.less +2 -1
  81. package/components/input/input-ios.less +3 -2
  82. package/components/input/input-rtl.css +1 -1
  83. package/components/input/input.css +1 -1
  84. package/components/input/input.js +2 -5
  85. package/components/list/list-vars.less +7 -5
  86. package/components/list/list.less +1 -1
  87. package/components/list-index/list-index-class.js +3 -7
  88. package/components/login-screen/login-screen.js +2 -8
  89. package/components/login-screen/login-screen.less +1 -0
  90. package/components/messagebar/messagebar-class.js +5 -20
  91. package/components/messagebar/messagebar-ios.less +19 -14
  92. package/components/messagebar/messagebar-md.less +3 -0
  93. package/components/messagebar/messagebar-rtl.css +1 -1
  94. package/components/messagebar/messagebar-vars.less +12 -15
  95. package/components/messagebar/messagebar.css +1 -1
  96. package/components/messagebar/messagebar.less +4 -5
  97. package/components/messages/messages-class.js +25 -52
  98. package/components/messages/messages-ios.less +6 -2
  99. package/components/messages/messages-rtl.css +1 -1
  100. package/components/messages/messages-vars.less +1 -1
  101. package/components/messages/messages.css +1 -1
  102. package/components/navbar/navbar-ios.less +48 -672
  103. package/components/navbar/navbar-md.less +41 -1
  104. package/components/navbar/navbar-vars.less +4 -3
  105. package/components/navbar/navbar.js +28 -185
  106. package/components/navbar/navbar.less +8 -66
  107. package/components/notification/notification-class.js +6 -6
  108. package/components/notification/notification-ios.less +3 -8
  109. package/components/notification/notification-md.less +1 -20
  110. package/components/notification/notification-rtl.css +1 -1
  111. package/components/notification/notification-vars.less +13 -16
  112. package/components/notification/notification.css +1 -1
  113. package/components/notification/notification.less +8 -1
  114. package/components/page/page-ios.less +1 -8
  115. package/components/page/page-md.less +12 -11
  116. package/components/page/page.less +14 -12
  117. package/components/panel/panel-class.js +7 -28
  118. package/components/panel/panel-ios.less +4 -0
  119. package/components/panel/panel-rtl.css +2 -2
  120. package/components/panel/panel-vars.less +8 -5
  121. package/components/panel/panel.css +2 -2
  122. package/components/panel/panel.js +8 -32
  123. package/components/panel/panel.less +9 -9
  124. package/components/panel/resizable-panel.js +2 -4
  125. package/components/photo-browser/photo-browser-class.js +12 -47
  126. package/components/photo-browser/photo-browser-rtl.css +1 -1
  127. package/components/photo-browser/photo-browser-vars.less +8 -10
  128. package/components/photo-browser/photo-browser.css +1 -1
  129. package/components/photo-browser/photo-browser.d.ts +2 -4
  130. package/components/photo-browser/photo-browser.js +1 -3
  131. package/components/photo-browser/photo-browser.less +15 -71
  132. package/components/picker/picker-class.js +4 -5
  133. package/components/picker/picker-ios.less +6 -1
  134. package/components/picker/picker-md.less +9 -0
  135. package/components/picker/picker-rtl.css +1 -1
  136. package/components/picker/picker-vars.less +1 -1
  137. package/components/picker/picker.css +1 -1
  138. package/components/picker/picker.d.ts +1 -1
  139. package/components/picker/picker.js +2 -5
  140. package/components/picker/picker.less +0 -4
  141. package/components/pie-chart/pie-chart-class.js +7 -14
  142. package/components/popover/popover-class.js +22 -62
  143. package/components/popover/popover-ios.less +66 -2
  144. package/components/popover/popover-md.less +2 -27
  145. package/components/popover/popover-rtl.css +1 -1
  146. package/components/popover/popover-vars.less +2 -3
  147. package/components/popover/popover.css +1 -1
  148. package/components/popover/popover.d.ts +0 -2
  149. package/components/popover/popover.js +2 -9
  150. package/components/popover/popover.less +28 -50
  151. package/components/popup/popup-class.js +15 -9
  152. package/components/popup/popup-rtl.css +1 -1
  153. package/components/popup/popup-vars.less +2 -2
  154. package/components/popup/popup.css +1 -1
  155. package/components/popup/popup.js +2 -8
  156. package/components/popup/popup.less +6 -6
  157. package/components/preloader/preloader.js +2 -8
  158. package/components/progressbar/progressbar-md.less +12 -0
  159. package/components/progressbar/progressbar-rtl.css +1 -1
  160. package/components/progressbar/progressbar-vars.less +6 -5
  161. package/components/progressbar/progressbar.css +1 -1
  162. package/components/progressbar/progressbar.js +3 -12
  163. package/components/progressbar/progressbar.less +6 -0
  164. package/components/pull-to-refresh/pull-to-refresh-class.js +5 -12
  165. package/components/range/range-class.js +34 -27
  166. package/components/range/range-ios.less +60 -0
  167. package/components/range/range-md.less +67 -4
  168. package/components/range/range-rtl.css +1 -1
  169. package/components/range/range-vars.less +18 -13
  170. package/components/range/range.css +1 -1
  171. package/components/range/range.d.ts +3 -1
  172. package/components/range/range.js +2 -8
  173. package/components/range/range.less +11 -24
  174. package/components/searchbar/searchbar-class.js +7 -8
  175. package/components/searchbar/searchbar-ios.less +37 -13
  176. package/components/searchbar/searchbar-md.less +5 -0
  177. package/components/searchbar/searchbar-rtl.css +1 -1
  178. package/components/searchbar/searchbar-vars.less +13 -16
  179. package/components/searchbar/searchbar.css +1 -1
  180. package/components/searchbar/searchbar.js +4 -32
  181. package/components/searchbar/searchbar.less +4 -5
  182. package/components/sheet/sheet-class.js +21 -17
  183. package/components/sheet/sheet-ios.less +10 -0
  184. package/components/sheet/sheet-md.less +14 -0
  185. package/components/sheet/sheet-rtl.css +1 -1
  186. package/components/sheet/sheet-vars.less +5 -9
  187. package/components/sheet/sheet.css +1 -1
  188. package/components/sheet/sheet.js +2 -8
  189. package/components/sheet/sheet.less +5 -17
  190. package/components/skeleton/skeleton-rtl.css +1 -1
  191. package/components/skeleton/skeleton.css +1 -1
  192. package/components/smart-select/smart-select-class.js +15 -20
  193. package/components/smart-select/smart-select.d.ts +5 -7
  194. package/components/smart-select/smart-select.js +4 -4
  195. package/components/sortable/sortable.js +8 -27
  196. package/components/statusbar/statusbar.js +1 -4
  197. package/components/stepper/stepper-rtl.css +1 -1
  198. package/components/stepper/stepper-vars.less +3 -3
  199. package/components/stepper/stepper.css +1 -1
  200. package/components/stepper/stepper.js +2 -8
  201. package/components/subnavbar/subnavbar-ios.less +16 -1
  202. package/components/subnavbar/subnavbar-md.less +1 -1
  203. package/components/subnavbar/subnavbar-vars.less +12 -6
  204. package/components/subnavbar/subnavbar.less +5 -6
  205. package/components/swipeout/swipeout-ios.less +37 -0
  206. package/components/swipeout/swipeout-md.less +56 -0
  207. package/components/swipeout/swipeout-rtl.css +1 -1
  208. package/components/swipeout/swipeout-vars.less +13 -2
  209. package/components/swipeout/swipeout.css +1 -1
  210. package/components/swipeout/swipeout.js +102 -35
  211. package/components/swipeout/swipeout.less +20 -44
  212. package/components/swiper/swiper-rtl.css +1 -1
  213. package/components/swiper/swiper.css +1 -1
  214. package/components/tabs/tabs.js +3 -9
  215. package/components/text-editor/text-editor-class.js +1 -1
  216. package/components/text-editor/text-editor-rtl.css +1 -1
  217. package/components/text-editor/text-editor.css +1 -1
  218. package/components/timeline/timeline-ios.less +0 -5
  219. package/components/timeline/timeline-md.less +0 -5
  220. package/components/timeline/timeline-rtl.css +1 -1
  221. package/components/timeline/timeline-vars.less +1 -17
  222. package/components/timeline/timeline.css +1 -1
  223. package/components/timeline/timeline.less +0 -196
  224. package/components/toast/toast-class.js +2 -2
  225. package/components/toast/toast-ios.less +2 -0
  226. package/components/toast/toast-rtl.css +1 -1
  227. package/components/toast/toast-vars.less +2 -4
  228. package/components/toast/toast.css +1 -1
  229. package/components/toast/toast.less +1 -1
  230. package/components/toggle/toggle-class.js +5 -12
  231. package/components/toggle/toggle-ios.less +68 -50
  232. package/components/toggle/toggle-rtl.css +1 -1
  233. package/components/toggle/toggle-vars.less +2 -2
  234. package/components/toggle/toggle.css +1 -1
  235. package/components/toolbar/tabbar-highlight.js +134 -0
  236. package/components/toolbar/toolbar-ios.less +152 -14
  237. package/components/toolbar/toolbar-md.less +77 -3
  238. package/components/toolbar/toolbar-vars.less +14 -10
  239. package/components/toolbar/toolbar.js +32 -13
  240. package/components/toolbar/toolbar.less +8 -56
  241. package/components/tooltip/tooltip-class.js +13 -16
  242. package/components/tooltip/tooltip.js +0 -16
  243. package/components/touch-highlight/touch-highlight-ios.less +17 -0
  244. package/components/touch-highlight/touch-highlight-md.less +2 -0
  245. package/components/touch-highlight/touch-highlight-vars.less +8 -0
  246. package/components/touch-highlight/touch-highlight.d.ts +25 -0
  247. package/components/touch-highlight/touch-highlight.js +123 -0
  248. package/components/touch-highlight/touch-highlight.less +9 -0
  249. package/components/touch-ripple/touch-ripple.js +1 -4
  250. package/components/view/resizable-view.js +2 -4
  251. package/components/view/view-class.js +1 -15
  252. package/components/view/view.d.ts +0 -4
  253. package/components/view/view.js +1 -5
  254. package/components/virtual-list/virtual-list-class.js +2 -8
  255. package/framework7-bundle-rtl.css +2284 -3019
  256. package/framework7-bundle-rtl.min.css +9 -7
  257. package/framework7-bundle.css +2245 -2978
  258. package/framework7-bundle.esm.js +5 -4
  259. package/framework7-bundle.js +7170 -6469
  260. package/framework7-bundle.js.map +1 -1
  261. package/framework7-bundle.less +4 -3
  262. package/framework7-bundle.min.css +9 -7
  263. package/framework7-bundle.min.js +4 -4
  264. package/framework7-bundle.min.js.map +1 -1
  265. package/framework7-lite-bundle.esm.js +5 -4
  266. package/framework7-lite.esm.js +5 -4
  267. package/framework7-rtl.css +509 -844
  268. package/framework7-rtl.min.css +8 -6
  269. package/framework7-types.d.ts +5 -1
  270. package/framework7.css +509 -843
  271. package/framework7.d.ts +4 -0
  272. package/framework7.esm.js +5 -4
  273. package/framework7.less +4 -3
  274. package/framework7.min.css +8 -6
  275. package/less/mixins.less +10 -12
  276. package/modules/component/$h.js +1 -4
  277. package/modules/component/$jsx.js +1 -4
  278. package/modules/component/component-class.js +49 -114
  279. package/modules/component/component.js +6 -7
  280. package/modules/component/eventslisteners.js +1 -4
  281. package/modules/component/snabbdom/modules/hero.js +0 -1
  282. package/modules/component/snabbdom/modules/style.js +1 -1
  283. package/modules/component/vdom.js +17 -29
  284. package/modules/router/back.js +22 -96
  285. package/modules/router/clear-previous-history.js +1 -7
  286. package/modules/router/component-loader.js +23 -32
  287. package/modules/router/modal.js +1 -4
  288. package/modules/router/navigate.js +28 -167
  289. package/modules/router/redirect.js +1 -5
  290. package/modules/router/router-class.js +21 -288
  291. package/modules/router/swipe-back.js +10 -318
  292. package/modules/router/tab.js +1 -4
  293. package/modules/store/create-store.js +2 -8
  294. package/modules/touch/touch.d.ts +5 -3
  295. package/modules/touch/touch.js +22 -36
  296. package/package.json +4 -4
  297. package/shared/$jsx.js +1 -4
  298. package/shared/class.js +5 -26
  299. package/shared/constructor-methods.js +4 -19
  300. package/shared/events-class.js +3 -12
  301. package/shared/get-device.js +4 -11
  302. package/shared/get-support.d.ts +0 -6
  303. package/shared/get-support.js +1 -20
  304. package/shared/material-color-utils.js +2102 -693
  305. package/shared/material-colors.js +94 -23
  306. package/shared/modal-methods.js +2 -8
  307. package/shared/utils.js +23 -45
@@ -11,14 +11,11 @@ function clampInt(min, max, input) {
11
11
  function clampDouble(min, max, input) {
12
12
  return input < min ? min : input > max ? max : input;
13
13
  }
14
- function sanitizeDegreesDouble(degrees) {
14
+ function sanitizeDegreesInt(degrees) {
15
15
  return (degrees %= 360) < 0 && (degrees += 360), degrees;
16
16
  }
17
- function rotationDirection(from, to) {
18
- return sanitizeDegreesDouble(to - from) <= 180 ? 1 : -1;
19
- }
20
- function differenceDegrees(a, b) {
21
- return 180 - Math.abs(Math.abs(a - b) - 180);
17
+ function sanitizeDegreesDouble(degrees) {
18
+ return (degrees %= 360) < 0 && (degrees += 360), degrees;
22
19
  }
23
20
  function matrixMultiply(row, matrix) {
24
21
  return [row[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2], row[0] * matrix[1][0] + row[1] * matrix[1][1] + row[2] * matrix[1][2], row[0] * matrix[2][0] + row[1] * matrix[2][1] + row[2] * matrix[2][2]];
@@ -51,6 +48,20 @@ function argbFromXyz(x, y, z) {
51
48
  function xyzFromArgb(argb) {
52
49
  return matrixMultiply([linearized(redFromArgb(argb)), linearized(greenFromArgb(argb)), linearized(blueFromArgb(argb))], SRGB_TO_XYZ);
53
50
  }
51
+ function labFromArgb(argb) {
52
+ const linearR = linearized(redFromArgb(argb)),
53
+ linearG = linearized(greenFromArgb(argb)),
54
+ linearB = linearized(blueFromArgb(argb)),
55
+ matrix = SRGB_TO_XYZ,
56
+ x = matrix[0][0] * linearR + matrix[0][1] * linearG + matrix[0][2] * linearB,
57
+ y = matrix[1][0] * linearR + matrix[1][1] * linearG + matrix[1][2] * linearB,
58
+ z = matrix[2][0] * linearR + matrix[2][1] * linearG + matrix[2][2] * linearB,
59
+ yNormalized = y / WHITE_POINT_D65[1],
60
+ zNormalized = z / WHITE_POINT_D65[2],
61
+ fx = labF(x / WHITE_POINT_D65[0]),
62
+ fy = labF(yNormalized);
63
+ return [116 * fy - 16, 500 * (fx - fy), 200 * (fy - labF(zNormalized))];
64
+ }
54
65
  function argbFromLstar(lstar) {
55
66
  const component = delinearized(yFromLstar(lstar));
56
67
  return argbFromRgb(component, component, component);
@@ -84,22 +95,7 @@ function labInvf(ft) {
84
95
  return ft3 > 216 / 24389 ? ft3 : (116 * ft - 16) / 903.2962962962963;
85
96
  }
86
97
  class ViewingConditions {
87
- static make(whitePoint, adaptingLuminance, backgroundLstar, surround, discountingIlluminant) {
88
- if (whitePoint === void 0) {
89
- whitePoint = whitePointD65();
90
- }
91
- if (adaptingLuminance === void 0) {
92
- adaptingLuminance = 200 / Math.PI * yFromLstar(50) / 100;
93
- }
94
- if (backgroundLstar === void 0) {
95
- backgroundLstar = 50;
96
- }
97
- if (surround === void 0) {
98
- surround = 2;
99
- }
100
- if (discountingIlluminant === void 0) {
101
- discountingIlluminant = !1;
102
- }
98
+ static make(whitePoint = whitePointD65(), adaptingLuminance = 200 / Math.PI * yFromLstar(50) / 100, backgroundLstar = 50, surround = 2, discountingIlluminant = !1) {
103
99
  const xyz = whitePoint,
104
100
  rW = .401288 * xyz[0] + .650173 * xyz[1] + -.051461 * xyz[2],
105
101
  gW = -.250268 * xyz[0] + 1.204414 * xyz[1] + .045854 * xyz[2],
@@ -487,6 +483,21 @@ class Hct {
487
483
  set tone(newTone) {
488
484
  this.setInternalState(HctSolver.solveToInt(this.internalHue, this.internalChroma, newTone));
489
485
  }
486
+ setValue(propertyName, value) {
487
+ this[propertyName] = value;
488
+ }
489
+ toString() {
490
+ return `HCT(${this.hue.toFixed(0)}, ${this.chroma.toFixed(0)}, ${this.tone.toFixed(0)})`;
491
+ }
492
+ static isBlue(hue) {
493
+ return hue >= 250 && hue < 270;
494
+ }
495
+ static isYellow(hue) {
496
+ return hue >= 105 && hue < 125;
497
+ }
498
+ static isCyan(hue) {
499
+ return hue >= 170 && hue < 207;
500
+ }
490
501
  constructor(argb) {
491
502
  this.argb = argb;
492
503
  const cam = Cam16.fromInt(argb);
@@ -502,33 +513,6 @@ class Hct {
502
513
  return Hct.from(recastInVc.hue, recastInVc.chroma, lstarFromY(viewedInVc[1]));
503
514
  }
504
515
  }
505
- class Blend {
506
- static harmonize(designColor, sourceColor) {
507
- const fromHct = Hct.fromInt(designColor),
508
- toHct = Hct.fromInt(sourceColor),
509
- differenceDegrees$1 = differenceDegrees(fromHct.hue, toHct.hue),
510
- rotationDegrees = Math.min(.5 * differenceDegrees$1, 15),
511
- outputHue = sanitizeDegreesDouble(fromHct.hue + rotationDegrees * rotationDirection(fromHct.hue, toHct.hue));
512
- return Hct.from(outputHue, fromHct.chroma, fromHct.tone).toInt();
513
- }
514
- static hctHue(from, to, amount) {
515
- const ucs = Blend.cam16Ucs(from, to, amount),
516
- ucsCam = Cam16.fromInt(ucs),
517
- fromCam = Cam16.fromInt(from);
518
- return Hct.from(ucsCam.hue, fromCam.chroma, lstarFromArgb(from)).toInt();
519
- }
520
- static cam16Ucs(from, to, amount) {
521
- const fromCam = Cam16.fromInt(from),
522
- toCam = Cam16.fromInt(to),
523
- fromJ = fromCam.jstar,
524
- fromA = fromCam.astar,
525
- fromB = fromCam.bstar,
526
- jstar = fromJ + (toCam.jstar - fromJ) * amount,
527
- astar = fromA + (toCam.astar - fromA) * amount,
528
- bstar = fromB + (toCam.bstar - fromB) * amount;
529
- return Cam16.fromUcs(jstar, astar, bstar).toInt();
530
- }
531
- }
532
516
  class Contrast {
533
517
  static ratioOfTones(toneA, toneB) {
534
518
  return toneA = clampDouble(0, 100, toneA), toneB = clampDouble(0, 100, toneB), Contrast.ratioOfYs(yFromLstar(toneA), yFromLstar(toneB));
@@ -577,66 +561,77 @@ class DislikeAnalyzer {
577
561
  return DislikeAnalyzer.isDisliked(hct) ? Hct.from(hct.hue, hct.chroma, 70) : hct;
578
562
  }
579
563
  }
564
+ function validateExtendedColor(originalColor, specVersion, extendedColor) {
565
+ if (originalColor.name !== extendedColor.name) throw new Error(`Attempting to extend color ${originalColor.name} with color ${extendedColor.name} of different name for spec version ${specVersion}.`);
566
+ if (originalColor.isBackground !== extendedColor.isBackground) throw new Error(`Attempting to extend color ${originalColor.name} as a ${originalColor.isBackground ? "background" : "foreground"} with color ${extendedColor.name} as a ${extendedColor.isBackground ? "background" : "foreground"} for spec version ${specVersion}.`);
567
+ }
568
+ function extendSpecVersion(originlColor, specVersion, extendedColor) {
569
+ return validateExtendedColor(originlColor, specVersion, extendedColor), DynamicColor.fromPalette({
570
+ name: originlColor.name,
571
+ palette: s => s.specVersion === specVersion ? extendedColor.palette(s) : originlColor.palette(s),
572
+ tone: s => s.specVersion === specVersion ? extendedColor.tone(s) : originlColor.tone(s),
573
+ isBackground: originlColor.isBackground,
574
+ chromaMultiplier: s => {
575
+ const chromaMultiplier = s.specVersion === specVersion ? extendedColor.chromaMultiplier : originlColor.chromaMultiplier;
576
+ return void 0 !== chromaMultiplier ? chromaMultiplier(s) : 1;
577
+ },
578
+ background: s => {
579
+ const background = s.specVersion === specVersion ? extendedColor.background : originlColor.background;
580
+ return void 0 !== background ? background(s) : void 0;
581
+ },
582
+ secondBackground: s => {
583
+ const secondBackground = s.specVersion === specVersion ? extendedColor.secondBackground : originlColor.secondBackground;
584
+ return void 0 !== secondBackground ? secondBackground(s) : void 0;
585
+ },
586
+ contrastCurve: s => {
587
+ const contrastCurve = s.specVersion === specVersion ? extendedColor.contrastCurve : originlColor.contrastCurve;
588
+ return void 0 !== contrastCurve ? contrastCurve(s) : void 0;
589
+ },
590
+ toneDeltaPair: s => {
591
+ const toneDeltaPair = s.specVersion === specVersion ? extendedColor.toneDeltaPair : originlColor.toneDeltaPair;
592
+ return void 0 !== toneDeltaPair ? toneDeltaPair(s) : void 0;
593
+ }
594
+ });
595
+ }
580
596
  class DynamicColor {
581
597
  static fromPalette(args) {
582
- return new DynamicColor(args.name ?? "", args.palette, args.tone, args.isBackground ?? !1, args.background, args.secondBackground, args.contrastCurve, args.toneDeltaPair);
598
+ return new DynamicColor(args.name ?? "", args.palette, args.tone ?? DynamicColor.getInitialToneFromBackground(args.background), args.isBackground ?? !1, args.chromaMultiplier, args.background, args.secondBackground, args.contrastCurve, args.toneDeltaPair);
583
599
  }
584
- constructor(name, palette, tone, isBackground, background, secondBackground, contrastCurve, toneDeltaPair) {
585
- if (this.name = name, this.palette = palette, this.tone = tone, this.isBackground = isBackground, this.background = background, this.secondBackground = secondBackground, this.contrastCurve = contrastCurve, this.toneDeltaPair = toneDeltaPair, this.hctCache = new Map(), !background && secondBackground) throw new Error(`Color ${name} has secondBackgrounddefined, but background is not defined.`);
600
+ static getInitialToneFromBackground(background) {
601
+ return void 0 === background ? s => 50 : s => background(s) ? background(s).getTone(s) : 50;
602
+ }
603
+ constructor(name, palette, tone, isBackground, chromaMultiplier, background, secondBackground, contrastCurve, toneDeltaPair) {
604
+ if (this.name = name, this.palette = palette, this.tone = tone, this.isBackground = isBackground, this.chromaMultiplier = chromaMultiplier, this.background = background, this.secondBackground = secondBackground, this.contrastCurve = contrastCurve, this.toneDeltaPair = toneDeltaPair, this.hctCache = new Map(), !background && secondBackground) throw new Error(`Color ${name} has secondBackgrounddefined, but background is not defined.`);
586
605
  if (!background && contrastCurve) throw new Error(`Color ${name} has contrastCurvedefined, but background is not defined.`);
587
606
  if (background && !contrastCurve) throw new Error(`Color ${name} has backgrounddefined, but contrastCurve is not defined.`);
588
607
  }
608
+ clone() {
609
+ return DynamicColor.fromPalette({
610
+ name: this.name,
611
+ palette: this.palette,
612
+ tone: this.tone,
613
+ isBackground: this.isBackground,
614
+ chromaMultiplier: this.chromaMultiplier,
615
+ background: this.background,
616
+ secondBackground: this.secondBackground,
617
+ contrastCurve: this.contrastCurve,
618
+ toneDeltaPair: this.toneDeltaPair
619
+ });
620
+ }
621
+ clearCache() {
622
+ this.hctCache.clear();
623
+ }
589
624
  getArgb(scheme) {
590
625
  return this.getHct(scheme).toInt();
591
626
  }
592
627
  getHct(scheme) {
593
628
  const cachedAnswer = this.hctCache.get(scheme);
594
629
  if (null != cachedAnswer) return cachedAnswer;
595
- const tone = this.getTone(scheme),
596
- answer = this.palette(scheme).getHct(tone);
630
+ const answer = getSpec$1(scheme.specVersion).getHct(scheme, this);
597
631
  return this.hctCache.size > 4 && this.hctCache.clear(), this.hctCache.set(scheme, answer), answer;
598
632
  }
599
633
  getTone(scheme) {
600
- const decreasingContrast = scheme.contrastLevel < 0;
601
- if (this.toneDeltaPair) {
602
- const toneDeltaPair = this.toneDeltaPair(scheme),
603
- roleA = toneDeltaPair.roleA,
604
- roleB = toneDeltaPair.roleB,
605
- delta = toneDeltaPair.delta,
606
- polarity = toneDeltaPair.polarity,
607
- stayTogether = toneDeltaPair.stayTogether,
608
- bgTone = this.background(scheme).getTone(scheme),
609
- aIsNearer = "nearer" === polarity || "lighter" === polarity && !scheme.isDark || "darker" === polarity && scheme.isDark,
610
- nearer = aIsNearer ? roleA : roleB,
611
- farther = aIsNearer ? roleB : roleA,
612
- amNearer = this.name === nearer.name,
613
- expansionDir = scheme.isDark ? 1 : -1,
614
- nContrast = nearer.contrastCurve.getContrast(scheme.contrastLevel),
615
- fContrast = farther.contrastCurve.getContrast(scheme.contrastLevel),
616
- nInitialTone = nearer.tone(scheme);
617
- let nTone = Contrast.ratioOfTones(bgTone, nInitialTone) >= nContrast ? nInitialTone : DynamicColor.foregroundTone(bgTone, nContrast);
618
- const fInitialTone = farther.tone(scheme);
619
- let fTone = Contrast.ratioOfTones(bgTone, fInitialTone) >= fContrast ? fInitialTone : DynamicColor.foregroundTone(bgTone, fContrast);
620
- return decreasingContrast && (nTone = DynamicColor.foregroundTone(bgTone, nContrast), fTone = DynamicColor.foregroundTone(bgTone, fContrast)), (fTone - nTone) * expansionDir >= delta || (fTone = clampDouble(0, 100, nTone + delta * expansionDir), (fTone - nTone) * expansionDir >= delta || (nTone = clampDouble(0, 100, fTone - delta * expansionDir))), 50 <= nTone && nTone < 60 ? expansionDir > 0 ? (nTone = 60, fTone = Math.max(fTone, nTone + delta * expansionDir)) : (nTone = 49, fTone = Math.min(fTone, nTone + delta * expansionDir)) : 50 <= fTone && fTone < 60 && (stayTogether ? expansionDir > 0 ? (nTone = 60, fTone = Math.max(fTone, nTone + delta * expansionDir)) : (nTone = 49, fTone = Math.min(fTone, nTone + delta * expansionDir)) : fTone = expansionDir > 0 ? 60 : 49), amNearer ? nTone : fTone;
621
- }
622
- {
623
- let answer = this.tone(scheme);
624
- if (null == this.background) return answer;
625
- const bgTone = this.background(scheme).getTone(scheme),
626
- desiredRatio = this.contrastCurve.getContrast(scheme.contrastLevel);
627
- if (Contrast.ratioOfTones(bgTone, answer) >= desiredRatio || (answer = DynamicColor.foregroundTone(bgTone, desiredRatio)), decreasingContrast && (answer = DynamicColor.foregroundTone(bgTone, desiredRatio)), this.isBackground && 50 <= answer && answer < 60 && (answer = Contrast.ratioOfTones(49, bgTone) >= desiredRatio ? 49 : 60), this.secondBackground) {
628
- const [bg1, bg2] = [this.background, this.secondBackground],
629
- [bgTone1, bgTone2] = [bg1(scheme).getTone(scheme), bg2(scheme).getTone(scheme)],
630
- [upper, lower] = [Math.max(bgTone1, bgTone2), Math.min(bgTone1, bgTone2)];
631
- if (Contrast.ratioOfTones(upper, answer) >= desiredRatio && Contrast.ratioOfTones(lower, answer) >= desiredRatio) return answer;
632
- const lightOption = Contrast.lighter(upper, desiredRatio),
633
- darkOption = Contrast.darker(lower, desiredRatio),
634
- availables = [];
635
- -1 !== lightOption && availables.push(lightOption), -1 !== darkOption && availables.push(darkOption);
636
- return DynamicColor.tonePrefersLightForeground(bgTone1) || DynamicColor.tonePrefersLightForeground(bgTone2) ? lightOption < 0 ? 100 : lightOption : 1 === availables.length ? availables[0] : darkOption < 0 ? 0 : darkOption;
637
- }
638
- return answer;
639
- }
634
+ return getSpec$1(scheme.specVersion).getTone(scheme, this);
640
635
  }
641
636
  static foregroundTone(bgTone, ratio) {
642
637
  const lighterTone = Contrast.lighterUnsafe(bgTone, ratio),
@@ -659,23 +654,303 @@ class DynamicColor {
659
654
  return DynamicColor.tonePrefersLightForeground(tone) && !DynamicColor.toneAllowsLightForeground(tone) ? 49 : tone;
660
655
  }
661
656
  }
662
- var Variant;
663
- !function (Variant) {
664
- Variant[Variant.MONOCHROME = 0] = "MONOCHROME", Variant[Variant.NEUTRAL = 1] = "NEUTRAL", Variant[Variant.TONAL_SPOT = 2] = "TONAL_SPOT", Variant[Variant.VIBRANT = 3] = "VIBRANT", Variant[Variant.EXPRESSIVE = 4] = "EXPRESSIVE", Variant[Variant.FIDELITY = 5] = "FIDELITY", Variant[Variant.CONTENT = 6] = "CONTENT", Variant[Variant.RAINBOW = 7] = "RAINBOW", Variant[Variant.FRUIT_SALAD = 8] = "FRUIT_SALAD";
665
- }(Variant || (Variant = {}));
657
+ class ColorCalculationDelegateImpl2021 {
658
+ getHct(scheme, color) {
659
+ const tone = color.getTone(scheme);
660
+ return color.palette(scheme).getHct(tone);
661
+ }
662
+ getTone(scheme, color) {
663
+ const decreasingContrast = scheme.contrastLevel < 0,
664
+ toneDeltaPair = color.toneDeltaPair ? color.toneDeltaPair(scheme) : void 0;
665
+ if (toneDeltaPair) {
666
+ const roleA = toneDeltaPair.roleA,
667
+ roleB = toneDeltaPair.roleB,
668
+ delta = toneDeltaPair.delta,
669
+ polarity = toneDeltaPair.polarity,
670
+ stayTogether = toneDeltaPair.stayTogether,
671
+ aIsNearer = "nearer" === polarity || "lighter" === polarity && !scheme.isDark || "darker" === polarity && scheme.isDark,
672
+ nearer = aIsNearer ? roleA : roleB,
673
+ farther = aIsNearer ? roleB : roleA,
674
+ amNearer = color.name === nearer.name,
675
+ expansionDir = scheme.isDark ? 1 : -1;
676
+ let nTone = nearer.tone(scheme),
677
+ fTone = farther.tone(scheme);
678
+ if (color.background && nearer.contrastCurve && farther.contrastCurve) {
679
+ const bg = color.background(scheme),
680
+ nContrastCurve = nearer.contrastCurve(scheme),
681
+ fContrastCurve = farther.contrastCurve(scheme);
682
+ if (bg && nContrastCurve && fContrastCurve) {
683
+ const bgTone = bg.getTone(scheme),
684
+ nContrast = nContrastCurve.get(scheme.contrastLevel),
685
+ fContrast = fContrastCurve.get(scheme.contrastLevel);
686
+ Contrast.ratioOfTones(bgTone, nTone) < nContrast && (nTone = DynamicColor.foregroundTone(bgTone, nContrast)), Contrast.ratioOfTones(bgTone, fTone) < fContrast && (fTone = DynamicColor.foregroundTone(bgTone, fContrast)), decreasingContrast && (nTone = DynamicColor.foregroundTone(bgTone, nContrast), fTone = DynamicColor.foregroundTone(bgTone, fContrast));
687
+ }
688
+ }
689
+ return (fTone - nTone) * expansionDir < delta && (fTone = clampDouble(0, 100, nTone + delta * expansionDir), (fTone - nTone) * expansionDir >= delta || (nTone = clampDouble(0, 100, fTone - delta * expansionDir))), 50 <= nTone && nTone < 60 ? expansionDir > 0 ? (nTone = 60, fTone = Math.max(fTone, nTone + delta * expansionDir)) : (nTone = 49, fTone = Math.min(fTone, nTone + delta * expansionDir)) : 50 <= fTone && fTone < 60 && (stayTogether ? expansionDir > 0 ? (nTone = 60, fTone = Math.max(fTone, nTone + delta * expansionDir)) : (nTone = 49, fTone = Math.min(fTone, nTone + delta * expansionDir)) : fTone = expansionDir > 0 ? 60 : 49), amNearer ? nTone : fTone;
690
+ }
691
+ {
692
+ let answer = color.tone(scheme);
693
+ if (null == color.background || void 0 === color.background(scheme) || null == color.contrastCurve || void 0 === color.contrastCurve(scheme)) return answer;
694
+ const bgTone = color.background(scheme).getTone(scheme),
695
+ desiredRatio = color.contrastCurve(scheme).get(scheme.contrastLevel);
696
+ if (Contrast.ratioOfTones(bgTone, answer) >= desiredRatio || (answer = DynamicColor.foregroundTone(bgTone, desiredRatio)), decreasingContrast && (answer = DynamicColor.foregroundTone(bgTone, desiredRatio)), color.isBackground && 50 <= answer && answer < 60 && (answer = Contrast.ratioOfTones(49, bgTone) >= desiredRatio ? 49 : 60), null == color.secondBackground || void 0 === color.secondBackground(scheme)) return answer;
697
+ const [bg1, bg2] = [color.background, color.secondBackground],
698
+ [bgTone1, bgTone2] = [bg1(scheme).getTone(scheme), bg2(scheme).getTone(scheme)],
699
+ [upper, lower] = [Math.max(bgTone1, bgTone2), Math.min(bgTone1, bgTone2)];
700
+ if (Contrast.ratioOfTones(upper, answer) >= desiredRatio && Contrast.ratioOfTones(lower, answer) >= desiredRatio) return answer;
701
+ const lightOption = Contrast.lighter(upper, desiredRatio),
702
+ darkOption = Contrast.darker(lower, desiredRatio),
703
+ availables = [];
704
+ -1 !== lightOption && availables.push(lightOption), -1 !== darkOption && availables.push(darkOption);
705
+ return DynamicColor.tonePrefersLightForeground(bgTone1) || DynamicColor.tonePrefersLightForeground(bgTone2) ? lightOption < 0 ? 100 : lightOption : 1 === availables.length ? availables[0] : darkOption < 0 ? 0 : darkOption;
706
+ }
707
+ }
708
+ }
709
+ class ColorCalculationDelegateImpl2025 {
710
+ getHct(scheme, color) {
711
+ const palette = color.palette(scheme),
712
+ tone = color.getTone(scheme),
713
+ hue = palette.hue,
714
+ chroma = palette.chroma * (color.chromaMultiplier ? color.chromaMultiplier(scheme) : 1);
715
+ return Hct.from(hue, chroma, tone);
716
+ }
717
+ getTone(scheme, color) {
718
+ const toneDeltaPair = color.toneDeltaPair ? color.toneDeltaPair(scheme) : void 0;
719
+ if (toneDeltaPair) {
720
+ const roleA = toneDeltaPair.roleA,
721
+ roleB = toneDeltaPair.roleB,
722
+ polarity = toneDeltaPair.polarity,
723
+ constraint = toneDeltaPair.constraint,
724
+ absoluteDelta = "darker" === polarity || "relative_lighter" === polarity && scheme.isDark || "relative_darker" === polarity && !scheme.isDark ? -toneDeltaPair.delta : toneDeltaPair.delta,
725
+ amRoleA = color.name === roleA.name,
726
+ refRole = amRoleA ? roleB : roleA;
727
+ let selfTone = (amRoleA ? roleA : roleB).tone(scheme),
728
+ refTone = refRole.getTone(scheme);
729
+ const relativeDelta = absoluteDelta * (amRoleA ? 1 : -1);
730
+ if ("exact" === constraint ? selfTone = clampDouble(0, 100, refTone + relativeDelta) : "nearer" === constraint ? selfTone = clampDouble(0, 100, relativeDelta > 0 ? clampDouble(refTone, refTone + relativeDelta, selfTone) : clampDouble(refTone + relativeDelta, refTone, selfTone)) : "farther" === constraint && (selfTone = relativeDelta > 0 ? clampDouble(refTone + relativeDelta, 100, selfTone) : clampDouble(0, refTone + relativeDelta, selfTone)), color.background && color.contrastCurve) {
731
+ const background = color.background(scheme),
732
+ contrastCurve = color.contrastCurve(scheme);
733
+ if (background && contrastCurve) {
734
+ const bgTone = background.getTone(scheme),
735
+ selfContrast = contrastCurve.get(scheme.contrastLevel);
736
+ selfTone = Contrast.ratioOfTones(bgTone, selfTone) >= selfContrast && scheme.contrastLevel >= 0 ? selfTone : DynamicColor.foregroundTone(bgTone, selfContrast);
737
+ }
738
+ }
739
+ return color.isBackground && !color.name.endsWith("_fixed_dim") && (selfTone = selfTone >= 57 ? clampDouble(65, 100, selfTone) : clampDouble(0, 49, selfTone)), selfTone;
740
+ }
741
+ {
742
+ let answer = color.tone(scheme);
743
+ if (null == color.background || void 0 === color.background(scheme) || null == color.contrastCurve || void 0 === color.contrastCurve(scheme)) return answer;
744
+ const bgTone = color.background(scheme).getTone(scheme),
745
+ desiredRatio = color.contrastCurve(scheme).get(scheme.contrastLevel);
746
+ if (answer = Contrast.ratioOfTones(bgTone, answer) >= desiredRatio && scheme.contrastLevel >= 0 ? answer : DynamicColor.foregroundTone(bgTone, desiredRatio), color.isBackground && !color.name.endsWith("_fixed_dim") && (answer = answer >= 57 ? clampDouble(65, 100, answer) : clampDouble(0, 49, answer)), null == color.secondBackground || void 0 === color.secondBackground(scheme)) return answer;
747
+ const [bg1, bg2] = [color.background, color.secondBackground],
748
+ [bgTone1, bgTone2] = [bg1(scheme).getTone(scheme), bg2(scheme).getTone(scheme)],
749
+ [upper, lower] = [Math.max(bgTone1, bgTone2), Math.min(bgTone1, bgTone2)];
750
+ if (Contrast.ratioOfTones(upper, answer) >= desiredRatio && Contrast.ratioOfTones(lower, answer) >= desiredRatio) return answer;
751
+ const lightOption = Contrast.lighter(upper, desiredRatio),
752
+ darkOption = Contrast.darker(lower, desiredRatio),
753
+ availables = [];
754
+ -1 !== lightOption && availables.push(lightOption), -1 !== darkOption && availables.push(darkOption);
755
+ return DynamicColor.tonePrefersLightForeground(bgTone1) || DynamicColor.tonePrefersLightForeground(bgTone2) ? lightOption < 0 ? 100 : lightOption : 1 === availables.length ? availables[0] : darkOption < 0 ? 0 : darkOption;
756
+ }
757
+ }
758
+ }
759
+ const spec2021$1 = new ColorCalculationDelegateImpl2021(),
760
+ spec2025$1 = new ColorCalculationDelegateImpl2025();
761
+ function getSpec$1(specVersion) {
762
+ return "2025" === specVersion ? spec2025$1 : spec2021$1;
763
+ }
764
+ class TonalPalette {
765
+ static fromInt(argb) {
766
+ const hct = Hct.fromInt(argb);
767
+ return TonalPalette.fromHct(hct);
768
+ }
769
+ static fromHct(hct) {
770
+ return new TonalPalette(hct.hue, hct.chroma, hct);
771
+ }
772
+ static fromHueAndChroma(hue, chroma) {
773
+ const keyColor = new KeyColor(hue, chroma).create();
774
+ return new TonalPalette(hue, chroma, keyColor);
775
+ }
776
+ constructor(hue, chroma, keyColor) {
777
+ this.hue = hue, this.chroma = chroma, this.keyColor = keyColor, this.cache = new Map();
778
+ }
779
+ tone(tone) {
780
+ let argb = this.cache.get(tone);
781
+ return void 0 === argb && (argb = 99 == tone && Hct.isYellow(this.hue) ? this.averageArgb(this.tone(98), this.tone(100)) : Hct.from(this.hue, this.chroma, tone).toInt(), this.cache.set(tone, argb)), argb;
782
+ }
783
+ getHct(tone) {
784
+ return Hct.fromInt(this.tone(tone));
785
+ }
786
+ averageArgb(argb1, argb2) {
787
+ const red1 = argb1 >>> 16 & 255,
788
+ green1 = argb1 >>> 8 & 255,
789
+ blue1 = 255 & argb1,
790
+ red2 = argb2 >>> 16 & 255,
791
+ green2 = argb2 >>> 8 & 255,
792
+ blue2 = 255 & argb2;
793
+ return (255 << 24 | (255 & Math.round((red1 + red2) / 2)) << 16 | (255 & Math.round((green1 + green2) / 2)) << 8 | 255 & Math.round((blue1 + blue2) / 2)) >>> 0;
794
+ }
795
+ }
796
+ class KeyColor {
797
+ constructor(hue, requestedChroma) {
798
+ this.hue = hue, this.requestedChroma = requestedChroma, this.chromaCache = new Map(), this.maxChromaValue = 200;
799
+ }
800
+ create() {
801
+ let lowerTone = 0,
802
+ upperTone = 100;
803
+ for (; lowerTone < upperTone;) {
804
+ const midTone = Math.floor((lowerTone + upperTone) / 2),
805
+ isAscending = this.maxChroma(midTone) < this.maxChroma(midTone + 1);
806
+ if (this.maxChroma(midTone) >= this.requestedChroma - .01) {
807
+ if (Math.abs(lowerTone - 50) < Math.abs(upperTone - 50)) upperTone = midTone;else {
808
+ if (lowerTone === midTone) return Hct.from(this.hue, this.requestedChroma, lowerTone);
809
+ lowerTone = midTone;
810
+ }
811
+ } else isAscending ? lowerTone = midTone + 1 : upperTone = midTone;
812
+ }
813
+ return Hct.from(this.hue, this.requestedChroma, lowerTone);
814
+ }
815
+ maxChroma(tone) {
816
+ if (this.chromaCache.has(tone)) return this.chromaCache.get(tone);
817
+ const chroma = Hct.from(this.hue, this.maxChromaValue, tone).chroma;
818
+ return this.chromaCache.set(tone, chroma), chroma;
819
+ }
820
+ }
821
+ class TemperatureCache {
822
+ constructor(input) {
823
+ this.input = input, this.hctsByTempCache = [], this.hctsByHueCache = [], this.tempsByHctCache = new Map(), this.inputRelativeTemperatureCache = -1, this.complementCache = null;
824
+ }
825
+ get hctsByTemp() {
826
+ if (this.hctsByTempCache.length > 0) return this.hctsByTempCache;
827
+ const hcts = this.hctsByHue.concat([this.input]),
828
+ temperaturesByHct = this.tempsByHct;
829
+ return hcts.sort((a, b) => temperaturesByHct.get(a) - temperaturesByHct.get(b)), this.hctsByTempCache = hcts, hcts;
830
+ }
831
+ get warmest() {
832
+ return this.hctsByTemp[this.hctsByTemp.length - 1];
833
+ }
834
+ get coldest() {
835
+ return this.hctsByTemp[0];
836
+ }
837
+ analogous(count = 5, divisions = 12) {
838
+ const startHue = Math.round(this.input.hue),
839
+ startHct = this.hctsByHue[startHue];
840
+ let lastTemp = this.relativeTemperature(startHct);
841
+ const allColors = [startHct];
842
+ let absoluteTotalTempDelta = 0;
843
+ for (let i = 0; i < 360; i++) {
844
+ const hue = sanitizeDegreesInt(startHue + i),
845
+ hct = this.hctsByHue[hue],
846
+ temp = this.relativeTemperature(hct),
847
+ tempDelta = Math.abs(temp - lastTemp);
848
+ lastTemp = temp, absoluteTotalTempDelta += tempDelta;
849
+ }
850
+ let hueAddend = 1;
851
+ const tempStep = absoluteTotalTempDelta / divisions;
852
+ let totalTempDelta = 0;
853
+ for (lastTemp = this.relativeTemperature(startHct); allColors.length < divisions;) {
854
+ const hue = sanitizeDegreesInt(startHue + hueAddend),
855
+ hct = this.hctsByHue[hue],
856
+ temp = this.relativeTemperature(hct);
857
+ totalTempDelta += Math.abs(temp - lastTemp);
858
+ let indexSatisfied = totalTempDelta >= allColors.length * tempStep,
859
+ indexAddend = 1;
860
+ for (; indexSatisfied && allColors.length < divisions;) {
861
+ allColors.push(hct);
862
+ indexSatisfied = totalTempDelta >= (allColors.length + indexAddend) * tempStep, indexAddend++;
863
+ }
864
+ if (lastTemp = temp, hueAddend++, hueAddend > 360) {
865
+ for (; allColors.length < divisions;) allColors.push(hct);
866
+ break;
867
+ }
868
+ }
869
+ const answers = [this.input],
870
+ increaseHueCount = Math.floor((count - 1) / 2);
871
+ for (let i = 1; i < increaseHueCount + 1; i++) {
872
+ let index = 0 - i;
873
+ for (; index < 0;) index = allColors.length + index;
874
+ index >= allColors.length && (index %= allColors.length), answers.splice(0, 0, allColors[index]);
875
+ }
876
+ const decreaseHueCount = count - increaseHueCount - 1;
877
+ for (let i = 1; i < decreaseHueCount + 1; i++) {
878
+ let index = i;
879
+ for (; index < 0;) index = allColors.length + index;
880
+ index >= allColors.length && (index %= allColors.length), answers.push(allColors[index]);
881
+ }
882
+ return answers;
883
+ }
884
+ get complement() {
885
+ if (null != this.complementCache) return this.complementCache;
886
+ const coldestHue = this.coldest.hue,
887
+ coldestTemp = this.tempsByHct.get(this.coldest),
888
+ warmestHue = this.warmest.hue,
889
+ range = this.tempsByHct.get(this.warmest) - coldestTemp,
890
+ startHueIsColdestToWarmest = TemperatureCache.isBetween(this.input.hue, coldestHue, warmestHue),
891
+ startHue = startHueIsColdestToWarmest ? warmestHue : coldestHue,
892
+ endHue = startHueIsColdestToWarmest ? coldestHue : warmestHue;
893
+ let smallestError = 1e3,
894
+ answer = this.hctsByHue[Math.round(this.input.hue)];
895
+ const complementRelativeTemp = 1 - this.inputRelativeTemperature;
896
+ for (let hueAddend = 0; hueAddend <= 360; hueAddend += 1) {
897
+ const hue = sanitizeDegreesDouble(startHue + 1 * hueAddend);
898
+ if (!TemperatureCache.isBetween(hue, startHue, endHue)) continue;
899
+ const possibleAnswer = this.hctsByHue[Math.round(hue)],
900
+ relativeTemp = (this.tempsByHct.get(possibleAnswer) - coldestTemp) / range,
901
+ error = Math.abs(complementRelativeTemp - relativeTemp);
902
+ error < smallestError && (smallestError = error, answer = possibleAnswer);
903
+ }
904
+ return this.complementCache = answer, this.complementCache;
905
+ }
906
+ relativeTemperature(hct) {
907
+ const range = this.tempsByHct.get(this.warmest) - this.tempsByHct.get(this.coldest),
908
+ differenceFromColdest = this.tempsByHct.get(hct) - this.tempsByHct.get(this.coldest);
909
+ return 0 === range ? .5 : differenceFromColdest / range;
910
+ }
911
+ get inputRelativeTemperature() {
912
+ return this.inputRelativeTemperatureCache >= 0 || (this.inputRelativeTemperatureCache = this.relativeTemperature(this.input)), this.inputRelativeTemperatureCache;
913
+ }
914
+ get tempsByHct() {
915
+ if (this.tempsByHctCache.size > 0) return this.tempsByHctCache;
916
+ const allHcts = this.hctsByHue.concat([this.input]),
917
+ temperaturesByHct = new Map();
918
+ for (const e of allHcts) temperaturesByHct.set(e, TemperatureCache.rawTemperature(e));
919
+ return this.tempsByHctCache = temperaturesByHct, temperaturesByHct;
920
+ }
921
+ get hctsByHue() {
922
+ if (this.hctsByHueCache.length > 0) return this.hctsByHueCache;
923
+ const hcts = [];
924
+ for (let hue = 0; hue <= 360; hue += 1) {
925
+ const colorAtHue = Hct.from(hue, this.input.chroma, this.input.tone);
926
+ hcts.push(colorAtHue);
927
+ }
928
+ return this.hctsByHueCache = hcts, this.hctsByHueCache;
929
+ }
930
+ static isBetween(angle, a, b) {
931
+ return a < b ? a <= angle && angle <= b : a <= angle || angle <= b;
932
+ }
933
+ static rawTemperature(color) {
934
+ const lab = labFromArgb(color.toInt()),
935
+ hue = sanitizeDegreesDouble(180 * Math.atan2(lab[2], lab[1]) / Math.PI),
936
+ chroma = Math.sqrt(lab[1] * lab[1] + lab[2] * lab[2]);
937
+ return .02 * Math.pow(chroma, 1.07) * Math.cos(sanitizeDegreesDouble(hue - 50) * Math.PI / 180) - .5;
938
+ }
939
+ }
666
940
  class ContrastCurve {
667
941
  constructor(low, normal, medium, high) {
668
942
  this.low = low, this.normal = normal, this.medium = medium, this.high = high;
669
943
  }
670
- getContrast(contrastLevel) {
944
+ get(contrastLevel) {
671
945
  return contrastLevel <= -1 ? this.low : contrastLevel < 0 ? lerp(this.low, this.normal, (contrastLevel - -1) / 1) : contrastLevel < .5 ? lerp(this.normal, this.medium, (contrastLevel - 0) / .5) : contrastLevel < 1 ? lerp(this.medium, this.high, (contrastLevel - .5) / .5) : this.high;
672
946
  }
673
947
  }
674
948
  class ToneDeltaPair {
675
- constructor(roleA, roleB, delta, polarity, stayTogether) {
676
- this.roleA = roleA, this.roleB = roleB, this.delta = delta, this.polarity = polarity, this.stayTogether = stayTogether;
949
+ constructor(roleA, roleB, delta, polarity, stayTogether, constraint) {
950
+ this.roleA = roleA, this.roleB = roleB, this.delta = delta, this.polarity = polarity, this.stayTogether = stayTogether, this.constraint = constraint, this.constraint = constraint ?? "exact";
677
951
  }
678
952
  }
953
+ var Variant;
679
954
  function isFidelity(scheme) {
680
955
  return scheme.variant === Variant.FIDELITY || scheme.variant === Variant.CONTENT;
681
956
  }
@@ -697,615 +972,1794 @@ function findDesiredChromaByTone(hue, chroma, tone, byDecreasingTone) {
697
972
  }
698
973
  return answer;
699
974
  }
700
- function viewingConditionsForAlbers(scheme) {
701
- return ViewingConditions.make(void 0, void 0, scheme.isDark ? 30 : 80, void 0, void 0);
975
+ !function (Variant) {
976
+ Variant[Variant.MONOCHROME = 0] = "MONOCHROME", Variant[Variant.NEUTRAL = 1] = "NEUTRAL", Variant[Variant.TONAL_SPOT = 2] = "TONAL_SPOT", Variant[Variant.VIBRANT = 3] = "VIBRANT", Variant[Variant.EXPRESSIVE = 4] = "EXPRESSIVE", Variant[Variant.FIDELITY = 5] = "FIDELITY", Variant[Variant.CONTENT = 6] = "CONTENT", Variant[Variant.RAINBOW = 7] = "RAINBOW", Variant[Variant.FRUIT_SALAD = 8] = "FRUIT_SALAD";
977
+ }(Variant || (Variant = {}));
978
+ class ColorSpecDelegateImpl2021 {
979
+ primaryPaletteKeyColor() {
980
+ return DynamicColor.fromPalette({
981
+ name: "primary_palette_key_color",
982
+ palette: s => s.primaryPalette,
983
+ tone: s => s.primaryPalette.keyColor.tone
984
+ });
985
+ }
986
+ secondaryPaletteKeyColor() {
987
+ return DynamicColor.fromPalette({
988
+ name: "secondary_palette_key_color",
989
+ palette: s => s.secondaryPalette,
990
+ tone: s => s.secondaryPalette.keyColor.tone
991
+ });
992
+ }
993
+ tertiaryPaletteKeyColor() {
994
+ return DynamicColor.fromPalette({
995
+ name: "tertiary_palette_key_color",
996
+ palette: s => s.tertiaryPalette,
997
+ tone: s => s.tertiaryPalette.keyColor.tone
998
+ });
999
+ }
1000
+ neutralPaletteKeyColor() {
1001
+ return DynamicColor.fromPalette({
1002
+ name: "neutral_palette_key_color",
1003
+ palette: s => s.neutralPalette,
1004
+ tone: s => s.neutralPalette.keyColor.tone
1005
+ });
1006
+ }
1007
+ neutralVariantPaletteKeyColor() {
1008
+ return DynamicColor.fromPalette({
1009
+ name: "neutral_variant_palette_key_color",
1010
+ palette: s => s.neutralVariantPalette,
1011
+ tone: s => s.neutralVariantPalette.keyColor.tone
1012
+ });
1013
+ }
1014
+ errorPaletteKeyColor() {
1015
+ return DynamicColor.fromPalette({
1016
+ name: "error_palette_key_color",
1017
+ palette: s => s.errorPalette,
1018
+ tone: s => s.errorPalette.keyColor.tone
1019
+ });
1020
+ }
1021
+ background() {
1022
+ return DynamicColor.fromPalette({
1023
+ name: "background",
1024
+ palette: s => s.neutralPalette,
1025
+ tone: s => s.isDark ? 6 : 98,
1026
+ isBackground: !0
1027
+ });
1028
+ }
1029
+ onBackground() {
1030
+ return DynamicColor.fromPalette({
1031
+ name: "on_background",
1032
+ palette: s => s.neutralPalette,
1033
+ tone: s => s.isDark ? 90 : 10,
1034
+ background: s => this.background(),
1035
+ contrastCurve: s => new ContrastCurve(3, 3, 4.5, 7)
1036
+ });
1037
+ }
1038
+ surface() {
1039
+ return DynamicColor.fromPalette({
1040
+ name: "surface",
1041
+ palette: s => s.neutralPalette,
1042
+ tone: s => s.isDark ? 6 : 98,
1043
+ isBackground: !0
1044
+ });
1045
+ }
1046
+ surfaceDim() {
1047
+ return DynamicColor.fromPalette({
1048
+ name: "surface_dim",
1049
+ palette: s => s.neutralPalette,
1050
+ tone: s => s.isDark ? 6 : new ContrastCurve(87, 87, 80, 75).get(s.contrastLevel),
1051
+ isBackground: !0
1052
+ });
1053
+ }
1054
+ surfaceBright() {
1055
+ return DynamicColor.fromPalette({
1056
+ name: "surface_bright",
1057
+ palette: s => s.neutralPalette,
1058
+ tone: s => s.isDark ? new ContrastCurve(24, 24, 29, 34).get(s.contrastLevel) : 98,
1059
+ isBackground: !0
1060
+ });
1061
+ }
1062
+ surfaceContainerLowest() {
1063
+ return DynamicColor.fromPalette({
1064
+ name: "surface_container_lowest",
1065
+ palette: s => s.neutralPalette,
1066
+ tone: s => s.isDark ? new ContrastCurve(4, 4, 2, 0).get(s.contrastLevel) : 100,
1067
+ isBackground: !0
1068
+ });
1069
+ }
1070
+ surfaceContainerLow() {
1071
+ return DynamicColor.fromPalette({
1072
+ name: "surface_container_low",
1073
+ palette: s => s.neutralPalette,
1074
+ tone: s => s.isDark ? new ContrastCurve(10, 10, 11, 12).get(s.contrastLevel) : new ContrastCurve(96, 96, 96, 95).get(s.contrastLevel),
1075
+ isBackground: !0
1076
+ });
1077
+ }
1078
+ surfaceContainer() {
1079
+ return DynamicColor.fromPalette({
1080
+ name: "surface_container",
1081
+ palette: s => s.neutralPalette,
1082
+ tone: s => s.isDark ? new ContrastCurve(12, 12, 16, 20).get(s.contrastLevel) : new ContrastCurve(94, 94, 92, 90).get(s.contrastLevel),
1083
+ isBackground: !0
1084
+ });
1085
+ }
1086
+ surfaceContainerHigh() {
1087
+ return DynamicColor.fromPalette({
1088
+ name: "surface_container_high",
1089
+ palette: s => s.neutralPalette,
1090
+ tone: s => s.isDark ? new ContrastCurve(17, 17, 21, 25).get(s.contrastLevel) : new ContrastCurve(92, 92, 88, 85).get(s.contrastLevel),
1091
+ isBackground: !0
1092
+ });
1093
+ }
1094
+ surfaceContainerHighest() {
1095
+ return DynamicColor.fromPalette({
1096
+ name: "surface_container_highest",
1097
+ palette: s => s.neutralPalette,
1098
+ tone: s => s.isDark ? new ContrastCurve(22, 22, 26, 30).get(s.contrastLevel) : new ContrastCurve(90, 90, 84, 80).get(s.contrastLevel),
1099
+ isBackground: !0
1100
+ });
1101
+ }
1102
+ onSurface() {
1103
+ return DynamicColor.fromPalette({
1104
+ name: "on_surface",
1105
+ palette: s => s.neutralPalette,
1106
+ tone: s => s.isDark ? 90 : 10,
1107
+ background: s => this.highestSurface(s),
1108
+ contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
1109
+ });
1110
+ }
1111
+ surfaceVariant() {
1112
+ return DynamicColor.fromPalette({
1113
+ name: "surface_variant",
1114
+ palette: s => s.neutralVariantPalette,
1115
+ tone: s => s.isDark ? 30 : 90,
1116
+ isBackground: !0
1117
+ });
1118
+ }
1119
+ onSurfaceVariant() {
1120
+ return DynamicColor.fromPalette({
1121
+ name: "on_surface_variant",
1122
+ palette: s => s.neutralVariantPalette,
1123
+ tone: s => s.isDark ? 80 : 30,
1124
+ background: s => this.highestSurface(s),
1125
+ contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
1126
+ });
1127
+ }
1128
+ inverseSurface() {
1129
+ return DynamicColor.fromPalette({
1130
+ name: "inverse_surface",
1131
+ palette: s => s.neutralPalette,
1132
+ tone: s => s.isDark ? 90 : 20,
1133
+ isBackground: !0
1134
+ });
1135
+ }
1136
+ inverseOnSurface() {
1137
+ return DynamicColor.fromPalette({
1138
+ name: "inverse_on_surface",
1139
+ palette: s => s.neutralPalette,
1140
+ tone: s => s.isDark ? 20 : 95,
1141
+ background: s => this.inverseSurface(),
1142
+ contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
1143
+ });
1144
+ }
1145
+ outline() {
1146
+ return DynamicColor.fromPalette({
1147
+ name: "outline",
1148
+ palette: s => s.neutralVariantPalette,
1149
+ tone: s => s.isDark ? 60 : 50,
1150
+ background: s => this.highestSurface(s),
1151
+ contrastCurve: s => new ContrastCurve(1.5, 3, 4.5, 7)
1152
+ });
1153
+ }
1154
+ outlineVariant() {
1155
+ return DynamicColor.fromPalette({
1156
+ name: "outline_variant",
1157
+ palette: s => s.neutralVariantPalette,
1158
+ tone: s => s.isDark ? 30 : 80,
1159
+ background: s => this.highestSurface(s),
1160
+ contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5)
1161
+ });
1162
+ }
1163
+ shadow() {
1164
+ return DynamicColor.fromPalette({
1165
+ name: "shadow",
1166
+ palette: s => s.neutralPalette,
1167
+ tone: s => 0
1168
+ });
1169
+ }
1170
+ scrim() {
1171
+ return DynamicColor.fromPalette({
1172
+ name: "scrim",
1173
+ palette: s => s.neutralPalette,
1174
+ tone: s => 0
1175
+ });
1176
+ }
1177
+ surfaceTint() {
1178
+ return DynamicColor.fromPalette({
1179
+ name: "surface_tint",
1180
+ palette: s => s.primaryPalette,
1181
+ tone: s => s.isDark ? 80 : 40,
1182
+ isBackground: !0
1183
+ });
1184
+ }
1185
+ primary() {
1186
+ return DynamicColor.fromPalette({
1187
+ name: "primary",
1188
+ palette: s => s.primaryPalette,
1189
+ tone: s => isMonochrome(s) ? s.isDark ? 100 : 0 : s.isDark ? 80 : 40,
1190
+ isBackground: !0,
1191
+ background: s => this.highestSurface(s),
1192
+ contrastCurve: s => new ContrastCurve(3, 4.5, 7, 7),
1193
+ toneDeltaPair: s => new ToneDeltaPair(this.primaryContainer(), this.primary(), 10, "nearer", !1)
1194
+ });
1195
+ }
1196
+ primaryDim() {}
1197
+ onPrimary() {
1198
+ return DynamicColor.fromPalette({
1199
+ name: "on_primary",
1200
+ palette: s => s.primaryPalette,
1201
+ tone: s => isMonochrome(s) ? s.isDark ? 10 : 90 : s.isDark ? 20 : 100,
1202
+ background: s => this.primary(),
1203
+ contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
1204
+ });
1205
+ }
1206
+ primaryContainer() {
1207
+ return DynamicColor.fromPalette({
1208
+ name: "primary_container",
1209
+ palette: s => s.primaryPalette,
1210
+ tone: s => isFidelity(s) ? s.sourceColorHct.tone : isMonochrome(s) ? s.isDark ? 85 : 25 : s.isDark ? 30 : 90,
1211
+ isBackground: !0,
1212
+ background: s => this.highestSurface(s),
1213
+ contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
1214
+ toneDeltaPair: s => new ToneDeltaPair(this.primaryContainer(), this.primary(), 10, "nearer", !1)
1215
+ });
1216
+ }
1217
+ onPrimaryContainer() {
1218
+ return DynamicColor.fromPalette({
1219
+ name: "on_primary_container",
1220
+ palette: s => s.primaryPalette,
1221
+ tone: s => isFidelity(s) ? DynamicColor.foregroundTone(this.primaryContainer().tone(s), 4.5) : isMonochrome(s) ? s.isDark ? 0 : 100 : s.isDark ? 90 : 30,
1222
+ background: s => this.primaryContainer(),
1223
+ contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
1224
+ });
1225
+ }
1226
+ inversePrimary() {
1227
+ return DynamicColor.fromPalette({
1228
+ name: "inverse_primary",
1229
+ palette: s => s.primaryPalette,
1230
+ tone: s => s.isDark ? 40 : 80,
1231
+ background: s => this.inverseSurface(),
1232
+ contrastCurve: s => new ContrastCurve(3, 4.5, 7, 7)
1233
+ });
1234
+ }
1235
+ secondary() {
1236
+ return DynamicColor.fromPalette({
1237
+ name: "secondary",
1238
+ palette: s => s.secondaryPalette,
1239
+ tone: s => s.isDark ? 80 : 40,
1240
+ isBackground: !0,
1241
+ background: s => this.highestSurface(s),
1242
+ contrastCurve: s => new ContrastCurve(3, 4.5, 7, 7),
1243
+ toneDeltaPair: s => new ToneDeltaPair(this.secondaryContainer(), this.secondary(), 10, "nearer", !1)
1244
+ });
1245
+ }
1246
+ secondaryDim() {}
1247
+ onSecondary() {
1248
+ return DynamicColor.fromPalette({
1249
+ name: "on_secondary",
1250
+ palette: s => s.secondaryPalette,
1251
+ tone: s => isMonochrome(s) ? s.isDark ? 10 : 100 : s.isDark ? 20 : 100,
1252
+ background: s => this.secondary(),
1253
+ contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
1254
+ });
1255
+ }
1256
+ secondaryContainer() {
1257
+ return DynamicColor.fromPalette({
1258
+ name: "secondary_container",
1259
+ palette: s => s.secondaryPalette,
1260
+ tone: s => {
1261
+ const initialTone = s.isDark ? 30 : 90;
1262
+ return isMonochrome(s) ? s.isDark ? 30 : 85 : isFidelity(s) ? findDesiredChromaByTone(s.secondaryPalette.hue, s.secondaryPalette.chroma, initialTone, !s.isDark) : initialTone;
1263
+ },
1264
+ isBackground: !0,
1265
+ background: s => this.highestSurface(s),
1266
+ contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
1267
+ toneDeltaPair: s => new ToneDeltaPair(this.secondaryContainer(), this.secondary(), 10, "nearer", !1)
1268
+ });
1269
+ }
1270
+ onSecondaryContainer() {
1271
+ return DynamicColor.fromPalette({
1272
+ name: "on_secondary_container",
1273
+ palette: s => s.secondaryPalette,
1274
+ tone: s => isMonochrome(s) ? s.isDark ? 90 : 10 : isFidelity(s) ? DynamicColor.foregroundTone(this.secondaryContainer().tone(s), 4.5) : s.isDark ? 90 : 30,
1275
+ background: s => this.secondaryContainer(),
1276
+ contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
1277
+ });
1278
+ }
1279
+ tertiary() {
1280
+ return DynamicColor.fromPalette({
1281
+ name: "tertiary",
1282
+ palette: s => s.tertiaryPalette,
1283
+ tone: s => isMonochrome(s) ? s.isDark ? 90 : 25 : s.isDark ? 80 : 40,
1284
+ isBackground: !0,
1285
+ background: s => this.highestSurface(s),
1286
+ contrastCurve: s => new ContrastCurve(3, 4.5, 7, 7),
1287
+ toneDeltaPair: s => new ToneDeltaPair(this.tertiaryContainer(), this.tertiary(), 10, "nearer", !1)
1288
+ });
1289
+ }
1290
+ tertiaryDim() {}
1291
+ onTertiary() {
1292
+ return DynamicColor.fromPalette({
1293
+ name: "on_tertiary",
1294
+ palette: s => s.tertiaryPalette,
1295
+ tone: s => isMonochrome(s) ? s.isDark ? 10 : 90 : s.isDark ? 20 : 100,
1296
+ background: s => this.tertiary(),
1297
+ contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
1298
+ });
1299
+ }
1300
+ tertiaryContainer() {
1301
+ return DynamicColor.fromPalette({
1302
+ name: "tertiary_container",
1303
+ palette: s => s.tertiaryPalette,
1304
+ tone: s => {
1305
+ if (isMonochrome(s)) return s.isDark ? 60 : 49;
1306
+ if (!isFidelity(s)) return s.isDark ? 30 : 90;
1307
+ const proposedHct = s.tertiaryPalette.getHct(s.sourceColorHct.tone);
1308
+ return DislikeAnalyzer.fixIfDisliked(proposedHct).tone;
1309
+ },
1310
+ isBackground: !0,
1311
+ background: s => this.highestSurface(s),
1312
+ contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
1313
+ toneDeltaPair: s => new ToneDeltaPair(this.tertiaryContainer(), this.tertiary(), 10, "nearer", !1)
1314
+ });
1315
+ }
1316
+ onTertiaryContainer() {
1317
+ return DynamicColor.fromPalette({
1318
+ name: "on_tertiary_container",
1319
+ palette: s => s.tertiaryPalette,
1320
+ tone: s => isMonochrome(s) ? s.isDark ? 0 : 100 : isFidelity(s) ? DynamicColor.foregroundTone(this.tertiaryContainer().tone(s), 4.5) : s.isDark ? 90 : 30,
1321
+ background: s => this.tertiaryContainer(),
1322
+ contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
1323
+ });
1324
+ }
1325
+ error() {
1326
+ return DynamicColor.fromPalette({
1327
+ name: "error",
1328
+ palette: s => s.errorPalette,
1329
+ tone: s => s.isDark ? 80 : 40,
1330
+ isBackground: !0,
1331
+ background: s => this.highestSurface(s),
1332
+ contrastCurve: s => new ContrastCurve(3, 4.5, 7, 7),
1333
+ toneDeltaPair: s => new ToneDeltaPair(this.errorContainer(), this.error(), 10, "nearer", !1)
1334
+ });
1335
+ }
1336
+ errorDim() {}
1337
+ onError() {
1338
+ return DynamicColor.fromPalette({
1339
+ name: "on_error",
1340
+ palette: s => s.errorPalette,
1341
+ tone: s => s.isDark ? 20 : 100,
1342
+ background: s => this.error(),
1343
+ contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
1344
+ });
1345
+ }
1346
+ errorContainer() {
1347
+ return DynamicColor.fromPalette({
1348
+ name: "error_container",
1349
+ palette: s => s.errorPalette,
1350
+ tone: s => s.isDark ? 30 : 90,
1351
+ isBackground: !0,
1352
+ background: s => this.highestSurface(s),
1353
+ contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
1354
+ toneDeltaPair: s => new ToneDeltaPair(this.errorContainer(), this.error(), 10, "nearer", !1)
1355
+ });
1356
+ }
1357
+ onErrorContainer() {
1358
+ return DynamicColor.fromPalette({
1359
+ name: "on_error_container",
1360
+ palette: s => s.errorPalette,
1361
+ tone: s => isMonochrome(s) ? s.isDark ? 90 : 10 : s.isDark ? 90 : 30,
1362
+ background: s => this.errorContainer(),
1363
+ contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
1364
+ });
1365
+ }
1366
+ primaryFixed() {
1367
+ return DynamicColor.fromPalette({
1368
+ name: "primary_fixed",
1369
+ palette: s => s.primaryPalette,
1370
+ tone: s => isMonochrome(s) ? 40 : 90,
1371
+ isBackground: !0,
1372
+ background: s => this.highestSurface(s),
1373
+ contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
1374
+ toneDeltaPair: s => new ToneDeltaPair(this.primaryFixed(), this.primaryFixedDim(), 10, "lighter", !0)
1375
+ });
1376
+ }
1377
+ primaryFixedDim() {
1378
+ return DynamicColor.fromPalette({
1379
+ name: "primary_fixed_dim",
1380
+ palette: s => s.primaryPalette,
1381
+ tone: s => isMonochrome(s) ? 30 : 80,
1382
+ isBackground: !0,
1383
+ background: s => this.highestSurface(s),
1384
+ contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
1385
+ toneDeltaPair: s => new ToneDeltaPair(this.primaryFixed(), this.primaryFixedDim(), 10, "lighter", !0)
1386
+ });
1387
+ }
1388
+ onPrimaryFixed() {
1389
+ return DynamicColor.fromPalette({
1390
+ name: "on_primary_fixed",
1391
+ palette: s => s.primaryPalette,
1392
+ tone: s => isMonochrome(s) ? 100 : 10,
1393
+ background: s => this.primaryFixedDim(),
1394
+ secondBackground: s => this.primaryFixed(),
1395
+ contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
1396
+ });
1397
+ }
1398
+ onPrimaryFixedVariant() {
1399
+ return DynamicColor.fromPalette({
1400
+ name: "on_primary_fixed_variant",
1401
+ palette: s => s.primaryPalette,
1402
+ tone: s => isMonochrome(s) ? 90 : 30,
1403
+ background: s => this.primaryFixedDim(),
1404
+ secondBackground: s => this.primaryFixed(),
1405
+ contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
1406
+ });
1407
+ }
1408
+ secondaryFixed() {
1409
+ return DynamicColor.fromPalette({
1410
+ name: "secondary_fixed",
1411
+ palette: s => s.secondaryPalette,
1412
+ tone: s => isMonochrome(s) ? 80 : 90,
1413
+ isBackground: !0,
1414
+ background: s => this.highestSurface(s),
1415
+ contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
1416
+ toneDeltaPair: s => new ToneDeltaPair(this.secondaryFixed(), this.secondaryFixedDim(), 10, "lighter", !0)
1417
+ });
1418
+ }
1419
+ secondaryFixedDim() {
1420
+ return DynamicColor.fromPalette({
1421
+ name: "secondary_fixed_dim",
1422
+ palette: s => s.secondaryPalette,
1423
+ tone: s => isMonochrome(s) ? 70 : 80,
1424
+ isBackground: !0,
1425
+ background: s => this.highestSurface(s),
1426
+ contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
1427
+ toneDeltaPair: s => new ToneDeltaPair(this.secondaryFixed(), this.secondaryFixedDim(), 10, "lighter", !0)
1428
+ });
1429
+ }
1430
+ onSecondaryFixed() {
1431
+ return DynamicColor.fromPalette({
1432
+ name: "on_secondary_fixed",
1433
+ palette: s => s.secondaryPalette,
1434
+ tone: s => 10,
1435
+ background: s => this.secondaryFixedDim(),
1436
+ secondBackground: s => this.secondaryFixed(),
1437
+ contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
1438
+ });
1439
+ }
1440
+ onSecondaryFixedVariant() {
1441
+ return DynamicColor.fromPalette({
1442
+ name: "on_secondary_fixed_variant",
1443
+ palette: s => s.secondaryPalette,
1444
+ tone: s => isMonochrome(s) ? 25 : 30,
1445
+ background: s => this.secondaryFixedDim(),
1446
+ secondBackground: s => this.secondaryFixed(),
1447
+ contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
1448
+ });
1449
+ }
1450
+ tertiaryFixed() {
1451
+ return DynamicColor.fromPalette({
1452
+ name: "tertiary_fixed",
1453
+ palette: s => s.tertiaryPalette,
1454
+ tone: s => isMonochrome(s) ? 40 : 90,
1455
+ isBackground: !0,
1456
+ background: s => this.highestSurface(s),
1457
+ contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
1458
+ toneDeltaPair: s => new ToneDeltaPair(this.tertiaryFixed(), this.tertiaryFixedDim(), 10, "lighter", !0)
1459
+ });
1460
+ }
1461
+ tertiaryFixedDim() {
1462
+ return DynamicColor.fromPalette({
1463
+ name: "tertiary_fixed_dim",
1464
+ palette: s => s.tertiaryPalette,
1465
+ tone: s => isMonochrome(s) ? 30 : 80,
1466
+ isBackground: !0,
1467
+ background: s => this.highestSurface(s),
1468
+ contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
1469
+ toneDeltaPair: s => new ToneDeltaPair(this.tertiaryFixed(), this.tertiaryFixedDim(), 10, "lighter", !0)
1470
+ });
1471
+ }
1472
+ onTertiaryFixed() {
1473
+ return DynamicColor.fromPalette({
1474
+ name: "on_tertiary_fixed",
1475
+ palette: s => s.tertiaryPalette,
1476
+ tone: s => isMonochrome(s) ? 100 : 10,
1477
+ background: s => this.tertiaryFixedDim(),
1478
+ secondBackground: s => this.tertiaryFixed(),
1479
+ contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
1480
+ });
1481
+ }
1482
+ onTertiaryFixedVariant() {
1483
+ return DynamicColor.fromPalette({
1484
+ name: "on_tertiary_fixed_variant",
1485
+ palette: s => s.tertiaryPalette,
1486
+ tone: s => isMonochrome(s) ? 90 : 30,
1487
+ background: s => this.tertiaryFixedDim(),
1488
+ secondBackground: s => this.tertiaryFixed(),
1489
+ contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
1490
+ });
1491
+ }
1492
+ highestSurface(s) {
1493
+ return s.isDark ? this.surfaceBright() : this.surfaceDim();
1494
+ }
1495
+ }
1496
+ function tMaxC(palette, lowerBound = 0, upperBound = 100, chromaMultiplier = 1) {
1497
+ return clampDouble(lowerBound, upperBound, findBestToneForChroma(palette.hue, palette.chroma * chromaMultiplier, 100, !0));
702
1498
  }
703
- function performAlbers(prealbers, scheme) {
704
- const albersd = prealbers.inViewingConditions(viewingConditionsForAlbers(scheme));
705
- return DynamicColor.tonePrefersLightForeground(prealbers.tone) && !DynamicColor.toneAllowsLightForeground(albersd.tone) ? DynamicColor.enableLightForeground(prealbers.tone) : DynamicColor.enableLightForeground(albersd.tone);
1499
+ function tMinC(palette, lowerBound = 0, upperBound = 100) {
1500
+ return clampDouble(lowerBound, upperBound, findBestToneForChroma(palette.hue, palette.chroma, 0, !1));
706
1501
  }
707
- class MaterialDynamicColors {
708
- static highestSurface(s) {
709
- return s.isDark ? MaterialDynamicColors.surfaceBright : MaterialDynamicColors.surfaceDim;
1502
+ function findBestToneForChroma(hue, chroma, tone, byDecreasingTone) {
1503
+ let answer = tone,
1504
+ bestCandidate = Hct.from(hue, chroma, answer);
1505
+ for (; bestCandidate.chroma < chroma && !(tone < 0 || tone > 100);) {
1506
+ tone += byDecreasingTone ? -1 : 1;
1507
+ const newCandidate = Hct.from(hue, chroma, tone);
1508
+ bestCandidate.chroma < newCandidate.chroma && (bestCandidate = newCandidate, answer = tone);
710
1509
  }
1510
+ return answer;
711
1511
  }
712
- MaterialDynamicColors.contentAccentToneDelta = 15, MaterialDynamicColors.primaryPaletteKeyColor = DynamicColor.fromPalette({
713
- name: "primary_palette_key_color",
714
- palette: s => s.primaryPalette,
715
- tone: s => s.primaryPalette.keyColor.tone
716
- }), MaterialDynamicColors.secondaryPaletteKeyColor = DynamicColor.fromPalette({
717
- name: "secondary_palette_key_color",
718
- palette: s => s.secondaryPalette,
719
- tone: s => s.secondaryPalette.keyColor.tone
720
- }), MaterialDynamicColors.tertiaryPaletteKeyColor = DynamicColor.fromPalette({
721
- name: "tertiary_palette_key_color",
722
- palette: s => s.tertiaryPalette,
723
- tone: s => s.tertiaryPalette.keyColor.tone
724
- }), MaterialDynamicColors.neutralPaletteKeyColor = DynamicColor.fromPalette({
725
- name: "neutral_palette_key_color",
726
- palette: s => s.neutralPalette,
727
- tone: s => s.neutralPalette.keyColor.tone
728
- }), MaterialDynamicColors.neutralVariantPaletteKeyColor = DynamicColor.fromPalette({
729
- name: "neutral_variant_palette_key_color",
730
- palette: s => s.neutralVariantPalette,
731
- tone: s => s.neutralVariantPalette.keyColor.tone
732
- }), MaterialDynamicColors.background = DynamicColor.fromPalette({
733
- name: "background",
734
- palette: s => s.neutralPalette,
735
- tone: s => s.isDark ? 6 : 98,
736
- isBackground: !0
737
- }), MaterialDynamicColors.onBackground = DynamicColor.fromPalette({
738
- name: "on_background",
739
- palette: s => s.neutralPalette,
740
- tone: s => s.isDark ? 90 : 10,
741
- background: s => MaterialDynamicColors.background,
742
- contrastCurve: new ContrastCurve(3, 3, 4.5, 7)
743
- }), MaterialDynamicColors.surface = DynamicColor.fromPalette({
744
- name: "surface",
745
- palette: s => s.neutralPalette,
746
- tone: s => s.isDark ? 6 : 98,
747
- isBackground: !0
748
- }), MaterialDynamicColors.surfaceDim = DynamicColor.fromPalette({
749
- name: "surface_dim",
750
- palette: s => s.neutralPalette,
751
- tone: s => s.isDark ? 6 : 87,
752
- isBackground: !0
753
- }), MaterialDynamicColors.surfaceBright = DynamicColor.fromPalette({
754
- name: "surface_bright",
755
- palette: s => s.neutralPalette,
756
- tone: s => s.isDark ? 24 : 98,
757
- isBackground: !0
758
- }), MaterialDynamicColors.surfaceContainerLowest = DynamicColor.fromPalette({
759
- name: "surface_container_lowest",
760
- palette: s => s.neutralPalette,
761
- tone: s => s.isDark ? 4 : 100,
762
- isBackground: !0
763
- }), MaterialDynamicColors.surfaceContainerLow = DynamicColor.fromPalette({
764
- name: "surface_container_low",
765
- palette: s => s.neutralPalette,
766
- tone: s => s.isDark ? 10 : 96,
767
- isBackground: !0
768
- }), MaterialDynamicColors.surfaceContainer = DynamicColor.fromPalette({
769
- name: "surface_container",
770
- palette: s => s.neutralPalette,
771
- tone: s => s.isDark ? 12 : 94,
772
- isBackground: !0
773
- }), MaterialDynamicColors.surfaceContainerHigh = DynamicColor.fromPalette({
774
- name: "surface_container_high",
775
- palette: s => s.neutralPalette,
776
- tone: s => s.isDark ? 17 : 92,
777
- isBackground: !0
778
- }), MaterialDynamicColors.surfaceContainerHighest = DynamicColor.fromPalette({
779
- name: "surface_container_highest",
780
- palette: s => s.neutralPalette,
781
- tone: s => s.isDark ? 22 : 90,
782
- isBackground: !0
783
- }), MaterialDynamicColors.onSurface = DynamicColor.fromPalette({
784
- name: "on_surface",
785
- palette: s => s.neutralPalette,
786
- tone: s => s.isDark ? 90 : 10,
787
- background: s => MaterialDynamicColors.highestSurface(s),
788
- contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
789
- }), MaterialDynamicColors.surfaceVariant = DynamicColor.fromPalette({
790
- name: "surface_variant",
791
- palette: s => s.neutralVariantPalette,
792
- tone: s => s.isDark ? 30 : 90,
793
- isBackground: !0
794
- }), MaterialDynamicColors.onSurfaceVariant = DynamicColor.fromPalette({
795
- name: "on_surface_variant",
796
- palette: s => s.neutralVariantPalette,
797
- tone: s => s.isDark ? 80 : 30,
798
- background: s => MaterialDynamicColors.highestSurface(s),
799
- contrastCurve: new ContrastCurve(3, 4.5, 7, 11)
800
- }), MaterialDynamicColors.inverseSurface = DynamicColor.fromPalette({
801
- name: "inverse_surface",
802
- palette: s => s.neutralPalette,
803
- tone: s => s.isDark ? 90 : 20
804
- }), MaterialDynamicColors.inverseOnSurface = DynamicColor.fromPalette({
805
- name: "inverse_on_surface",
806
- palette: s => s.neutralPalette,
807
- tone: s => s.isDark ? 20 : 95,
808
- background: s => MaterialDynamicColors.inverseSurface,
809
- contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
810
- }), MaterialDynamicColors.outline = DynamicColor.fromPalette({
811
- name: "outline",
812
- palette: s => s.neutralVariantPalette,
813
- tone: s => s.isDark ? 60 : 50,
814
- background: s => MaterialDynamicColors.highestSurface(s),
815
- contrastCurve: new ContrastCurve(1.5, 3, 4.5, 7)
816
- }), MaterialDynamicColors.outlineVariant = DynamicColor.fromPalette({
817
- name: "outline_variant",
818
- palette: s => s.neutralVariantPalette,
819
- tone: s => s.isDark ? 30 : 80,
820
- background: s => MaterialDynamicColors.highestSurface(s),
821
- contrastCurve: new ContrastCurve(1, 1, 3, 7)
822
- }), MaterialDynamicColors.shadow = DynamicColor.fromPalette({
823
- name: "shadow",
824
- palette: s => s.neutralPalette,
825
- tone: s => 0
826
- }), MaterialDynamicColors.scrim = DynamicColor.fromPalette({
827
- name: "scrim",
828
- palette: s => s.neutralPalette,
829
- tone: s => 0
830
- }), MaterialDynamicColors.surfaceTint = DynamicColor.fromPalette({
831
- name: "surface_tint",
832
- palette: s => s.primaryPalette,
833
- tone: s => s.isDark ? 80 : 40,
834
- isBackground: !0
835
- }), MaterialDynamicColors.primary = DynamicColor.fromPalette({
836
- name: "primary",
837
- palette: s => s.primaryPalette,
838
- tone: s => isMonochrome(s) ? s.isDark ? 100 : 0 : s.isDark ? 80 : 40,
839
- isBackground: !0,
840
- background: s => MaterialDynamicColors.highestSurface(s),
841
- contrastCurve: new ContrastCurve(3, 4.5, 7, 11),
842
- toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.primaryContainer, MaterialDynamicColors.primary, 15, "nearer", !1)
843
- }), MaterialDynamicColors.onPrimary = DynamicColor.fromPalette({
844
- name: "on_primary",
845
- palette: s => s.primaryPalette,
846
- tone: s => isMonochrome(s) ? s.isDark ? 10 : 90 : s.isDark ? 20 : 100,
847
- background: s => MaterialDynamicColors.primary,
848
- contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
849
- }), MaterialDynamicColors.primaryContainer = DynamicColor.fromPalette({
850
- name: "primary_container",
851
- palette: s => s.primaryPalette,
852
- tone: s => isFidelity(s) ? performAlbers(s.sourceColorHct, s) : isMonochrome(s) ? s.isDark ? 85 : 25 : s.isDark ? 30 : 90,
853
- isBackground: !0,
854
- background: s => MaterialDynamicColors.highestSurface(s),
855
- contrastCurve: new ContrastCurve(1, 1, 3, 7),
856
- toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.primaryContainer, MaterialDynamicColors.primary, 15, "nearer", !1)
857
- }), MaterialDynamicColors.onPrimaryContainer = DynamicColor.fromPalette({
858
- name: "on_primary_container",
859
- palette: s => s.primaryPalette,
860
- tone: s => isFidelity(s) ? DynamicColor.foregroundTone(MaterialDynamicColors.primaryContainer.tone(s), 4.5) : isMonochrome(s) ? s.isDark ? 0 : 100 : s.isDark ? 90 : 10,
861
- background: s => MaterialDynamicColors.primaryContainer,
862
- contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
863
- }), MaterialDynamicColors.inversePrimary = DynamicColor.fromPalette({
864
- name: "inverse_primary",
865
- palette: s => s.primaryPalette,
866
- tone: s => s.isDark ? 40 : 80,
867
- background: s => MaterialDynamicColors.inverseSurface,
868
- contrastCurve: new ContrastCurve(3, 4.5, 7, 11)
869
- }), MaterialDynamicColors.secondary = DynamicColor.fromPalette({
870
- name: "secondary",
871
- palette: s => s.secondaryPalette,
872
- tone: s => s.isDark ? 80 : 40,
873
- isBackground: !0,
874
- background: s => MaterialDynamicColors.highestSurface(s),
875
- contrastCurve: new ContrastCurve(3, 4.5, 7, 11),
876
- toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.secondaryContainer, MaterialDynamicColors.secondary, 15, "nearer", !1)
877
- }), MaterialDynamicColors.onSecondary = DynamicColor.fromPalette({
878
- name: "on_secondary",
879
- palette: s => s.secondaryPalette,
880
- tone: s => isMonochrome(s) ? s.isDark ? 10 : 100 : s.isDark ? 20 : 100,
881
- background: s => MaterialDynamicColors.secondary,
882
- contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
883
- }), MaterialDynamicColors.secondaryContainer = DynamicColor.fromPalette({
884
- name: "secondary_container",
885
- palette: s => s.secondaryPalette,
886
- tone: s => {
887
- const initialTone = s.isDark ? 30 : 90;
888
- if (isMonochrome(s)) return s.isDark ? 30 : 85;
889
- if (!isFidelity(s)) return initialTone;
890
- let answer = findDesiredChromaByTone(s.secondaryPalette.hue, s.secondaryPalette.chroma, initialTone, !s.isDark);
891
- return answer = performAlbers(s.secondaryPalette.getHct(answer), s), answer;
892
- },
893
- isBackground: !0,
894
- background: s => MaterialDynamicColors.highestSurface(s),
895
- contrastCurve: new ContrastCurve(1, 1, 3, 7),
896
- toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.secondaryContainer, MaterialDynamicColors.secondary, 15, "nearer", !1)
897
- }), MaterialDynamicColors.onSecondaryContainer = DynamicColor.fromPalette({
898
- name: "on_secondary_container",
899
- palette: s => s.secondaryPalette,
900
- tone: s => isFidelity(s) ? DynamicColor.foregroundTone(MaterialDynamicColors.secondaryContainer.tone(s), 4.5) : s.isDark ? 90 : 10,
901
- background: s => MaterialDynamicColors.secondaryContainer,
902
- contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
903
- }), MaterialDynamicColors.tertiary = DynamicColor.fromPalette({
904
- name: "tertiary",
905
- palette: s => s.tertiaryPalette,
906
- tone: s => isMonochrome(s) ? s.isDark ? 90 : 25 : s.isDark ? 80 : 40,
907
- isBackground: !0,
908
- background: s => MaterialDynamicColors.highestSurface(s),
909
- contrastCurve: new ContrastCurve(3, 4.5, 7, 11),
910
- toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.tertiaryContainer, MaterialDynamicColors.tertiary, 15, "nearer", !1)
911
- }), MaterialDynamicColors.onTertiary = DynamicColor.fromPalette({
912
- name: "on_tertiary",
913
- palette: s => s.tertiaryPalette,
914
- tone: s => isMonochrome(s) ? s.isDark ? 10 : 90 : s.isDark ? 20 : 100,
915
- background: s => MaterialDynamicColors.tertiary,
916
- contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
917
- }), MaterialDynamicColors.tertiaryContainer = DynamicColor.fromPalette({
918
- name: "tertiary_container",
919
- palette: s => s.tertiaryPalette,
920
- tone: s => {
921
- if (isMonochrome(s)) return s.isDark ? 60 : 49;
922
- if (!isFidelity(s)) return s.isDark ? 30 : 90;
923
- const albersTone = performAlbers(s.tertiaryPalette.getHct(s.sourceColorHct.tone), s),
924
- proposedHct = s.tertiaryPalette.getHct(albersTone);
925
- return DislikeAnalyzer.fixIfDisliked(proposedHct).tone;
926
- },
927
- isBackground: !0,
928
- background: s => MaterialDynamicColors.highestSurface(s),
929
- contrastCurve: new ContrastCurve(1, 1, 3, 7),
930
- toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.tertiaryContainer, MaterialDynamicColors.tertiary, 15, "nearer", !1)
931
- }), MaterialDynamicColors.onTertiaryContainer = DynamicColor.fromPalette({
932
- name: "on_tertiary_container",
933
- palette: s => s.tertiaryPalette,
934
- tone: s => isMonochrome(s) ? s.isDark ? 0 : 100 : isFidelity(s) ? DynamicColor.foregroundTone(MaterialDynamicColors.tertiaryContainer.tone(s), 4.5) : s.isDark ? 90 : 10,
935
- background: s => MaterialDynamicColors.tertiaryContainer,
936
- contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
937
- }), MaterialDynamicColors.error = DynamicColor.fromPalette({
938
- name: "error",
939
- palette: s => s.errorPalette,
940
- tone: s => s.isDark ? 80 : 40,
941
- isBackground: !0,
942
- background: s => MaterialDynamicColors.highestSurface(s),
943
- contrastCurve: new ContrastCurve(3, 4.5, 7, 11),
944
- toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.errorContainer, MaterialDynamicColors.error, 15, "nearer", !1)
945
- }), MaterialDynamicColors.onError = DynamicColor.fromPalette({
946
- name: "on_error",
947
- palette: s => s.errorPalette,
948
- tone: s => s.isDark ? 20 : 100,
949
- background: s => MaterialDynamicColors.error,
950
- contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
951
- }), MaterialDynamicColors.errorContainer = DynamicColor.fromPalette({
952
- name: "error_container",
953
- palette: s => s.errorPalette,
954
- tone: s => s.isDark ? 30 : 90,
955
- isBackground: !0,
956
- background: s => MaterialDynamicColors.highestSurface(s),
957
- contrastCurve: new ContrastCurve(1, 1, 3, 7),
958
- toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.errorContainer, MaterialDynamicColors.error, 15, "nearer", !1)
959
- }), MaterialDynamicColors.onErrorContainer = DynamicColor.fromPalette({
960
- name: "on_error_container",
961
- palette: s => s.errorPalette,
962
- tone: s => s.isDark ? 90 : 10,
963
- background: s => MaterialDynamicColors.errorContainer,
964
- contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
965
- }), MaterialDynamicColors.primaryFixed = DynamicColor.fromPalette({
966
- name: "primary_fixed",
967
- palette: s => s.primaryPalette,
968
- tone: s => isMonochrome(s) ? 40 : 90,
969
- isBackground: !0,
970
- background: s => MaterialDynamicColors.highestSurface(s),
971
- contrastCurve: new ContrastCurve(1, 1, 3, 7),
972
- toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.primaryFixed, MaterialDynamicColors.primaryFixedDim, 10, "lighter", !0)
973
- }), MaterialDynamicColors.primaryFixedDim = DynamicColor.fromPalette({
974
- name: "primary_fixed_dim",
975
- palette: s => s.primaryPalette,
976
- tone: s => isMonochrome(s) ? 30 : 80,
977
- isBackground: !0,
978
- background: s => MaterialDynamicColors.highestSurface(s),
979
- contrastCurve: new ContrastCurve(1, 1, 3, 7),
980
- toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.primaryFixed, MaterialDynamicColors.primaryFixedDim, 10, "lighter", !0)
981
- }), MaterialDynamicColors.onPrimaryFixed = DynamicColor.fromPalette({
982
- name: "on_primary_fixed",
983
- palette: s => s.primaryPalette,
984
- tone: s => isMonochrome(s) ? 100 : 10,
985
- background: s => MaterialDynamicColors.primaryFixedDim,
986
- secondBackground: s => MaterialDynamicColors.primaryFixed,
987
- contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
988
- }), MaterialDynamicColors.onPrimaryFixedVariant = DynamicColor.fromPalette({
989
- name: "on_primary_fixed_variant",
990
- palette: s => s.primaryPalette,
991
- tone: s => isMonochrome(s) ? 90 : 30,
992
- background: s => MaterialDynamicColors.primaryFixedDim,
993
- secondBackground: s => MaterialDynamicColors.primaryFixed,
994
- contrastCurve: new ContrastCurve(3, 4.5, 7, 11)
995
- }), MaterialDynamicColors.secondaryFixed = DynamicColor.fromPalette({
996
- name: "secondary_fixed",
997
- palette: s => s.secondaryPalette,
998
- tone: s => isMonochrome(s) ? 80 : 90,
999
- isBackground: !0,
1000
- background: s => MaterialDynamicColors.highestSurface(s),
1001
- contrastCurve: new ContrastCurve(1, 1, 3, 7),
1002
- toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.secondaryFixed, MaterialDynamicColors.secondaryFixedDim, 10, "lighter", !0)
1003
- }), MaterialDynamicColors.secondaryFixedDim = DynamicColor.fromPalette({
1004
- name: "secondary_fixed_dim",
1005
- palette: s => s.secondaryPalette,
1006
- tone: s => isMonochrome(s) ? 70 : 80,
1007
- isBackground: !0,
1008
- background: s => MaterialDynamicColors.highestSurface(s),
1009
- contrastCurve: new ContrastCurve(1, 1, 3, 7),
1010
- toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.secondaryFixed, MaterialDynamicColors.secondaryFixedDim, 10, "lighter", !0)
1011
- }), MaterialDynamicColors.onSecondaryFixed = DynamicColor.fromPalette({
1012
- name: "on_secondary_fixed",
1013
- palette: s => s.secondaryPalette,
1014
- tone: s => 10,
1015
- background: s => MaterialDynamicColors.secondaryFixedDim,
1016
- secondBackground: s => MaterialDynamicColors.secondaryFixed,
1017
- contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
1018
- }), MaterialDynamicColors.onSecondaryFixedVariant = DynamicColor.fromPalette({
1019
- name: "on_secondary_fixed_variant",
1020
- palette: s => s.secondaryPalette,
1021
- tone: s => isMonochrome(s) ? 25 : 30,
1022
- background: s => MaterialDynamicColors.secondaryFixedDim,
1023
- secondBackground: s => MaterialDynamicColors.secondaryFixed,
1024
- contrastCurve: new ContrastCurve(3, 4.5, 7, 11)
1025
- }), MaterialDynamicColors.tertiaryFixed = DynamicColor.fromPalette({
1026
- name: "tertiary_fixed",
1027
- palette: s => s.tertiaryPalette,
1028
- tone: s => isMonochrome(s) ? 40 : 90,
1029
- isBackground: !0,
1030
- background: s => MaterialDynamicColors.highestSurface(s),
1031
- contrastCurve: new ContrastCurve(1, 1, 3, 7),
1032
- toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.tertiaryFixed, MaterialDynamicColors.tertiaryFixedDim, 10, "lighter", !0)
1033
- }), MaterialDynamicColors.tertiaryFixedDim = DynamicColor.fromPalette({
1034
- name: "tertiary_fixed_dim",
1035
- palette: s => s.tertiaryPalette,
1036
- tone: s => isMonochrome(s) ? 30 : 80,
1037
- isBackground: !0,
1038
- background: s => MaterialDynamicColors.highestSurface(s),
1039
- contrastCurve: new ContrastCurve(1, 1, 3, 7),
1040
- toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.tertiaryFixed, MaterialDynamicColors.tertiaryFixedDim, 10, "lighter", !0)
1041
- }), MaterialDynamicColors.onTertiaryFixed = DynamicColor.fromPalette({
1042
- name: "on_tertiary_fixed",
1043
- palette: s => s.tertiaryPalette,
1044
- tone: s => isMonochrome(s) ? 100 : 10,
1045
- background: s => MaterialDynamicColors.tertiaryFixedDim,
1046
- secondBackground: s => MaterialDynamicColors.tertiaryFixed,
1047
- contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
1048
- }), MaterialDynamicColors.onTertiaryFixedVariant = DynamicColor.fromPalette({
1049
- name: "on_tertiary_fixed_variant",
1050
- palette: s => s.tertiaryPalette,
1051
- tone: s => isMonochrome(s) ? 90 : 30,
1052
- background: s => MaterialDynamicColors.tertiaryFixedDim,
1053
- secondBackground: s => MaterialDynamicColors.tertiaryFixed,
1054
- contrastCurve: new ContrastCurve(3, 4.5, 7, 11)
1055
- });
1056
- class TonalPalette {
1057
- static fromInt(argb) {
1058
- const hct = Hct.fromInt(argb);
1059
- return TonalPalette.fromHct(hct);
1512
+ function getCurve(defaultContrast) {
1513
+ return 1.5 === defaultContrast ? new ContrastCurve(1.5, 1.5, 3, 4.5) : 3 === defaultContrast ? new ContrastCurve(3, 3, 4.5, 7) : 4.5 === defaultContrast ? new ContrastCurve(4.5, 4.5, 7, 11) : 6 === defaultContrast ? new ContrastCurve(6, 6, 7, 11) : 7 === defaultContrast ? new ContrastCurve(7, 7, 11, 21) : 9 === defaultContrast ? new ContrastCurve(9, 9, 11, 21) : 11 === defaultContrast ? new ContrastCurve(11, 11, 21, 21) : 21 === defaultContrast ? new ContrastCurve(21, 21, 21, 21) : new ContrastCurve(defaultContrast, defaultContrast, 7, 21);
1514
+ }
1515
+ class ColorSpecDelegateImpl2025 extends ColorSpecDelegateImpl2021 {
1516
+ surface() {
1517
+ const color2025 = DynamicColor.fromPalette({
1518
+ name: "surface",
1519
+ palette: s => s.neutralPalette,
1520
+ tone: s => (super.surface().tone(s), "phone" === s.platform ? s.isDark ? 4 : Hct.isYellow(s.neutralPalette.hue) ? 99 : s.variant === Variant.VIBRANT ? 97 : 98 : 0),
1521
+ isBackground: !0
1522
+ });
1523
+ return extendSpecVersion(super.surface(), "2025", color2025);
1524
+ }
1525
+ surfaceDim() {
1526
+ const color2025 = DynamicColor.fromPalette({
1527
+ name: "surface_dim",
1528
+ palette: s => s.neutralPalette,
1529
+ tone: s => s.isDark ? 4 : Hct.isYellow(s.neutralPalette.hue) ? 90 : s.variant === Variant.VIBRANT ? 85 : 87,
1530
+ isBackground: !0,
1531
+ chromaMultiplier: s => {
1532
+ if (!s.isDark) {
1533
+ if (s.variant === Variant.NEUTRAL) return 2.5;
1534
+ if (s.variant === Variant.TONAL_SPOT) return 1.7;
1535
+ if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? 2.7 : 1.75;
1536
+ if (s.variant === Variant.VIBRANT) return 1.36;
1537
+ }
1538
+ return 1;
1539
+ }
1540
+ });
1541
+ return extendSpecVersion(super.surfaceDim(), "2025", color2025);
1542
+ }
1543
+ surfaceBright() {
1544
+ const color2025 = DynamicColor.fromPalette({
1545
+ name: "surface_bright",
1546
+ palette: s => s.neutralPalette,
1547
+ tone: s => s.isDark ? 18 : Hct.isYellow(s.neutralPalette.hue) ? 99 : s.variant === Variant.VIBRANT ? 97 : 98,
1548
+ isBackground: !0,
1549
+ chromaMultiplier: s => {
1550
+ if (s.isDark) {
1551
+ if (s.variant === Variant.NEUTRAL) return 2.5;
1552
+ if (s.variant === Variant.TONAL_SPOT) return 1.7;
1553
+ if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? 2.7 : 1.75;
1554
+ if (s.variant === Variant.VIBRANT) return 1.36;
1555
+ }
1556
+ return 1;
1557
+ }
1558
+ });
1559
+ return extendSpecVersion(super.surfaceBright(), "2025", color2025);
1560
+ }
1561
+ surfaceContainerLowest() {
1562
+ const color2025 = DynamicColor.fromPalette({
1563
+ name: "surface_container_lowest",
1564
+ palette: s => s.neutralPalette,
1565
+ tone: s => s.isDark ? 0 : 100,
1566
+ isBackground: !0
1567
+ });
1568
+ return extendSpecVersion(super.surfaceContainerLowest(), "2025", color2025);
1569
+ }
1570
+ surfaceContainerLow() {
1571
+ const color2025 = DynamicColor.fromPalette({
1572
+ name: "surface_container_low",
1573
+ palette: s => s.neutralPalette,
1574
+ tone: s => "phone" === s.platform ? s.isDark ? 6 : Hct.isYellow(s.neutralPalette.hue) ? 98 : s.variant === Variant.VIBRANT ? 95 : 96 : 15,
1575
+ isBackground: !0,
1576
+ chromaMultiplier: s => {
1577
+ if ("phone" === s.platform) {
1578
+ if (s.variant === Variant.NEUTRAL) return 1.3;
1579
+ if (s.variant === Variant.TONAL_SPOT) return 1.25;
1580
+ if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? 1.3 : 1.15;
1581
+ if (s.variant === Variant.VIBRANT) return 1.08;
1582
+ }
1583
+ return 1;
1584
+ }
1585
+ });
1586
+ return extendSpecVersion(super.surfaceContainerLow(), "2025", color2025);
1587
+ }
1588
+ surfaceContainer() {
1589
+ const color2025 = DynamicColor.fromPalette({
1590
+ name: "surface_container",
1591
+ palette: s => s.neutralPalette,
1592
+ tone: s => "phone" === s.platform ? s.isDark ? 9 : Hct.isYellow(s.neutralPalette.hue) ? 96 : s.variant === Variant.VIBRANT ? 92 : 94 : 20,
1593
+ isBackground: !0,
1594
+ chromaMultiplier: s => {
1595
+ if ("phone" === s.platform) {
1596
+ if (s.variant === Variant.NEUTRAL) return 1.6;
1597
+ if (s.variant === Variant.TONAL_SPOT) return 1.4;
1598
+ if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? 1.6 : 1.3;
1599
+ if (s.variant === Variant.VIBRANT) return 1.15;
1600
+ }
1601
+ return 1;
1602
+ }
1603
+ });
1604
+ return extendSpecVersion(super.surfaceContainer(), "2025", color2025);
1605
+ }
1606
+ surfaceContainerHigh() {
1607
+ const color2025 = DynamicColor.fromPalette({
1608
+ name: "surface_container_high",
1609
+ palette: s => s.neutralPalette,
1610
+ tone: s => "phone" === s.platform ? s.isDark ? 12 : Hct.isYellow(s.neutralPalette.hue) ? 94 : s.variant === Variant.VIBRANT ? 90 : 92 : 25,
1611
+ isBackground: !0,
1612
+ chromaMultiplier: s => {
1613
+ if ("phone" === s.platform) {
1614
+ if (s.variant === Variant.NEUTRAL) return 1.9;
1615
+ if (s.variant === Variant.TONAL_SPOT) return 1.5;
1616
+ if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? 1.95 : 1.45;
1617
+ if (s.variant === Variant.VIBRANT) return 1.22;
1618
+ }
1619
+ return 1;
1620
+ }
1621
+ });
1622
+ return extendSpecVersion(super.surfaceContainerHigh(), "2025", color2025);
1623
+ }
1624
+ surfaceContainerHighest() {
1625
+ const color2025 = DynamicColor.fromPalette({
1626
+ name: "surface_container_highest",
1627
+ palette: s => s.neutralPalette,
1628
+ tone: s => s.isDark ? 15 : Hct.isYellow(s.neutralPalette.hue) ? 92 : s.variant === Variant.VIBRANT ? 88 : 90,
1629
+ isBackground: !0,
1630
+ chromaMultiplier: s => s.variant === Variant.NEUTRAL ? 2.2 : s.variant === Variant.TONAL_SPOT ? 1.7 : s.variant === Variant.EXPRESSIVE ? Hct.isYellow(s.neutralPalette.hue) ? 2.3 : 1.6 : s.variant === Variant.VIBRANT ? 1.29 : 1
1631
+ });
1632
+ return extendSpecVersion(super.surfaceContainerHighest(), "2025", color2025);
1633
+ }
1634
+ onSurface() {
1635
+ const color2025 = DynamicColor.fromPalette({
1636
+ name: "on_surface",
1637
+ palette: s => s.neutralPalette,
1638
+ tone: s => s.variant === Variant.VIBRANT ? tMaxC(s.neutralPalette, 0, 100, 1.1) : DynamicColor.getInitialToneFromBackground(s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh())(s),
1639
+ chromaMultiplier: s => {
1640
+ if ("phone" === s.platform) {
1641
+ if (s.variant === Variant.NEUTRAL) return 2.2;
1642
+ if (s.variant === Variant.TONAL_SPOT) return 1.7;
1643
+ if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? s.isDark ? 3 : 2.3 : 1.6;
1644
+ }
1645
+ return 1;
1646
+ },
1647
+ background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
1648
+ contrastCurve: s => s.isDark ? getCurve(11) : getCurve(9)
1649
+ });
1650
+ return extendSpecVersion(super.onSurface(), "2025", color2025);
1651
+ }
1652
+ onSurfaceVariant() {
1653
+ const color2025 = DynamicColor.fromPalette({
1654
+ name: "on_surface_variant",
1655
+ palette: s => s.neutralPalette,
1656
+ chromaMultiplier: s => {
1657
+ if ("phone" === s.platform) {
1658
+ if (s.variant === Variant.NEUTRAL) return 2.2;
1659
+ if (s.variant === Variant.TONAL_SPOT) return 1.7;
1660
+ if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? s.isDark ? 3 : 2.3 : 1.6;
1661
+ }
1662
+ return 1;
1663
+ },
1664
+ background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
1665
+ contrastCurve: s => "phone" === s.platform ? s.isDark ? getCurve(6) : getCurve(4.5) : getCurve(7)
1666
+ });
1667
+ return extendSpecVersion(super.onSurfaceVariant(), "2025", color2025);
1668
+ }
1669
+ outline() {
1670
+ const color2025 = DynamicColor.fromPalette({
1671
+ name: "outline",
1672
+ palette: s => s.neutralPalette,
1673
+ chromaMultiplier: s => {
1674
+ if ("phone" === s.platform) {
1675
+ if (s.variant === Variant.NEUTRAL) return 2.2;
1676
+ if (s.variant === Variant.TONAL_SPOT) return 1.7;
1677
+ if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? s.isDark ? 3 : 2.3 : 1.6;
1678
+ }
1679
+ return 1;
1680
+ },
1681
+ background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
1682
+ contrastCurve: s => "phone" === s.platform ? getCurve(3) : getCurve(4.5)
1683
+ });
1684
+ return extendSpecVersion(super.outline(), "2025", color2025);
1685
+ }
1686
+ outlineVariant() {
1687
+ const color2025 = DynamicColor.fromPalette({
1688
+ name: "outline_variant",
1689
+ palette: s => s.neutralPalette,
1690
+ chromaMultiplier: s => {
1691
+ if ("phone" === s.platform) {
1692
+ if (s.variant === Variant.NEUTRAL) return 2.2;
1693
+ if (s.variant === Variant.TONAL_SPOT) return 1.7;
1694
+ if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? s.isDark ? 3 : 2.3 : 1.6;
1695
+ }
1696
+ return 1;
1697
+ },
1698
+ background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
1699
+ contrastCurve: s => "phone" === s.platform ? getCurve(1.5) : getCurve(3)
1700
+ });
1701
+ return extendSpecVersion(super.outlineVariant(), "2025", color2025);
1702
+ }
1703
+ inverseSurface() {
1704
+ const color2025 = DynamicColor.fromPalette({
1705
+ name: "inverse_surface",
1706
+ palette: s => s.neutralPalette,
1707
+ tone: s => s.isDark ? 98 : 4,
1708
+ isBackground: !0
1709
+ });
1710
+ return extendSpecVersion(super.inverseSurface(), "2025", color2025);
1711
+ }
1712
+ inverseOnSurface() {
1713
+ const color2025 = DynamicColor.fromPalette({
1714
+ name: "inverse_on_surface",
1715
+ palette: s => s.neutralPalette,
1716
+ background: s => this.inverseSurface(),
1717
+ contrastCurve: s => getCurve(7)
1718
+ });
1719
+ return extendSpecVersion(super.inverseOnSurface(), "2025", color2025);
1720
+ }
1721
+ primary() {
1722
+ const color2025 = DynamicColor.fromPalette({
1723
+ name: "primary",
1724
+ palette: s => s.primaryPalette,
1725
+ tone: s => s.variant === Variant.NEUTRAL ? "phone" === s.platform ? s.isDark ? 80 : 40 : 90 : s.variant === Variant.TONAL_SPOT ? "phone" === s.platform ? s.isDark ? 80 : tMaxC(s.primaryPalette) : tMaxC(s.primaryPalette, 0, 90) : s.variant === Variant.EXPRESSIVE ? tMaxC(s.primaryPalette, 0, Hct.isYellow(s.primaryPalette.hue) ? 25 : Hct.isCyan(s.primaryPalette.hue) ? 88 : 98) : tMaxC(s.primaryPalette, 0, Hct.isCyan(s.primaryPalette.hue) ? 88 : 98),
1726
+ isBackground: !0,
1727
+ background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
1728
+ contrastCurve: s => "phone" === s.platform ? getCurve(4.5) : getCurve(7),
1729
+ toneDeltaPair: s => "phone" === s.platform ? new ToneDeltaPair(this.primaryContainer(), this.primary(), 5, "relative_lighter", !0, "farther") : void 0
1730
+ });
1731
+ return extendSpecVersion(super.primary(), "2025", color2025);
1732
+ }
1733
+ primaryDim() {
1734
+ return DynamicColor.fromPalette({
1735
+ name: "primary_dim",
1736
+ palette: s => s.primaryPalette,
1737
+ tone: s => s.variant === Variant.NEUTRAL ? 85 : s.variant === Variant.TONAL_SPOT ? tMaxC(s.primaryPalette, 0, 90) : tMaxC(s.primaryPalette),
1738
+ isBackground: !0,
1739
+ background: s => this.surfaceContainerHigh(),
1740
+ contrastCurve: s => getCurve(4.5),
1741
+ toneDeltaPair: s => new ToneDeltaPair(this.primaryDim(), this.primary(), 5, "darker", !0, "farther")
1742
+ });
1060
1743
  }
1061
- static fromHct(hct) {
1062
- return new TonalPalette(hct.hue, hct.chroma, hct);
1744
+ onPrimary() {
1745
+ const color2025 = DynamicColor.fromPalette({
1746
+ name: "on_primary",
1747
+ palette: s => s.primaryPalette,
1748
+ background: s => "phone" === s.platform ? this.primary() : this.primaryDim(),
1749
+ contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
1750
+ });
1751
+ return extendSpecVersion(super.onPrimary(), "2025", color2025);
1752
+ }
1753
+ primaryContainer() {
1754
+ const color2025 = DynamicColor.fromPalette({
1755
+ name: "primary_container",
1756
+ palette: s => s.primaryPalette,
1757
+ tone: s => "watch" === s.platform ? 30 : s.variant === Variant.NEUTRAL ? s.isDark ? 30 : 90 : s.variant === Variant.TONAL_SPOT ? s.isDark ? tMinC(s.primaryPalette, 35, 93) : tMaxC(s.primaryPalette, 0, 90) : s.variant === Variant.EXPRESSIVE ? s.isDark ? tMaxC(s.primaryPalette, 30, 93) : tMaxC(s.primaryPalette, 78, Hct.isCyan(s.primaryPalette.hue) ? 88 : 90) : s.isDark ? tMinC(s.primaryPalette, 66, 93) : tMaxC(s.primaryPalette, 66, Hct.isCyan(s.primaryPalette.hue) ? 88 : 93),
1758
+ isBackground: !0,
1759
+ background: s => "phone" === s.platform ? this.highestSurface(s) : void 0,
1760
+ toneDeltaPair: s => "phone" === s.platform ? void 0 : new ToneDeltaPair(this.primaryContainer(), this.primaryDim(), 10, "darker", !0, "farther"),
1761
+ contrastCurve: s => "phone" === s.platform && s.contrastLevel > 0 ? getCurve(1.5) : void 0
1762
+ });
1763
+ return extendSpecVersion(super.primaryContainer(), "2025", color2025);
1764
+ }
1765
+ onPrimaryContainer() {
1766
+ const color2025 = DynamicColor.fromPalette({
1767
+ name: "on_primary_container",
1768
+ palette: s => s.primaryPalette,
1769
+ background: s => this.primaryContainer(),
1770
+ contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
1771
+ });
1772
+ return extendSpecVersion(super.onPrimaryContainer(), "2025", color2025);
1773
+ }
1774
+ primaryFixed() {
1775
+ const color2025 = DynamicColor.fromPalette({
1776
+ name: "primary_fixed",
1777
+ palette: s => s.primaryPalette,
1778
+ tone: s => {
1779
+ let tempS = Object.assign({}, s, {
1780
+ isDark: !1,
1781
+ contrastLevel: 0
1782
+ });
1783
+ return this.primaryContainer().getTone(tempS);
1784
+ },
1785
+ isBackground: !0,
1786
+ background: s => "phone" === s.platform ? this.highestSurface(s) : void 0,
1787
+ contrastCurve: s => "phone" === s.platform && s.contrastLevel > 0 ? getCurve(1.5) : void 0
1788
+ });
1789
+ return extendSpecVersion(super.primaryFixed(), "2025", color2025);
1790
+ }
1791
+ primaryFixedDim() {
1792
+ const color2025 = DynamicColor.fromPalette({
1793
+ name: "primary_fixed_dim",
1794
+ palette: s => s.primaryPalette,
1795
+ tone: s => this.primaryFixed().getTone(s),
1796
+ isBackground: !0,
1797
+ toneDeltaPair: s => new ToneDeltaPair(this.primaryFixedDim(), this.primaryFixed(), 5, "darker", !0, "exact")
1798
+ });
1799
+ return extendSpecVersion(super.primaryFixedDim(), "2025", color2025);
1800
+ }
1801
+ onPrimaryFixed() {
1802
+ const color2025 = DynamicColor.fromPalette({
1803
+ name: "on_primary_fixed",
1804
+ palette: s => s.primaryPalette,
1805
+ background: s => this.primaryFixedDim(),
1806
+ contrastCurve: s => getCurve(7)
1807
+ });
1808
+ return extendSpecVersion(super.onPrimaryFixed(), "2025", color2025);
1809
+ }
1810
+ onPrimaryFixedVariant() {
1811
+ const color2025 = DynamicColor.fromPalette({
1812
+ name: "on_primary_fixed_variant",
1813
+ palette: s => s.primaryPalette,
1814
+ background: s => this.primaryFixedDim(),
1815
+ contrastCurve: s => getCurve(4.5)
1816
+ });
1817
+ return extendSpecVersion(super.onPrimaryFixedVariant(), "2025", color2025);
1818
+ }
1819
+ inversePrimary() {
1820
+ const color2025 = DynamicColor.fromPalette({
1821
+ name: "inverse_primary",
1822
+ palette: s => s.primaryPalette,
1823
+ tone: s => tMaxC(s.primaryPalette),
1824
+ background: s => this.inverseSurface(),
1825
+ contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
1826
+ });
1827
+ return extendSpecVersion(super.inversePrimary(), "2025", color2025);
1828
+ }
1829
+ secondary() {
1830
+ const color2025 = DynamicColor.fromPalette({
1831
+ name: "secondary",
1832
+ palette: s => s.secondaryPalette,
1833
+ tone: s => "watch" === s.platform ? s.variant === Variant.NEUTRAL ? 90 : tMaxC(s.secondaryPalette, 0, 90) : s.variant === Variant.NEUTRAL ? s.isDark ? tMinC(s.secondaryPalette, 0, 98) : tMaxC(s.secondaryPalette) : s.variant === Variant.VIBRANT ? tMaxC(s.secondaryPalette, 0, s.isDark ? 90 : 98) : s.isDark ? 80 : tMaxC(s.secondaryPalette),
1834
+ isBackground: !0,
1835
+ background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
1836
+ contrastCurve: s => "phone" === s.platform ? getCurve(4.5) : getCurve(7),
1837
+ toneDeltaPair: s => "phone" === s.platform ? new ToneDeltaPair(this.secondaryContainer(), this.secondary(), 5, "relative_lighter", !0, "farther") : void 0
1838
+ });
1839
+ return extendSpecVersion(super.secondary(), "2025", color2025);
1840
+ }
1841
+ secondaryDim() {
1842
+ return DynamicColor.fromPalette({
1843
+ name: "secondary_dim",
1844
+ palette: s => s.secondaryPalette,
1845
+ tone: s => s.variant === Variant.NEUTRAL ? 85 : tMaxC(s.secondaryPalette, 0, 90),
1846
+ isBackground: !0,
1847
+ background: s => this.surfaceContainerHigh(),
1848
+ contrastCurve: s => getCurve(4.5),
1849
+ toneDeltaPair: s => new ToneDeltaPair(this.secondaryDim(), this.secondary(), 5, "darker", !0, "farther")
1850
+ });
1063
1851
  }
1064
- static fromHueAndChroma(hue, chroma) {
1065
- return new TonalPalette(hue, chroma, TonalPalette.createKeyColor(hue, chroma));
1852
+ onSecondary() {
1853
+ const color2025 = DynamicColor.fromPalette({
1854
+ name: "on_secondary",
1855
+ palette: s => s.secondaryPalette,
1856
+ background: s => "phone" === s.platform ? this.secondary() : this.secondaryDim(),
1857
+ contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
1858
+ });
1859
+ return extendSpecVersion(super.onSecondary(), "2025", color2025);
1860
+ }
1861
+ secondaryContainer() {
1862
+ const color2025 = DynamicColor.fromPalette({
1863
+ name: "secondary_container",
1864
+ palette: s => s.secondaryPalette,
1865
+ tone: s => "watch" === s.platform ? 30 : s.variant === Variant.VIBRANT ? s.isDark ? tMinC(s.secondaryPalette, 30, 40) : tMaxC(s.secondaryPalette, 84, 90) : s.variant === Variant.EXPRESSIVE ? s.isDark ? 15 : tMaxC(s.secondaryPalette, 90, 95) : s.isDark ? 25 : 90,
1866
+ isBackground: !0,
1867
+ background: s => "phone" === s.platform ? this.highestSurface(s) : void 0,
1868
+ toneDeltaPair: s => "watch" === s.platform ? new ToneDeltaPair(this.secondaryContainer(), this.secondaryDim(), 10, "darker", !0, "farther") : void 0,
1869
+ contrastCurve: s => "phone" === s.platform && s.contrastLevel > 0 ? getCurve(1.5) : void 0
1870
+ });
1871
+ return extendSpecVersion(super.secondaryContainer(), "2025", color2025);
1872
+ }
1873
+ onSecondaryContainer() {
1874
+ const color2025 = DynamicColor.fromPalette({
1875
+ name: "on_secondary_container",
1876
+ palette: s => s.secondaryPalette,
1877
+ background: s => this.secondaryContainer(),
1878
+ contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
1879
+ });
1880
+ return extendSpecVersion(super.onSecondaryContainer(), "2025", color2025);
1881
+ }
1882
+ secondaryFixed() {
1883
+ const color2025 = DynamicColor.fromPalette({
1884
+ name: "secondary_fixed",
1885
+ palette: s => s.secondaryPalette,
1886
+ tone: s => {
1887
+ let tempS = Object.assign({}, s, {
1888
+ isDark: !1,
1889
+ contrastLevel: 0
1890
+ });
1891
+ return this.secondaryContainer().getTone(tempS);
1892
+ },
1893
+ isBackground: !0,
1894
+ background: s => "phone" === s.platform ? this.highestSurface(s) : void 0,
1895
+ contrastCurve: s => "phone" === s.platform && s.contrastLevel > 0 ? getCurve(1.5) : void 0
1896
+ });
1897
+ return extendSpecVersion(super.secondaryFixed(), "2025", color2025);
1898
+ }
1899
+ secondaryFixedDim() {
1900
+ const color2025 = DynamicColor.fromPalette({
1901
+ name: "secondary_fixed_dim",
1902
+ palette: s => s.secondaryPalette,
1903
+ tone: s => this.secondaryFixed().getTone(s),
1904
+ isBackground: !0,
1905
+ toneDeltaPair: s => new ToneDeltaPair(this.secondaryFixedDim(), this.secondaryFixed(), 5, "darker", !0, "exact")
1906
+ });
1907
+ return extendSpecVersion(super.secondaryFixedDim(), "2025", color2025);
1908
+ }
1909
+ onSecondaryFixed() {
1910
+ const color2025 = DynamicColor.fromPalette({
1911
+ name: "on_secondary_fixed",
1912
+ palette: s => s.secondaryPalette,
1913
+ background: s => this.secondaryFixedDim(),
1914
+ contrastCurve: s => getCurve(7)
1915
+ });
1916
+ return extendSpecVersion(super.onSecondaryFixed(), "2025", color2025);
1917
+ }
1918
+ onSecondaryFixedVariant() {
1919
+ const color2025 = DynamicColor.fromPalette({
1920
+ name: "on_secondary_fixed_variant",
1921
+ palette: s => s.secondaryPalette,
1922
+ background: s => this.secondaryFixedDim(),
1923
+ contrastCurve: s => getCurve(4.5)
1924
+ });
1925
+ return extendSpecVersion(super.onSecondaryFixedVariant(), "2025", color2025);
1926
+ }
1927
+ tertiary() {
1928
+ const color2025 = DynamicColor.fromPalette({
1929
+ name: "tertiary",
1930
+ palette: s => s.tertiaryPalette,
1931
+ tone: s => "watch" === s.platform ? s.variant === Variant.TONAL_SPOT ? tMaxC(s.tertiaryPalette, 0, 90) : tMaxC(s.tertiaryPalette) : s.variant === Variant.EXPRESSIVE || s.variant === Variant.VIBRANT ? tMaxC(s.tertiaryPalette, 0, Hct.isCyan(s.tertiaryPalette.hue) ? 88 : s.isDark ? 98 : 100) : s.isDark ? tMaxC(s.tertiaryPalette, 0, 98) : tMaxC(s.tertiaryPalette),
1932
+ isBackground: !0,
1933
+ background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
1934
+ contrastCurve: s => "phone" === s.platform ? getCurve(4.5) : getCurve(7),
1935
+ toneDeltaPair: s => "phone" === s.platform ? new ToneDeltaPair(this.tertiaryContainer(), this.tertiary(), 5, "relative_lighter", !0, "farther") : void 0
1936
+ });
1937
+ return extendSpecVersion(super.tertiary(), "2025", color2025);
1938
+ }
1939
+ tertiaryDim() {
1940
+ return DynamicColor.fromPalette({
1941
+ name: "tertiary_dim",
1942
+ palette: s => s.tertiaryPalette,
1943
+ tone: s => s.variant === Variant.TONAL_SPOT ? tMaxC(s.tertiaryPalette, 0, 90) : tMaxC(s.tertiaryPalette),
1944
+ isBackground: !0,
1945
+ background: s => this.surfaceContainerHigh(),
1946
+ contrastCurve: s => getCurve(4.5),
1947
+ toneDeltaPair: s => new ToneDeltaPair(this.tertiaryDim(), this.tertiary(), 5, "darker", !0, "farther")
1948
+ });
1066
1949
  }
1067
- constructor(hue, chroma, keyColor) {
1068
- this.hue = hue, this.chroma = chroma, this.keyColor = keyColor, this.cache = new Map();
1950
+ onTertiary() {
1951
+ const color2025 = DynamicColor.fromPalette({
1952
+ name: "on_tertiary",
1953
+ palette: s => s.tertiaryPalette,
1954
+ background: s => "phone" === s.platform ? this.tertiary() : this.tertiaryDim(),
1955
+ contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
1956
+ });
1957
+ return extendSpecVersion(super.onTertiary(), "2025", color2025);
1958
+ }
1959
+ tertiaryContainer() {
1960
+ const color2025 = DynamicColor.fromPalette({
1961
+ name: "tertiary_container",
1962
+ palette: s => s.tertiaryPalette,
1963
+ tone: s => "watch" === s.platform ? s.variant === Variant.TONAL_SPOT ? tMaxC(s.tertiaryPalette, 0, 90) : tMaxC(s.tertiaryPalette) : s.variant === Variant.NEUTRAL ? s.isDark ? tMaxC(s.tertiaryPalette, 0, 93) : tMaxC(s.tertiaryPalette, 0, 96) : s.variant === Variant.TONAL_SPOT ? tMaxC(s.tertiaryPalette, 0, s.isDark ? 93 : 100) : s.variant === Variant.EXPRESSIVE ? tMaxC(s.tertiaryPalette, 75, Hct.isCyan(s.tertiaryPalette.hue) ? 88 : s.isDark ? 93 : 100) : s.isDark ? tMaxC(s.tertiaryPalette, 0, 93) : tMaxC(s.tertiaryPalette, 72, 100),
1964
+ isBackground: !0,
1965
+ background: s => "phone" === s.platform ? this.highestSurface(s) : void 0,
1966
+ toneDeltaPair: s => "watch" === s.platform ? new ToneDeltaPair(this.tertiaryContainer(), this.tertiaryDim(), 10, "darker", !0, "farther") : void 0,
1967
+ contrastCurve: s => "phone" === s.platform && s.contrastLevel > 0 ? getCurve(1.5) : void 0
1968
+ });
1969
+ return extendSpecVersion(super.tertiaryContainer(), "2025", color2025);
1970
+ }
1971
+ onTertiaryContainer() {
1972
+ const color2025 = DynamicColor.fromPalette({
1973
+ name: "on_tertiary_container",
1974
+ palette: s => s.tertiaryPalette,
1975
+ background: s => this.tertiaryContainer(),
1976
+ contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
1977
+ });
1978
+ return extendSpecVersion(super.onTertiaryContainer(), "2025", color2025);
1979
+ }
1980
+ tertiaryFixed() {
1981
+ const color2025 = DynamicColor.fromPalette({
1982
+ name: "tertiary_fixed",
1983
+ palette: s => s.tertiaryPalette,
1984
+ tone: s => {
1985
+ let tempS = Object.assign({}, s, {
1986
+ isDark: !1,
1987
+ contrastLevel: 0
1988
+ });
1989
+ return this.tertiaryContainer().getTone(tempS);
1990
+ },
1991
+ isBackground: !0,
1992
+ background: s => "phone" === s.platform ? this.highestSurface(s) : void 0,
1993
+ contrastCurve: s => "phone" === s.platform && s.contrastLevel > 0 ? getCurve(1.5) : void 0
1994
+ });
1995
+ return extendSpecVersion(super.tertiaryFixed(), "2025", color2025);
1996
+ }
1997
+ tertiaryFixedDim() {
1998
+ const color2025 = DynamicColor.fromPalette({
1999
+ name: "tertiary_fixed_dim",
2000
+ palette: s => s.tertiaryPalette,
2001
+ tone: s => this.tertiaryFixed().getTone(s),
2002
+ isBackground: !0,
2003
+ toneDeltaPair: s => new ToneDeltaPair(this.tertiaryFixedDim(), this.tertiaryFixed(), 5, "darker", !0, "exact")
2004
+ });
2005
+ return extendSpecVersion(super.tertiaryFixedDim(), "2025", color2025);
2006
+ }
2007
+ onTertiaryFixed() {
2008
+ const color2025 = DynamicColor.fromPalette({
2009
+ name: "on_tertiary_fixed",
2010
+ palette: s => s.tertiaryPalette,
2011
+ background: s => this.tertiaryFixedDim(),
2012
+ contrastCurve: s => getCurve(7)
2013
+ });
2014
+ return extendSpecVersion(super.onTertiaryFixed(), "2025", color2025);
2015
+ }
2016
+ onTertiaryFixedVariant() {
2017
+ const color2025 = DynamicColor.fromPalette({
2018
+ name: "on_tertiary_fixed_variant",
2019
+ palette: s => s.tertiaryPalette,
2020
+ background: s => this.tertiaryFixedDim(),
2021
+ contrastCurve: s => getCurve(4.5)
2022
+ });
2023
+ return extendSpecVersion(super.onTertiaryFixedVariant(), "2025", color2025);
2024
+ }
2025
+ error() {
2026
+ const color2025 = DynamicColor.fromPalette({
2027
+ name: "error",
2028
+ palette: s => s.errorPalette,
2029
+ tone: s => "phone" === s.platform ? s.isDark ? tMinC(s.errorPalette, 0, 98) : tMaxC(s.errorPalette) : tMinC(s.errorPalette),
2030
+ isBackground: !0,
2031
+ background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
2032
+ contrastCurve: s => "phone" === s.platform ? getCurve(4.5) : getCurve(7),
2033
+ toneDeltaPair: s => "phone" === s.platform ? new ToneDeltaPair(this.errorContainer(), this.error(), 5, "relative_lighter", !0, "farther") : void 0
2034
+ });
2035
+ return extendSpecVersion(super.error(), "2025", color2025);
2036
+ }
2037
+ errorDim() {
2038
+ return DynamicColor.fromPalette({
2039
+ name: "error_dim",
2040
+ palette: s => s.errorPalette,
2041
+ tone: s => tMinC(s.errorPalette),
2042
+ isBackground: !0,
2043
+ background: s => this.surfaceContainerHigh(),
2044
+ contrastCurve: s => getCurve(4.5),
2045
+ toneDeltaPair: s => new ToneDeltaPair(this.errorDim(), this.error(), 5, "darker", !0, "farther")
2046
+ });
1069
2047
  }
1070
- static createKeyColor(hue, chroma) {
1071
- let smallestDeltaHct = Hct.from(hue, chroma, 50),
1072
- smallestDelta = Math.abs(smallestDeltaHct.chroma - chroma);
1073
- for (let delta = 1; delta < 50; delta += 1) {
1074
- if (Math.round(chroma) === Math.round(smallestDeltaHct.chroma)) return smallestDeltaHct;
1075
- const hctAdd = Hct.from(hue, chroma, 50 + delta),
1076
- hctAddDelta = Math.abs(hctAdd.chroma - chroma);
1077
- hctAddDelta < smallestDelta && (smallestDelta = hctAddDelta, smallestDeltaHct = hctAdd);
1078
- const hctSubtract = Hct.from(hue, chroma, 50 - delta),
1079
- hctSubtractDelta = Math.abs(hctSubtract.chroma - chroma);
1080
- hctSubtractDelta < smallestDelta && (smallestDelta = hctSubtractDelta, smallestDeltaHct = hctSubtract);
1081
- }
1082
- return smallestDeltaHct;
2048
+ onError() {
2049
+ const color2025 = DynamicColor.fromPalette({
2050
+ name: "on_error",
2051
+ palette: s => s.errorPalette,
2052
+ background: s => "phone" === s.platform ? this.error() : this.errorDim(),
2053
+ contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
2054
+ });
2055
+ return extendSpecVersion(super.onError(), "2025", color2025);
2056
+ }
2057
+ errorContainer() {
2058
+ const color2025 = DynamicColor.fromPalette({
2059
+ name: "error_container",
2060
+ palette: s => s.errorPalette,
2061
+ tone: s => "watch" === s.platform ? 30 : s.isDark ? tMinC(s.errorPalette, 30, 93) : tMaxC(s.errorPalette, 0, 90),
2062
+ isBackground: !0,
2063
+ background: s => "phone" === s.platform ? this.highestSurface(s) : void 0,
2064
+ toneDeltaPair: s => "watch" === s.platform ? new ToneDeltaPair(this.errorContainer(), this.errorDim(), 10, "darker", !0, "farther") : void 0,
2065
+ contrastCurve: s => "phone" === s.platform && s.contrastLevel > 0 ? getCurve(1.5) : void 0
2066
+ });
2067
+ return extendSpecVersion(super.errorContainer(), "2025", color2025);
2068
+ }
2069
+ onErrorContainer() {
2070
+ const color2025 = DynamicColor.fromPalette({
2071
+ name: "on_error_container",
2072
+ palette: s => s.errorPalette,
2073
+ background: s => this.errorContainer(),
2074
+ contrastCurve: s => "phone" === s.platform ? getCurve(4.5) : getCurve(7)
2075
+ });
2076
+ return extendSpecVersion(super.onErrorContainer(), "2025", color2025);
1083
2077
  }
1084
- tone(tone) {
1085
- let argb = this.cache.get(tone);
1086
- return void 0 === argb && (argb = Hct.from(this.hue, this.chroma, tone).toInt(), this.cache.set(tone, argb)), argb;
2078
+ surfaceVariant() {
2079
+ const color2025 = Object.assign(this.surfaceContainerHighest().clone(), {
2080
+ name: "surface_variant"
2081
+ });
2082
+ return extendSpecVersion(super.surfaceVariant(), "2025", color2025);
1087
2083
  }
1088
- getHct(tone) {
1089
- return Hct.fromInt(this.tone(tone));
2084
+ surfaceTint() {
2085
+ const color2025 = Object.assign(this.primary().clone(), {
2086
+ name: "surface_tint"
2087
+ });
2088
+ return extendSpecVersion(super.surfaceTint(), "2025", color2025);
2089
+ }
2090
+ background() {
2091
+ const color2025 = Object.assign(this.surface().clone(), {
2092
+ name: "background"
2093
+ });
2094
+ return extendSpecVersion(super.background(), "2025", color2025);
2095
+ }
2096
+ onBackground() {
2097
+ const color2025 = Object.assign(this.onSurface().clone(), {
2098
+ name: "on_background"
2099
+ });
2100
+ return extendSpecVersion(super.onBackground(), "2025", color2025);
1090
2101
  }
1091
2102
  }
1092
- class CorePalette {
1093
- static of(argb) {
1094
- return new CorePalette(argb, !1);
2103
+ class MaterialDynamicColors {
2104
+ constructor() {
2105
+ this.allColors = [this.background(), this.onBackground(), this.surface(), this.surfaceDim(), this.surfaceBright(), this.surfaceContainerLowest(), this.surfaceContainerLow(), this.surfaceContainer(), this.surfaceContainerHigh(), this.surfaceContainerHighest(), this.onSurface(), this.onSurfaceVariant(), this.outline(), this.outlineVariant(), this.inverseSurface(), this.inverseOnSurface(), this.primary(), this.primaryDim(), this.onPrimary(), this.primaryContainer(), this.onPrimaryContainer(), this.primaryFixed(), this.primaryFixedDim(), this.onPrimaryFixed(), this.onPrimaryFixedVariant(), this.inversePrimary(), this.secondary(), this.secondaryDim(), this.onSecondary(), this.secondaryContainer(), this.onSecondaryContainer(), this.secondaryFixed(), this.secondaryFixedDim(), this.onSecondaryFixed(), this.onSecondaryFixedVariant(), this.tertiary(), this.tertiaryDim(), this.onTertiary(), this.tertiaryContainer(), this.onTertiaryContainer(), this.tertiaryFixed(), this.tertiaryFixedDim(), this.onTertiaryFixed(), this.onTertiaryFixedVariant(), this.error(), this.errorDim(), this.onError(), this.errorContainer(), this.onErrorContainer()].filter(c => void 0 !== c);
1095
2106
  }
1096
- static contentOf(argb) {
1097
- return new CorePalette(argb, !0);
2107
+ highestSurface(s) {
2108
+ return MaterialDynamicColors.colorSpec.highestSurface(s);
1098
2109
  }
1099
- static fromColors(colors) {
1100
- return CorePalette.createPaletteFromColors(!1, colors);
2110
+ primaryPaletteKeyColor() {
2111
+ return MaterialDynamicColors.colorSpec.primaryPaletteKeyColor();
1101
2112
  }
1102
- static contentFromColors(colors) {
1103
- return CorePalette.createPaletteFromColors(!0, colors);
2113
+ secondaryPaletteKeyColor() {
2114
+ return MaterialDynamicColors.colorSpec.secondaryPaletteKeyColor();
1104
2115
  }
1105
- static createPaletteFromColors(content, colors) {
1106
- const palette = new CorePalette(colors.primary, content);
1107
- if (colors.secondary) {
1108
- const p = new CorePalette(colors.secondary, content);
1109
- palette.a2 = p.a1;
1110
- }
1111
- if (colors.tertiary) {
1112
- const p = new CorePalette(colors.tertiary, content);
1113
- palette.a3 = p.a1;
1114
- }
1115
- if (colors.error) {
1116
- const p = new CorePalette(colors.error, content);
1117
- palette.error = p.a1;
1118
- }
1119
- if (colors.neutral) {
1120
- const p = new CorePalette(colors.neutral, content);
1121
- palette.n1 = p.n1;
1122
- }
1123
- if (colors.neutralVariant) {
1124
- const p = new CorePalette(colors.neutralVariant, content);
1125
- palette.n2 = p.n2;
1126
- }
1127
- return palette;
2116
+ tertiaryPaletteKeyColor() {
2117
+ return MaterialDynamicColors.colorSpec.tertiaryPaletteKeyColor();
2118
+ }
2119
+ neutralPaletteKeyColor() {
2120
+ return MaterialDynamicColors.colorSpec.neutralPaletteKeyColor();
2121
+ }
2122
+ neutralVariantPaletteKeyColor() {
2123
+ return MaterialDynamicColors.colorSpec.neutralVariantPaletteKeyColor();
2124
+ }
2125
+ errorPaletteKeyColor() {
2126
+ return MaterialDynamicColors.colorSpec.errorPaletteKeyColor();
2127
+ }
2128
+ background() {
2129
+ return MaterialDynamicColors.colorSpec.background();
2130
+ }
2131
+ onBackground() {
2132
+ return MaterialDynamicColors.colorSpec.onBackground();
2133
+ }
2134
+ surface() {
2135
+ return MaterialDynamicColors.colorSpec.surface();
2136
+ }
2137
+ surfaceDim() {
2138
+ return MaterialDynamicColors.colorSpec.surfaceDim();
2139
+ }
2140
+ surfaceBright() {
2141
+ return MaterialDynamicColors.colorSpec.surfaceBright();
2142
+ }
2143
+ surfaceContainerLowest() {
2144
+ return MaterialDynamicColors.colorSpec.surfaceContainerLowest();
2145
+ }
2146
+ surfaceContainerLow() {
2147
+ return MaterialDynamicColors.colorSpec.surfaceContainerLow();
2148
+ }
2149
+ surfaceContainer() {
2150
+ return MaterialDynamicColors.colorSpec.surfaceContainer();
2151
+ }
2152
+ surfaceContainerHigh() {
2153
+ return MaterialDynamicColors.colorSpec.surfaceContainerHigh();
2154
+ }
2155
+ surfaceContainerHighest() {
2156
+ return MaterialDynamicColors.colorSpec.surfaceContainerHighest();
2157
+ }
2158
+ onSurface() {
2159
+ return MaterialDynamicColors.colorSpec.onSurface();
2160
+ }
2161
+ surfaceVariant() {
2162
+ return MaterialDynamicColors.colorSpec.surfaceVariant();
2163
+ }
2164
+ onSurfaceVariant() {
2165
+ return MaterialDynamicColors.colorSpec.onSurfaceVariant();
2166
+ }
2167
+ outline() {
2168
+ return MaterialDynamicColors.colorSpec.outline();
2169
+ }
2170
+ outlineVariant() {
2171
+ return MaterialDynamicColors.colorSpec.outlineVariant();
2172
+ }
2173
+ inverseSurface() {
2174
+ return MaterialDynamicColors.colorSpec.inverseSurface();
2175
+ }
2176
+ inverseOnSurface() {
2177
+ return MaterialDynamicColors.colorSpec.inverseOnSurface();
2178
+ }
2179
+ shadow() {
2180
+ return MaterialDynamicColors.colorSpec.shadow();
2181
+ }
2182
+ scrim() {
2183
+ return MaterialDynamicColors.colorSpec.scrim();
2184
+ }
2185
+ surfaceTint() {
2186
+ return MaterialDynamicColors.colorSpec.surfaceTint();
2187
+ }
2188
+ primary() {
2189
+ return MaterialDynamicColors.colorSpec.primary();
2190
+ }
2191
+ primaryDim() {
2192
+ return MaterialDynamicColors.colorSpec.primaryDim();
2193
+ }
2194
+ onPrimary() {
2195
+ return MaterialDynamicColors.colorSpec.onPrimary();
2196
+ }
2197
+ primaryContainer() {
2198
+ return MaterialDynamicColors.colorSpec.primaryContainer();
2199
+ }
2200
+ onPrimaryContainer() {
2201
+ return MaterialDynamicColors.colorSpec.onPrimaryContainer();
2202
+ }
2203
+ inversePrimary() {
2204
+ return MaterialDynamicColors.colorSpec.inversePrimary();
2205
+ }
2206
+ primaryFixed() {
2207
+ return MaterialDynamicColors.colorSpec.primaryFixed();
2208
+ }
2209
+ primaryFixedDim() {
2210
+ return MaterialDynamicColors.colorSpec.primaryFixedDim();
2211
+ }
2212
+ onPrimaryFixed() {
2213
+ return MaterialDynamicColors.colorSpec.onPrimaryFixed();
2214
+ }
2215
+ onPrimaryFixedVariant() {
2216
+ return MaterialDynamicColors.colorSpec.onPrimaryFixedVariant();
2217
+ }
2218
+ secondary() {
2219
+ return MaterialDynamicColors.colorSpec.secondary();
2220
+ }
2221
+ secondaryDim() {
2222
+ return MaterialDynamicColors.colorSpec.secondaryDim();
2223
+ }
2224
+ onSecondary() {
2225
+ return MaterialDynamicColors.colorSpec.onSecondary();
2226
+ }
2227
+ secondaryContainer() {
2228
+ return MaterialDynamicColors.colorSpec.secondaryContainer();
2229
+ }
2230
+ onSecondaryContainer() {
2231
+ return MaterialDynamicColors.colorSpec.onSecondaryContainer();
2232
+ }
2233
+ secondaryFixed() {
2234
+ return MaterialDynamicColors.colorSpec.secondaryFixed();
2235
+ }
2236
+ secondaryFixedDim() {
2237
+ return MaterialDynamicColors.colorSpec.secondaryFixedDim();
2238
+ }
2239
+ onSecondaryFixed() {
2240
+ return MaterialDynamicColors.colorSpec.onSecondaryFixed();
2241
+ }
2242
+ onSecondaryFixedVariant() {
2243
+ return MaterialDynamicColors.colorSpec.onSecondaryFixedVariant();
2244
+ }
2245
+ tertiary() {
2246
+ return MaterialDynamicColors.colorSpec.tertiary();
2247
+ }
2248
+ tertiaryDim() {
2249
+ return MaterialDynamicColors.colorSpec.tertiaryDim();
1128
2250
  }
1129
- constructor(argb, isContent) {
1130
- const hct = Hct.fromInt(argb),
1131
- hue = hct.hue,
1132
- chroma = hct.chroma;
1133
- isContent ? (this.a1 = TonalPalette.fromHueAndChroma(hue, chroma), this.a2 = TonalPalette.fromHueAndChroma(hue, chroma / 3), this.a3 = TonalPalette.fromHueAndChroma(hue + 60, chroma / 2), this.n1 = TonalPalette.fromHueAndChroma(hue, Math.min(chroma / 12, 4)), this.n2 = TonalPalette.fromHueAndChroma(hue, Math.min(chroma / 6, 8))) : (this.a1 = TonalPalette.fromHueAndChroma(hue, Math.max(48, chroma)), this.a2 = TonalPalette.fromHueAndChroma(hue, 16), this.a3 = TonalPalette.fromHueAndChroma(hue + 60, 24), this.n1 = TonalPalette.fromHueAndChroma(hue, 4), this.n2 = TonalPalette.fromHueAndChroma(hue, 8)), this.error = TonalPalette.fromHueAndChroma(25, 84);
2251
+ onTertiary() {
2252
+ return MaterialDynamicColors.colorSpec.onTertiary();
2253
+ }
2254
+ tertiaryContainer() {
2255
+ return MaterialDynamicColors.colorSpec.tertiaryContainer();
2256
+ }
2257
+ onTertiaryContainer() {
2258
+ return MaterialDynamicColors.colorSpec.onTertiaryContainer();
2259
+ }
2260
+ tertiaryFixed() {
2261
+ return MaterialDynamicColors.colorSpec.tertiaryFixed();
2262
+ }
2263
+ tertiaryFixedDim() {
2264
+ return MaterialDynamicColors.colorSpec.tertiaryFixedDim();
2265
+ }
2266
+ onTertiaryFixed() {
2267
+ return MaterialDynamicColors.colorSpec.onTertiaryFixed();
2268
+ }
2269
+ onTertiaryFixedVariant() {
2270
+ return MaterialDynamicColors.colorSpec.onTertiaryFixedVariant();
2271
+ }
2272
+ error() {
2273
+ return MaterialDynamicColors.colorSpec.error();
2274
+ }
2275
+ errorDim() {
2276
+ return MaterialDynamicColors.colorSpec.errorDim();
2277
+ }
2278
+ onError() {
2279
+ return MaterialDynamicColors.colorSpec.onError();
2280
+ }
2281
+ errorContainer() {
2282
+ return MaterialDynamicColors.colorSpec.errorContainer();
2283
+ }
2284
+ onErrorContainer() {
2285
+ return MaterialDynamicColors.colorSpec.onErrorContainer();
2286
+ }
2287
+ static highestSurface(s) {
2288
+ return MaterialDynamicColors.colorSpec.highestSurface(s);
1134
2289
  }
1135
2290
  }
1136
- class Scheme {
2291
+ MaterialDynamicColors.contentAccentToneDelta = 15, MaterialDynamicColors.colorSpec = new ColorSpecDelegateImpl2025(), MaterialDynamicColors.primaryPaletteKeyColor = MaterialDynamicColors.colorSpec.primaryPaletteKeyColor(), MaterialDynamicColors.secondaryPaletteKeyColor = MaterialDynamicColors.colorSpec.secondaryPaletteKeyColor(), MaterialDynamicColors.tertiaryPaletteKeyColor = MaterialDynamicColors.colorSpec.tertiaryPaletteKeyColor(), MaterialDynamicColors.neutralPaletteKeyColor = MaterialDynamicColors.colorSpec.neutralPaletteKeyColor(), MaterialDynamicColors.neutralVariantPaletteKeyColor = MaterialDynamicColors.colorSpec.neutralVariantPaletteKeyColor(), MaterialDynamicColors.background = MaterialDynamicColors.colorSpec.background(), MaterialDynamicColors.onBackground = MaterialDynamicColors.colorSpec.onBackground(), MaterialDynamicColors.surface = MaterialDynamicColors.colorSpec.surface(), MaterialDynamicColors.surfaceDim = MaterialDynamicColors.colorSpec.surfaceDim(), MaterialDynamicColors.surfaceBright = MaterialDynamicColors.colorSpec.surfaceBright(), MaterialDynamicColors.surfaceContainerLowest = MaterialDynamicColors.colorSpec.surfaceContainerLowest(), MaterialDynamicColors.surfaceContainerLow = MaterialDynamicColors.colorSpec.surfaceContainerLow(), MaterialDynamicColors.surfaceContainer = MaterialDynamicColors.colorSpec.surfaceContainer(), MaterialDynamicColors.surfaceContainerHigh = MaterialDynamicColors.colorSpec.surfaceContainerHigh(), MaterialDynamicColors.surfaceContainerHighest = MaterialDynamicColors.colorSpec.surfaceContainerHighest(), MaterialDynamicColors.onSurface = MaterialDynamicColors.colorSpec.onSurface(), MaterialDynamicColors.surfaceVariant = MaterialDynamicColors.colorSpec.surfaceVariant(), MaterialDynamicColors.onSurfaceVariant = MaterialDynamicColors.colorSpec.onSurfaceVariant(), MaterialDynamicColors.inverseSurface = MaterialDynamicColors.colorSpec.inverseSurface(), MaterialDynamicColors.inverseOnSurface = MaterialDynamicColors.colorSpec.inverseOnSurface(), MaterialDynamicColors.outline = MaterialDynamicColors.colorSpec.outline(), MaterialDynamicColors.outlineVariant = MaterialDynamicColors.colorSpec.outlineVariant(), MaterialDynamicColors.shadow = MaterialDynamicColors.colorSpec.shadow(), MaterialDynamicColors.scrim = MaterialDynamicColors.colorSpec.scrim(), MaterialDynamicColors.surfaceTint = MaterialDynamicColors.colorSpec.surfaceTint(), MaterialDynamicColors.primary = MaterialDynamicColors.colorSpec.primary(), MaterialDynamicColors.onPrimary = MaterialDynamicColors.colorSpec.onPrimary(), MaterialDynamicColors.primaryContainer = MaterialDynamicColors.colorSpec.primaryContainer(), MaterialDynamicColors.onPrimaryContainer = MaterialDynamicColors.colorSpec.onPrimaryContainer(), MaterialDynamicColors.inversePrimary = MaterialDynamicColors.colorSpec.inversePrimary(), MaterialDynamicColors.secondary = MaterialDynamicColors.colorSpec.secondary(), MaterialDynamicColors.onSecondary = MaterialDynamicColors.colorSpec.onSecondary(), MaterialDynamicColors.secondaryContainer = MaterialDynamicColors.colorSpec.secondaryContainer(), MaterialDynamicColors.onSecondaryContainer = MaterialDynamicColors.colorSpec.onSecondaryContainer(), MaterialDynamicColors.tertiary = MaterialDynamicColors.colorSpec.tertiary(), MaterialDynamicColors.onTertiary = MaterialDynamicColors.colorSpec.onTertiary(), MaterialDynamicColors.tertiaryContainer = MaterialDynamicColors.colorSpec.tertiaryContainer(), MaterialDynamicColors.onTertiaryContainer = MaterialDynamicColors.colorSpec.onTertiaryContainer(), MaterialDynamicColors.error = MaterialDynamicColors.colorSpec.error(), MaterialDynamicColors.onError = MaterialDynamicColors.colorSpec.onError(), MaterialDynamicColors.errorContainer = MaterialDynamicColors.colorSpec.errorContainer(), MaterialDynamicColors.onErrorContainer = MaterialDynamicColors.colorSpec.onErrorContainer(), MaterialDynamicColors.primaryFixed = MaterialDynamicColors.colorSpec.primaryFixed(), MaterialDynamicColors.primaryFixedDim = MaterialDynamicColors.colorSpec.primaryFixedDim(), MaterialDynamicColors.onPrimaryFixed = MaterialDynamicColors.colorSpec.onPrimaryFixed(), MaterialDynamicColors.onPrimaryFixedVariant = MaterialDynamicColors.colorSpec.onPrimaryFixedVariant(), MaterialDynamicColors.secondaryFixed = MaterialDynamicColors.colorSpec.secondaryFixed(), MaterialDynamicColors.secondaryFixedDim = MaterialDynamicColors.colorSpec.secondaryFixedDim(), MaterialDynamicColors.onSecondaryFixed = MaterialDynamicColors.colorSpec.onSecondaryFixed(), MaterialDynamicColors.onSecondaryFixedVariant = MaterialDynamicColors.colorSpec.onSecondaryFixedVariant(), MaterialDynamicColors.tertiaryFixed = MaterialDynamicColors.colorSpec.tertiaryFixed(), MaterialDynamicColors.tertiaryFixedDim = MaterialDynamicColors.colorSpec.tertiaryFixedDim(), MaterialDynamicColors.onTertiaryFixed = MaterialDynamicColors.colorSpec.onTertiaryFixed(), MaterialDynamicColors.onTertiaryFixedVariant = MaterialDynamicColors.colorSpec.onTertiaryFixedVariant();
2292
+ class DynamicScheme {
2293
+ constructor(args) {
2294
+ this.sourceColorArgb = args.sourceColorHct.toInt(), this.variant = args.variant, this.contrastLevel = args.contrastLevel, this.isDark = args.isDark, this.platform = args.platform ?? "phone", this.specVersion = args.specVersion ?? "2021", this.sourceColorHct = args.sourceColorHct, this.primaryPalette = args.primaryPalette ?? getSpec(this.specVersion).getPrimaryPalette(this.variant, args.sourceColorHct, this.isDark, this.platform, this.contrastLevel), this.secondaryPalette = args.secondaryPalette ?? getSpec(this.specVersion).getSecondaryPalette(this.variant, args.sourceColorHct, this.isDark, this.platform, this.contrastLevel), this.tertiaryPalette = args.tertiaryPalette ?? getSpec(this.specVersion).getTertiaryPalette(this.variant, args.sourceColorHct, this.isDark, this.platform, this.contrastLevel), this.neutralPalette = args.neutralPalette ?? getSpec(this.specVersion).getNeutralPalette(this.variant, args.sourceColorHct, this.isDark, this.platform, this.contrastLevel), this.neutralVariantPalette = args.neutralVariantPalette ?? getSpec(this.specVersion).getNeutralVariantPalette(this.variant, args.sourceColorHct, this.isDark, this.platform, this.contrastLevel), this.errorPalette = args.errorPalette ?? getSpec(this.specVersion).getErrorPalette(this.variant, args.sourceColorHct, this.isDark, this.platform, this.contrastLevel) ?? TonalPalette.fromHueAndChroma(25, 84), this.colors = new MaterialDynamicColors();
2295
+ }
2296
+ toString() {
2297
+ return `Scheme: variant=${Variant[this.variant]}, mode=${this.isDark ? "dark" : "light"}, platform=${this.platform}, contrastLevel=${this.contrastLevel.toFixed(1)}, seed=${this.sourceColorHct.toString()}, specVersion=${this.specVersion}`;
2298
+ }
2299
+ static getPiecewiseHue(sourceColorHct, hueBreakpoints, hues) {
2300
+ const size = Math.min(hueBreakpoints.length - 1, hues.length),
2301
+ sourceHue = sourceColorHct.hue;
2302
+ for (let i = 0; i < size; i++) if (sourceHue >= hueBreakpoints[i] && sourceHue < hueBreakpoints[i + 1]) return sanitizeDegreesDouble(hues[i]);
2303
+ return sourceHue;
2304
+ }
2305
+ static getRotatedHue(sourceColorHct, hueBreakpoints, rotations) {
2306
+ let rotation = DynamicScheme.getPiecewiseHue(sourceColorHct, hueBreakpoints, rotations);
2307
+ return Math.min(hueBreakpoints.length - 1, rotations.length) <= 0 && (rotation = 0), sanitizeDegreesDouble(sourceColorHct.hue + rotation);
2308
+ }
2309
+ getArgb(dynamicColor) {
2310
+ return dynamicColor.getArgb(this);
2311
+ }
2312
+ getHct(dynamicColor) {
2313
+ return dynamicColor.getHct(this);
2314
+ }
2315
+ get primaryPaletteKeyColor() {
2316
+ return this.getArgb(this.colors.primaryPaletteKeyColor());
2317
+ }
2318
+ get secondaryPaletteKeyColor() {
2319
+ return this.getArgb(this.colors.secondaryPaletteKeyColor());
2320
+ }
2321
+ get tertiaryPaletteKeyColor() {
2322
+ return this.getArgb(this.colors.tertiaryPaletteKeyColor());
2323
+ }
2324
+ get neutralPaletteKeyColor() {
2325
+ return this.getArgb(this.colors.neutralPaletteKeyColor());
2326
+ }
2327
+ get neutralVariantPaletteKeyColor() {
2328
+ return this.getArgb(this.colors.neutralVariantPaletteKeyColor());
2329
+ }
2330
+ get errorPaletteKeyColor() {
2331
+ return this.getArgb(this.colors.errorPaletteKeyColor());
2332
+ }
2333
+ get background() {
2334
+ return this.getArgb(this.colors.background());
2335
+ }
2336
+ get onBackground() {
2337
+ return this.getArgb(this.colors.onBackground());
2338
+ }
2339
+ get surface() {
2340
+ return this.getArgb(this.colors.surface());
2341
+ }
2342
+ get surfaceDim() {
2343
+ return this.getArgb(this.colors.surfaceDim());
2344
+ }
2345
+ get surfaceBright() {
2346
+ return this.getArgb(this.colors.surfaceBright());
2347
+ }
2348
+ get surfaceContainerLowest() {
2349
+ return this.getArgb(this.colors.surfaceContainerLowest());
2350
+ }
2351
+ get surfaceContainerLow() {
2352
+ return this.getArgb(this.colors.surfaceContainerLow());
2353
+ }
2354
+ get surfaceContainer() {
2355
+ return this.getArgb(this.colors.surfaceContainer());
2356
+ }
2357
+ get surfaceContainerHigh() {
2358
+ return this.getArgb(this.colors.surfaceContainerHigh());
2359
+ }
2360
+ get surfaceContainerHighest() {
2361
+ return this.getArgb(this.colors.surfaceContainerHighest());
2362
+ }
2363
+ get onSurface() {
2364
+ return this.getArgb(this.colors.onSurface());
2365
+ }
2366
+ get surfaceVariant() {
2367
+ return this.getArgb(this.colors.surfaceVariant());
2368
+ }
2369
+ get onSurfaceVariant() {
2370
+ return this.getArgb(this.colors.onSurfaceVariant());
2371
+ }
2372
+ get inverseSurface() {
2373
+ return this.getArgb(this.colors.inverseSurface());
2374
+ }
2375
+ get inverseOnSurface() {
2376
+ return this.getArgb(this.colors.inverseOnSurface());
2377
+ }
2378
+ get outline() {
2379
+ return this.getArgb(this.colors.outline());
2380
+ }
2381
+ get outlineVariant() {
2382
+ return this.getArgb(this.colors.outlineVariant());
2383
+ }
2384
+ get shadow() {
2385
+ return this.getArgb(this.colors.shadow());
2386
+ }
2387
+ get scrim() {
2388
+ return this.getArgb(this.colors.scrim());
2389
+ }
2390
+ get surfaceTint() {
2391
+ return this.getArgb(this.colors.surfaceTint());
2392
+ }
1137
2393
  get primary() {
1138
- return this.props.primary;
2394
+ return this.getArgb(this.colors.primary());
2395
+ }
2396
+ get primaryDim() {
2397
+ const primaryDim = this.colors.primaryDim();
2398
+ if (void 0 === primaryDim) throw new Error("`primaryDim` color is undefined prior to 2025 spec.");
2399
+ return this.getArgb(primaryDim);
1139
2400
  }
1140
2401
  get onPrimary() {
1141
- return this.props.onPrimary;
2402
+ return this.getArgb(this.colors.onPrimary());
1142
2403
  }
1143
2404
  get primaryContainer() {
1144
- return this.props.primaryContainer;
2405
+ return this.getArgb(this.colors.primaryContainer());
1145
2406
  }
1146
2407
  get onPrimaryContainer() {
1147
- return this.props.onPrimaryContainer;
2408
+ return this.getArgb(this.colors.onPrimaryContainer());
2409
+ }
2410
+ get primaryFixed() {
2411
+ return this.getArgb(this.colors.primaryFixed());
2412
+ }
2413
+ get primaryFixedDim() {
2414
+ return this.getArgb(this.colors.primaryFixedDim());
2415
+ }
2416
+ get onPrimaryFixed() {
2417
+ return this.getArgb(this.colors.onPrimaryFixed());
2418
+ }
2419
+ get onPrimaryFixedVariant() {
2420
+ return this.getArgb(this.colors.onPrimaryFixedVariant());
2421
+ }
2422
+ get inversePrimary() {
2423
+ return this.getArgb(this.colors.inversePrimary());
1148
2424
  }
1149
2425
  get secondary() {
1150
- return this.props.secondary;
2426
+ return this.getArgb(this.colors.secondary());
2427
+ }
2428
+ get secondaryDim() {
2429
+ const secondaryDim = this.colors.secondaryDim();
2430
+ if (void 0 === secondaryDim) throw new Error("`secondaryDim` color is undefined prior to 2025 spec.");
2431
+ return this.getArgb(secondaryDim);
1151
2432
  }
1152
2433
  get onSecondary() {
1153
- return this.props.onSecondary;
2434
+ return this.getArgb(this.colors.onSecondary());
1154
2435
  }
1155
2436
  get secondaryContainer() {
1156
- return this.props.secondaryContainer;
2437
+ return this.getArgb(this.colors.secondaryContainer());
1157
2438
  }
1158
2439
  get onSecondaryContainer() {
1159
- return this.props.onSecondaryContainer;
2440
+ return this.getArgb(this.colors.onSecondaryContainer());
2441
+ }
2442
+ get secondaryFixed() {
2443
+ return this.getArgb(this.colors.secondaryFixed());
2444
+ }
2445
+ get secondaryFixedDim() {
2446
+ return this.getArgb(this.colors.secondaryFixedDim());
2447
+ }
2448
+ get onSecondaryFixed() {
2449
+ return this.getArgb(this.colors.onSecondaryFixed());
2450
+ }
2451
+ get onSecondaryFixedVariant() {
2452
+ return this.getArgb(this.colors.onSecondaryFixedVariant());
1160
2453
  }
1161
2454
  get tertiary() {
1162
- return this.props.tertiary;
2455
+ return this.getArgb(this.colors.tertiary());
2456
+ }
2457
+ get tertiaryDim() {
2458
+ const tertiaryDim = this.colors.tertiaryDim();
2459
+ if (void 0 === tertiaryDim) throw new Error("`tertiaryDim` color is undefined prior to 2025 spec.");
2460
+ return this.getArgb(tertiaryDim);
1163
2461
  }
1164
2462
  get onTertiary() {
1165
- return this.props.onTertiary;
2463
+ return this.getArgb(this.colors.onTertiary());
1166
2464
  }
1167
2465
  get tertiaryContainer() {
1168
- return this.props.tertiaryContainer;
2466
+ return this.getArgb(this.colors.tertiaryContainer());
1169
2467
  }
1170
2468
  get onTertiaryContainer() {
1171
- return this.props.onTertiaryContainer;
2469
+ return this.getArgb(this.colors.onTertiaryContainer());
2470
+ }
2471
+ get tertiaryFixed() {
2472
+ return this.getArgb(this.colors.tertiaryFixed());
2473
+ }
2474
+ get tertiaryFixedDim() {
2475
+ return this.getArgb(this.colors.tertiaryFixedDim());
2476
+ }
2477
+ get onTertiaryFixed() {
2478
+ return this.getArgb(this.colors.onTertiaryFixed());
2479
+ }
2480
+ get onTertiaryFixedVariant() {
2481
+ return this.getArgb(this.colors.onTertiaryFixedVariant());
1172
2482
  }
1173
2483
  get error() {
1174
- return this.props.error;
2484
+ return this.getArgb(this.colors.error());
2485
+ }
2486
+ get errorDim() {
2487
+ const errorDim = this.colors.errorDim();
2488
+ if (void 0 === errorDim) throw new Error("`errorDim` color is undefined prior to 2025 spec.");
2489
+ return this.getArgb(errorDim);
1175
2490
  }
1176
2491
  get onError() {
1177
- return this.props.onError;
2492
+ return this.getArgb(this.colors.onError());
1178
2493
  }
1179
2494
  get errorContainer() {
1180
- return this.props.errorContainer;
2495
+ return this.getArgb(this.colors.errorContainer());
1181
2496
  }
1182
2497
  get onErrorContainer() {
1183
- return this.props.onErrorContainer;
2498
+ return this.getArgb(this.colors.onErrorContainer());
1184
2499
  }
1185
- get background() {
1186
- return this.props.background;
2500
+ }
2501
+ DynamicScheme.DEFAULT_SPEC_VERSION = "2021", DynamicScheme.DEFAULT_PLATFORM = "phone";
2502
+ class DynamicSchemePalettesDelegateImpl2021 {
2503
+ getPrimaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
2504
+ switch (variant) {
2505
+ case Variant.CONTENT:
2506
+ case Variant.FIDELITY:
2507
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, sourceColorHct.chroma);
2508
+ case Variant.FRUIT_SALAD:
2509
+ return TonalPalette.fromHueAndChroma(sanitizeDegreesDouble(sourceColorHct.hue - 50), 48);
2510
+ case Variant.MONOCHROME:
2511
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 0);
2512
+ case Variant.NEUTRAL:
2513
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 12);
2514
+ case Variant.RAINBOW:
2515
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 48);
2516
+ case Variant.TONAL_SPOT:
2517
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 36);
2518
+ case Variant.EXPRESSIVE:
2519
+ return TonalPalette.fromHueAndChroma(sanitizeDegreesDouble(sourceColorHct.hue + 240), 40);
2520
+ case Variant.VIBRANT:
2521
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 200);
2522
+ default:
2523
+ throw new Error(`Unsupported variant: ${variant}`);
2524
+ }
1187
2525
  }
1188
- get onBackground() {
1189
- return this.props.onBackground;
2526
+ getSecondaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
2527
+ switch (variant) {
2528
+ case Variant.CONTENT:
2529
+ case Variant.FIDELITY:
2530
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, Math.max(sourceColorHct.chroma - 32, .5 * sourceColorHct.chroma));
2531
+ case Variant.FRUIT_SALAD:
2532
+ return TonalPalette.fromHueAndChroma(sanitizeDegreesDouble(sourceColorHct.hue - 50), 36);
2533
+ case Variant.MONOCHROME:
2534
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 0);
2535
+ case Variant.NEUTRAL:
2536
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 8);
2537
+ case Variant.RAINBOW:
2538
+ case Variant.TONAL_SPOT:
2539
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16);
2540
+ case Variant.EXPRESSIVE:
2541
+ return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 21, 51, 121, 151, 191, 271, 321, 360], [45, 95, 45, 20, 45, 90, 45, 45, 45]), 24);
2542
+ case Variant.VIBRANT:
2543
+ return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 41, 61, 101, 131, 181, 251, 301, 360], [18, 15, 10, 12, 15, 18, 15, 12, 12]), 24);
2544
+ default:
2545
+ throw new Error(`Unsupported variant: ${variant}`);
2546
+ }
1190
2547
  }
1191
- get surface() {
1192
- return this.props.surface;
2548
+ getTertiaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
2549
+ switch (variant) {
2550
+ case Variant.CONTENT:
2551
+ return TonalPalette.fromHct(DislikeAnalyzer.fixIfDisliked(new TemperatureCache(sourceColorHct).analogous(3, 6)[2]));
2552
+ case Variant.FIDELITY:
2553
+ return TonalPalette.fromHct(DislikeAnalyzer.fixIfDisliked(new TemperatureCache(sourceColorHct).complement));
2554
+ case Variant.FRUIT_SALAD:
2555
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 36);
2556
+ case Variant.MONOCHROME:
2557
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 0);
2558
+ case Variant.NEUTRAL:
2559
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16);
2560
+ case Variant.RAINBOW:
2561
+ case Variant.TONAL_SPOT:
2562
+ return TonalPalette.fromHueAndChroma(sanitizeDegreesDouble(sourceColorHct.hue + 60), 24);
2563
+ case Variant.EXPRESSIVE:
2564
+ return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 21, 51, 121, 151, 191, 271, 321, 360], [120, 120, 20, 45, 20, 15, 20, 120, 120]), 32);
2565
+ case Variant.VIBRANT:
2566
+ return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 41, 61, 101, 131, 181, 251, 301, 360], [35, 30, 20, 25, 30, 35, 30, 25, 25]), 32);
2567
+ default:
2568
+ throw new Error(`Unsupported variant: ${variant}`);
2569
+ }
1193
2570
  }
1194
- get onSurface() {
1195
- return this.props.onSurface;
2571
+ getNeutralPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
2572
+ switch (variant) {
2573
+ case Variant.CONTENT:
2574
+ case Variant.FIDELITY:
2575
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, sourceColorHct.chroma / 8);
2576
+ case Variant.FRUIT_SALAD:
2577
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 10);
2578
+ case Variant.MONOCHROME:
2579
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 0);
2580
+ case Variant.NEUTRAL:
2581
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 2);
2582
+ case Variant.RAINBOW:
2583
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 0);
2584
+ case Variant.TONAL_SPOT:
2585
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 6);
2586
+ case Variant.EXPRESSIVE:
2587
+ return TonalPalette.fromHueAndChroma(sanitizeDegreesDouble(sourceColorHct.hue + 15), 8);
2588
+ case Variant.VIBRANT:
2589
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 10);
2590
+ default:
2591
+ throw new Error(`Unsupported variant: ${variant}`);
2592
+ }
1196
2593
  }
1197
- get surfaceVariant() {
1198
- return this.props.surfaceVariant;
2594
+ getNeutralVariantPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
2595
+ switch (variant) {
2596
+ case Variant.CONTENT:
2597
+ case Variant.FIDELITY:
2598
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, sourceColorHct.chroma / 8 + 4);
2599
+ case Variant.FRUIT_SALAD:
2600
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16);
2601
+ case Variant.MONOCHROME:
2602
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 0);
2603
+ case Variant.NEUTRAL:
2604
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 2);
2605
+ case Variant.RAINBOW:
2606
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 0);
2607
+ case Variant.TONAL_SPOT:
2608
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 8);
2609
+ case Variant.EXPRESSIVE:
2610
+ return TonalPalette.fromHueAndChroma(sanitizeDegreesDouble(sourceColorHct.hue + 15), 12);
2611
+ case Variant.VIBRANT:
2612
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 12);
2613
+ default:
2614
+ throw new Error(`Unsupported variant: ${variant}`);
2615
+ }
1199
2616
  }
1200
- get onSurfaceVariant() {
1201
- return this.props.onSurfaceVariant;
2617
+ getErrorPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {}
2618
+ }
2619
+ class DynamicSchemePalettesDelegateImpl2025 extends DynamicSchemePalettesDelegateImpl2021 {
2620
+ getPrimaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
2621
+ switch (variant) {
2622
+ case Variant.NEUTRAL:
2623
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, "phone" === platform ? Hct.isBlue(sourceColorHct.hue) ? 12 : 8 : Hct.isBlue(sourceColorHct.hue) ? 16 : 12);
2624
+ case Variant.TONAL_SPOT:
2625
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, "phone" === platform && isDark ? 26 : 32);
2626
+ case Variant.EXPRESSIVE:
2627
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, "phone" === platform ? isDark ? 36 : 48 : 40);
2628
+ case Variant.VIBRANT:
2629
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, "phone" === platform ? 74 : 56);
2630
+ default:
2631
+ return super.getPrimaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel);
2632
+ }
1202
2633
  }
1203
- get outline() {
1204
- return this.props.outline;
2634
+ getSecondaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
2635
+ switch (variant) {
2636
+ case Variant.NEUTRAL:
2637
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, "phone" === platform ? Hct.isBlue(sourceColorHct.hue) ? 6 : 4 : Hct.isBlue(sourceColorHct.hue) ? 10 : 6);
2638
+ case Variant.TONAL_SPOT:
2639
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16);
2640
+ case Variant.EXPRESSIVE:
2641
+ return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 105, 140, 204, 253, 278, 300, 333, 360], [-160, 155, -100, 96, -96, -156, -165, -160]), "phone" === platform && isDark ? 16 : 24);
2642
+ case Variant.VIBRANT:
2643
+ return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]), "phone" === platform ? 56 : 36);
2644
+ default:
2645
+ return super.getSecondaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel);
2646
+ }
1205
2647
  }
1206
- get outlineVariant() {
1207
- return this.props.outlineVariant;
2648
+ getTertiaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
2649
+ switch (variant) {
2650
+ case Variant.NEUTRAL:
2651
+ return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 38, 105, 161, 204, 278, 333, 360], [-32, 26, 10, -39, 24, -15, -32]), "phone" === platform ? 20 : 36);
2652
+ case Variant.TONAL_SPOT:
2653
+ return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 20, 71, 161, 333, 360], [-40, 48, -32, 40, -32]), "phone" === platform ? 28 : 32);
2654
+ case Variant.EXPRESSIVE:
2655
+ return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 105, 140, 204, 253, 278, 300, 333, 360], [-165, 160, -105, 101, -101, -160, -170, -165]), 48);
2656
+ case Variant.VIBRANT:
2657
+ return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 38, 71, 105, 140, 161, 253, 333, 360], [-72, 35, 24, -24, 62, 50, 62, -72]), 56);
2658
+ default:
2659
+ return super.getTertiaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel);
2660
+ }
1208
2661
  }
1209
- get shadow() {
1210
- return this.props.shadow;
2662
+ static getExpressiveNeutralHue(sourceColorHct) {
2663
+ return DynamicScheme.getRotatedHue(sourceColorHct, [0, 71, 124, 253, 278, 300, 360], [10, 0, 10, 0, 10, 0]);
2664
+ }
2665
+ static getExpressiveNeutralChroma(sourceColorHct, isDark, platform) {
2666
+ const neutralHue = DynamicSchemePalettesDelegateImpl2025.getExpressiveNeutralHue(sourceColorHct);
2667
+ return "phone" === platform ? isDark ? Hct.isYellow(neutralHue) ? 6 : 14 : 18 : 12;
2668
+ }
2669
+ static getVibrantNeutralHue(sourceColorHct) {
2670
+ return DynamicScheme.getRotatedHue(sourceColorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]);
2671
+ }
2672
+ static getVibrantNeutralChroma(sourceColorHct, platform) {
2673
+ const neutralHue = DynamicSchemePalettesDelegateImpl2025.getVibrantNeutralHue(sourceColorHct);
2674
+ return "phone" === platform || Hct.isBlue(neutralHue) ? 28 : 20;
2675
+ }
2676
+ getNeutralPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
2677
+ switch (variant) {
2678
+ case Variant.NEUTRAL:
2679
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, "phone" === platform ? 1.4 : 6);
2680
+ case Variant.TONAL_SPOT:
2681
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, "phone" === platform ? 5 : 10);
2682
+ case Variant.EXPRESSIVE:
2683
+ return TonalPalette.fromHueAndChroma(DynamicSchemePalettesDelegateImpl2025.getExpressiveNeutralHue(sourceColorHct), DynamicSchemePalettesDelegateImpl2025.getExpressiveNeutralChroma(sourceColorHct, isDark, platform));
2684
+ case Variant.VIBRANT:
2685
+ return TonalPalette.fromHueAndChroma(DynamicSchemePalettesDelegateImpl2025.getVibrantNeutralHue(sourceColorHct), DynamicSchemePalettesDelegateImpl2025.getVibrantNeutralChroma(sourceColorHct, platform));
2686
+ default:
2687
+ return super.getNeutralPalette(variant, sourceColorHct, isDark, platform, contrastLevel);
2688
+ }
1211
2689
  }
1212
- get scrim() {
1213
- return this.props.scrim;
2690
+ getNeutralVariantPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
2691
+ switch (variant) {
2692
+ case Variant.NEUTRAL:
2693
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 2.2 * ("phone" === platform ? 1.4 : 6));
2694
+ case Variant.TONAL_SPOT:
2695
+ return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 1.7 * ("phone" === platform ? 5 : 10));
2696
+ case Variant.EXPRESSIVE:
2697
+ const expressiveNeutralHue = DynamicSchemePalettesDelegateImpl2025.getExpressiveNeutralHue(sourceColorHct),
2698
+ expressiveNeutralChroma = DynamicSchemePalettesDelegateImpl2025.getExpressiveNeutralChroma(sourceColorHct, isDark, platform);
2699
+ return TonalPalette.fromHueAndChroma(expressiveNeutralHue, expressiveNeutralChroma * (expressiveNeutralHue >= 105 && expressiveNeutralHue < 125 ? 1.6 : 2.3));
2700
+ case Variant.VIBRANT:
2701
+ const vibrantNeutralHue = DynamicSchemePalettesDelegateImpl2025.getVibrantNeutralHue(sourceColorHct),
2702
+ vibrantNeutralChroma = DynamicSchemePalettesDelegateImpl2025.getVibrantNeutralChroma(sourceColorHct, platform);
2703
+ return TonalPalette.fromHueAndChroma(vibrantNeutralHue, 1.29 * vibrantNeutralChroma);
2704
+ default:
2705
+ return super.getNeutralVariantPalette(variant, sourceColorHct, isDark, platform, contrastLevel);
2706
+ }
1214
2707
  }
1215
- get inverseSurface() {
1216
- return this.props.inverseSurface;
2708
+ getErrorPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
2709
+ const errorHue = DynamicScheme.getPiecewiseHue(sourceColorHct, [0, 3, 13, 23, 33, 43, 153, 273, 360], [12, 22, 32, 12, 22, 32, 22, 12]);
2710
+ switch (variant) {
2711
+ case Variant.NEUTRAL:
2712
+ return TonalPalette.fromHueAndChroma(errorHue, "phone" === platform ? 50 : 40);
2713
+ case Variant.TONAL_SPOT:
2714
+ return TonalPalette.fromHueAndChroma(errorHue, "phone" === platform ? 60 : 48);
2715
+ case Variant.EXPRESSIVE:
2716
+ return TonalPalette.fromHueAndChroma(errorHue, "phone" === platform ? 64 : 48);
2717
+ case Variant.VIBRANT:
2718
+ return TonalPalette.fromHueAndChroma(errorHue, "phone" === platform ? 80 : 60);
2719
+ default:
2720
+ return super.getErrorPalette(variant, sourceColorHct, isDark, platform, contrastLevel);
2721
+ }
1217
2722
  }
1218
- get inverseOnSurface() {
1219
- return this.props.inverseOnSurface;
2723
+ }
2724
+ const spec2021 = new DynamicSchemePalettesDelegateImpl2021(),
2725
+ spec2025 = new DynamicSchemePalettesDelegateImpl2025();
2726
+ function getSpec(specVersion) {
2727
+ return "2025" === specVersion ? spec2025 : spec2021;
2728
+ }
2729
+ class SchemeMonochrome extends DynamicScheme {
2730
+ constructor(sourceColorHct, isDark, contrastLevel, specVersion = DynamicScheme.DEFAULT_SPEC_VERSION, platform = DynamicScheme.DEFAULT_PLATFORM) {
2731
+ super({
2732
+ sourceColorHct: sourceColorHct,
2733
+ variant: Variant.MONOCHROME,
2734
+ contrastLevel: contrastLevel,
2735
+ isDark: isDark,
2736
+ platform: platform,
2737
+ specVersion: specVersion
2738
+ });
1220
2739
  }
1221
- get inversePrimary() {
1222
- return this.props.inversePrimary;
1223
- }
1224
- static light(argb) {
1225
- return Scheme.lightFromCorePalette(CorePalette.of(argb));
1226
- }
1227
- static dark(argb) {
1228
- return Scheme.darkFromCorePalette(CorePalette.of(argb));
1229
- }
1230
- static lightContent(argb) {
1231
- return Scheme.lightFromCorePalette(CorePalette.contentOf(argb));
1232
- }
1233
- static darkContent(argb) {
1234
- return Scheme.darkFromCorePalette(CorePalette.contentOf(argb));
1235
- }
1236
- static lightFromCorePalette(core) {
1237
- return new Scheme({
1238
- primary: core.a1.tone(40),
1239
- onPrimary: core.a1.tone(100),
1240
- primaryContainer: core.a1.tone(90),
1241
- onPrimaryContainer: core.a1.tone(10),
1242
- secondary: core.a2.tone(40),
1243
- onSecondary: core.a2.tone(100),
1244
- secondaryContainer: core.a2.tone(90),
1245
- onSecondaryContainer: core.a2.tone(10),
1246
- tertiary: core.a3.tone(40),
1247
- onTertiary: core.a3.tone(100),
1248
- tertiaryContainer: core.a3.tone(90),
1249
- onTertiaryContainer: core.a3.tone(10),
1250
- error: core.error.tone(40),
1251
- onError: core.error.tone(100),
1252
- errorContainer: core.error.tone(90),
1253
- onErrorContainer: core.error.tone(10),
1254
- background: core.n1.tone(99),
1255
- onBackground: core.n1.tone(10),
1256
- surface: core.n1.tone(99),
1257
- onSurface: core.n1.tone(10),
1258
- surfaceVariant: core.n2.tone(90),
1259
- onSurfaceVariant: core.n2.tone(30),
1260
- outline: core.n2.tone(50),
1261
- outlineVariant: core.n2.tone(80),
1262
- shadow: core.n1.tone(0),
1263
- scrim: core.n1.tone(0),
1264
- inverseSurface: core.n1.tone(20),
1265
- inverseOnSurface: core.n1.tone(95),
1266
- inversePrimary: core.a1.tone(80)
1267
- });
1268
- }
1269
- static darkFromCorePalette(core) {
1270
- return new Scheme({
1271
- primary: core.a1.tone(80),
1272
- onPrimary: core.a1.tone(20),
1273
- primaryContainer: core.a1.tone(30),
1274
- onPrimaryContainer: core.a1.tone(90),
1275
- secondary: core.a2.tone(80),
1276
- onSecondary: core.a2.tone(20),
1277
- secondaryContainer: core.a2.tone(30),
1278
- onSecondaryContainer: core.a2.tone(90),
1279
- tertiary: core.a3.tone(80),
1280
- onTertiary: core.a3.tone(20),
1281
- tertiaryContainer: core.a3.tone(30),
1282
- onTertiaryContainer: core.a3.tone(90),
1283
- error: core.error.tone(80),
1284
- onError: core.error.tone(20),
1285
- errorContainer: core.error.tone(30),
1286
- onErrorContainer: core.error.tone(80),
1287
- background: core.n1.tone(10),
1288
- onBackground: core.n1.tone(90),
1289
- surface: core.n1.tone(10),
1290
- onSurface: core.n1.tone(90),
1291
- surfaceVariant: core.n2.tone(30),
1292
- onSurfaceVariant: core.n2.tone(80),
1293
- outline: core.n2.tone(60),
1294
- outlineVariant: core.n2.tone(30),
1295
- shadow: core.n1.tone(0),
1296
- scrim: core.n1.tone(0),
1297
- inverseSurface: core.n1.tone(90),
1298
- inverseOnSurface: core.n1.tone(20),
1299
- inversePrimary: core.a1.tone(40)
1300
- });
1301
- }
1302
- constructor(props) {
1303
- this.props = props;
1304
- }
1305
- toJSON() {
1306
- return {
1307
- ...this.props
1308
- };
2740
+ }
2741
+ class SchemeTonalSpot extends DynamicScheme {
2742
+ constructor(sourceColorHct, isDark, contrastLevel, specVersion = DynamicScheme.DEFAULT_SPEC_VERSION, platform = DynamicScheme.DEFAULT_PLATFORM) {
2743
+ super({
2744
+ sourceColorHct: sourceColorHct,
2745
+ variant: Variant.TONAL_SPOT,
2746
+ contrastLevel: contrastLevel,
2747
+ isDark: isDark,
2748
+ platform: platform,
2749
+ specVersion: specVersion
2750
+ });
2751
+ }
2752
+ }
2753
+ class SchemeVibrant extends DynamicScheme {
2754
+ constructor(sourceColorHct, isDark, contrastLevel, specVersion = DynamicScheme.DEFAULT_SPEC_VERSION, platform = DynamicScheme.DEFAULT_PLATFORM) {
2755
+ super({
2756
+ sourceColorHct: sourceColorHct,
2757
+ variant: Variant.VIBRANT,
2758
+ contrastLevel: contrastLevel,
2759
+ isDark: isDark,
2760
+ platform: platform,
2761
+ specVersion: specVersion
2762
+ });
1309
2763
  }
1310
2764
  }
1311
2765
  function hexFromArgb(argb) {
@@ -1329,49 +2783,4 @@ function argbFromHex(hex) {
1329
2783
  function parseIntHex(value) {
1330
2784
  return parseInt(value, 16);
1331
2785
  }
1332
- function themeFromSourceColor(source, customColors) {
1333
- if (customColors === void 0) {
1334
- customColors = [];
1335
- }
1336
- const palette = CorePalette.of(source);
1337
- return {
1338
- source: source,
1339
- schemes: {
1340
- light: Scheme.light(source),
1341
- dark: Scheme.dark(source)
1342
- },
1343
- palettes: {
1344
- primary: palette.a1,
1345
- secondary: palette.a2,
1346
- tertiary: palette.a3,
1347
- neutral: palette.n1,
1348
- neutralVariant: palette.n2,
1349
- error: palette.error
1350
- },
1351
- customColors: customColors.map(c => customColor(source, c))
1352
- };
1353
- }
1354
- function customColor(source, color) {
1355
- let value = color.value;
1356
- const from = value,
1357
- to = source;
1358
- color.blend && (value = Blend.harmonize(from, to));
1359
- const tones = CorePalette.of(value).a1;
1360
- return {
1361
- color: color,
1362
- value: value,
1363
- light: {
1364
- color: tones.tone(40),
1365
- onColor: tones.tone(100),
1366
- colorContainer: tones.tone(90),
1367
- onColorContainer: tones.tone(10)
1368
- },
1369
- dark: {
1370
- color: tones.tone(80),
1371
- onColor: tones.tone(20),
1372
- colorContainer: tones.tone(30),
1373
- onColorContainer: tones.tone(90)
1374
- }
1375
- };
1376
- }
1377
- export { argbFromHex, hexFromArgb, themeFromSourceColor };
2786
+ export { Hct, SchemeMonochrome, SchemeTonalSpot, SchemeVibrant, argbFromHex, hexFromArgb };