@xenknight/framework7 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +32 -0
- package/components/accordion/accordion-ios.less +2 -0
- package/components/accordion/accordion-md.less +2 -0
- package/components/accordion/accordion-rtl.css +1 -0
- package/components/accordion/accordion-vars.less +0 -0
- package/components/accordion/accordion.css +1 -0
- package/components/accordion/accordion.d.ts +55 -0
- package/components/accordion/accordion.js +118 -0
- package/components/accordion/accordion.less +215 -0
- package/components/actions/actions-class.js +325 -0
- package/components/actions/actions-ios.less +51 -0
- package/components/actions/actions-md.less +24 -0
- package/components/actions/actions-rtl.css +1 -0
- package/components/actions/actions-vars.less +72 -0
- package/components/actions/actions.css +1 -0
- package/components/actions/actions.d.ts +164 -0
- package/components/actions/actions.js +47 -0
- package/components/actions/actions.less +182 -0
- package/components/app/app-class.d.ts +189 -0
- package/components/app/app-class.js +349 -0
- package/components/app/app-ios.less +23 -0
- package/components/app/app-md.less +8 -0
- package/components/app/app-vars.less +122 -0
- package/components/app/app.less +121 -0
- package/components/app/load-module.js +125 -0
- package/components/area-chart/area-chart-class.js +467 -0
- package/components/area-chart/area-chart-ios.less +2 -0
- package/components/area-chart/area-chart-md.less +2 -0
- package/components/area-chart/area-chart-rtl.css +1 -0
- package/components/area-chart/area-chart-vars.less +35 -0
- package/components/area-chart/area-chart.css +1 -0
- package/components/area-chart/area-chart.d.ts +128 -0
- package/components/area-chart/area-chart.js +44 -0
- package/components/area-chart/area-chart.less +131 -0
- package/components/autocomplete/autocomplete-class.js +813 -0
- package/components/autocomplete/autocomplete-ios.less +9 -0
- package/components/autocomplete/autocomplete-md.less +30 -0
- package/components/autocomplete/autocomplete-rtl.css +1 -0
- package/components/autocomplete/autocomplete-vars.less +36 -0
- package/components/autocomplete/autocomplete.css +1 -0
- package/components/autocomplete/autocomplete.d.ts +193 -0
- package/components/autocomplete/autocomplete.js +81 -0
- package/components/autocomplete/autocomplete.less +102 -0
- package/components/badge/badge-ios.less +2 -0
- package/components/badge/badge-md.less +2 -0
- package/components/badge/badge-vars.less +18 -0
- package/components/badge/badge.d.ts +14 -0
- package/components/badge/badge.js +3 -0
- package/components/badge/badge.less +45 -0
- package/components/block/block-ios.less +2 -0
- package/components/block/block-md.less +2 -0
- package/components/block/block-vars.less +77 -0
- package/components/block/block.d.ts +14 -0
- package/components/block/block.js +3 -0
- package/components/block/block.less +209 -0
- package/components/breadcrumbs/breadcrumbs-ios.less +2 -0
- package/components/breadcrumbs/breadcrumbs-md.less +2 -0
- package/components/breadcrumbs/breadcrumbs-rtl.css +1 -0
- package/components/breadcrumbs/breadcrumbs-vars.less +52 -0
- package/components/breadcrumbs/breadcrumbs.css +1 -0
- package/components/breadcrumbs/breadcrumbs.d.ts +15 -0
- package/components/breadcrumbs/breadcrumbs.js +11 -0
- package/components/breadcrumbs/breadcrumbs.less +91 -0
- package/components/button/button-ios.less +21 -0
- package/components/button/button-md.less +11 -0
- package/components/button/button-vars.less +114 -0
- package/components/button/button.d.ts +14 -0
- package/components/button/button.js +3 -0
- package/components/button/button.less +421 -0
- package/components/calendar/calendar-class.js +1872 -0
- package/components/calendar/calendar-ios.less +2 -0
- package/components/calendar/calendar-md.less +2 -0
- package/components/calendar/calendar-rtl.css +1 -0
- package/components/calendar/calendar-vars.less +108 -0
- package/components/calendar/calendar.css +1 -0
- package/components/calendar/calendar.d.ts +312 -0
- package/components/calendar/calendar.js +118 -0
- package/components/calendar/calendar.less +448 -0
- package/components/card/card-ios.less +2 -0
- package/components/card/card-md.less +2 -0
- package/components/card/card-rtl.css +1 -0
- package/components/card/card-vars.less +80 -0
- package/components/card/card.css +1 -0
- package/components/card/card.d.ts +69 -0
- package/components/card/card.js +504 -0
- package/components/card/card.less +307 -0
- package/components/checkbox/checkbox-ios.less +23 -0
- package/components/checkbox/checkbox-md.less +17 -0
- package/components/checkbox/checkbox-rtl.css +1 -0
- package/components/checkbox/checkbox-vars.less +25 -0
- package/components/checkbox/checkbox.css +1 -0
- package/components/checkbox/checkbox.d.ts +14 -0
- package/components/checkbox/checkbox.js +3 -0
- package/components/checkbox/checkbox.less +155 -0
- package/components/chip/chip-ios.less +25 -0
- package/components/chip/chip-md.less +30 -0
- package/components/chip/chip-rtl.css +1 -0
- package/components/chip/chip-vars.less +42 -0
- package/components/chip/chip.css +1 -0
- package/components/chip/chip.d.ts +14 -0
- package/components/chip/chip.js +3 -0
- package/components/chip/chip.less +106 -0
- package/components/color-picker/color-picker-class.js +871 -0
- package/components/color-picker/color-picker-ios.less +2 -0
- package/components/color-picker/color-picker-md.less +2 -0
- package/components/color-picker/color-picker-rtl.css +1 -0
- package/components/color-picker/color-picker-vars.less +39 -0
- package/components/color-picker/color-picker.css +1 -0
- package/components/color-picker/color-picker.d.ts +233 -0
- package/components/color-picker/color-picker.js +92 -0
- package/components/color-picker/color-picker.less +557 -0
- package/components/color-picker/modules/alpha-slider.js +91 -0
- package/components/color-picker/modules/brightness-slider.js +80 -0
- package/components/color-picker/modules/current-color.js +14 -0
- package/components/color-picker/modules/hex.js +71 -0
- package/components/color-picker/modules/hs-spectrum.js +118 -0
- package/components/color-picker/modules/hsb-sliders.js +191 -0
- package/components/color-picker/modules/hue-slider.js +73 -0
- package/components/color-picker/modules/initial-current-colors.js +43 -0
- package/components/color-picker/modules/palette.js +46 -0
- package/components/color-picker/modules/rgb-bars.js +183 -0
- package/components/color-picker/modules/rgb-sliders.js +185 -0
- package/components/color-picker/modules/sb-spectrum.js +119 -0
- package/components/color-picker/modules/wheel.js +173 -0
- package/components/contacts-list/contacts-list-ios.less +2 -0
- package/components/contacts-list/contacts-list-md.less +21 -0
- package/components/contacts-list/contacts-list-rtl.css +1 -0
- package/components/contacts-list/contacts-list-vars.less +24 -0
- package/components/contacts-list/contacts-list.css +1 -0
- package/components/contacts-list/contacts-list.d.ts +14 -0
- package/components/contacts-list/contacts-list.js +3 -0
- package/components/contacts-list/contacts-list.less +26 -0
- package/components/data-table/data-table-class.js +141 -0
- package/components/data-table/data-table-ios.less +70 -0
- package/components/data-table/data-table-md.less +88 -0
- package/components/data-table/data-table-rtl.css +1 -0
- package/components/data-table/data-table-vars.less +77 -0
- package/components/data-table/data-table.css +1 -0
- package/components/data-table/data-table.d.ts +61 -0
- package/components/data-table/data-table.js +64 -0
- package/components/data-table/data-table.less +429 -0
- package/components/dialog/dialog-class.js +196 -0
- package/components/dialog/dialog-ios.less +94 -0
- package/components/dialog/dialog-md.less +86 -0
- package/components/dialog/dialog-rtl.css +1 -0
- package/components/dialog/dialog-vars.less +93 -0
- package/components/dialog/dialog.css +1 -0
- package/components/dialog/dialog.d.ts +245 -0
- package/components/dialog/dialog.js +242 -0
- package/components/dialog/dialog.less +142 -0
- package/components/fab/fab-ios.less +9 -0
- package/components/fab/fab-md.less +11 -0
- package/components/fab/fab-rtl.css +1 -0
- package/components/fab/fab-vars.less +46 -0
- package/components/fab/fab.css +1 -0
- package/components/fab/fab.d.ts +32 -0
- package/components/fab/fab.js +172 -0
- package/components/fab/fab.less +523 -0
- package/components/form/form-ios.less +0 -0
- package/components/form/form-md.less +0 -0
- package/components/form/form-rtl.css +0 -0
- package/components/form/form.css +0 -0
- package/components/form/form.d.ts +64 -0
- package/components/form/form.js +311 -0
- package/components/form/form.less +7 -0
- package/components/gauge/gauge-class.js +298 -0
- package/components/gauge/gauge-ios.less +2 -0
- package/components/gauge/gauge-md.less +2 -0
- package/components/gauge/gauge-rtl.css +1 -0
- package/components/gauge/gauge.css +1 -0
- package/components/gauge/gauge.d.ts +100 -0
- package/components/gauge/gauge.js +90 -0
- package/components/gauge/gauge.less +24 -0
- package/components/grid/grid-ios.less +2 -0
- package/components/grid/grid-md.less +2 -0
- package/components/grid/grid-rtl.css +1 -0
- package/components/grid/grid-vars.less +3 -0
- package/components/grid/grid.css +1 -0
- package/components/grid/grid.d.ts +15 -0
- package/components/grid/grid.js +3 -0
- package/components/grid/grid.less +78 -0
- package/components/icon/icon-ios.less +44 -0
- package/components/icon/icon-md.less +56 -0
- package/components/icon/icon.d.ts +14 -0
- package/components/icon/icon.js +3 -0
- package/components/icon/icon.less +33 -0
- package/components/infinite-scroll/infinite-scroll-ios.less +11 -0
- package/components/infinite-scroll/infinite-scroll-md.less +6 -0
- package/components/infinite-scroll/infinite-scroll-rtl.css +1 -0
- package/components/infinite-scroll/infinite-scroll.css +1 -0
- package/components/infinite-scroll/infinite-scroll.d.ts +27 -0
- package/components/infinite-scroll/infinite-scroll.js +94 -0
- package/components/infinite-scroll/infinite-scroll.less +15 -0
- package/components/input/input-ios.less +129 -0
- package/components/input/input-md.less +171 -0
- package/components/input/input-rtl.css +1 -0
- package/components/input/input-vars.less +94 -0
- package/components/input/input.css +1 -0
- package/components/input/input.d.ts +60 -0
- package/components/input/input.js +339 -0
- package/components/input/input.less +355 -0
- package/components/link/link-ios.less +9 -0
- package/components/link/link-md.less +2 -0
- package/components/link/link-vars.less +9 -0
- package/components/link/link.d.ts +14 -0
- package/components/link/link.js +3 -0
- package/components/link/link.less +37 -0
- package/components/list/list-ios.less +15 -0
- package/components/list/list-md.less +5 -0
- package/components/list/list-vars.less +184 -0
- package/components/list/list.d.ts +14 -0
- package/components/list/list.js +3 -0
- package/components/list/list.less +718 -0
- package/components/list-index/list-index-class.js +333 -0
- package/components/list-index/list-index-ios.less +21 -0
- package/components/list-index/list-index-md.less +7 -0
- package/components/list-index/list-index-rtl.css +1 -0
- package/components/list-index/list-index-vars.less +25 -0
- package/components/list-index/list-index.css +1 -0
- package/components/list-index/list-index.d.ts +101 -0
- package/components/list-index/list-index.js +65 -0
- package/components/list-index/list-index.less +130 -0
- package/components/login-screen/login-screen-class.js +38 -0
- package/components/login-screen/login-screen-ios.less +2 -0
- package/components/login-screen/login-screen-md.less +2 -0
- package/components/login-screen/login-screen-rtl.css +1 -0
- package/components/login-screen/login-screen-vars.less +33 -0
- package/components/login-screen/login-screen.css +1 -0
- package/components/login-screen/login-screen.d.ts +99 -0
- package/components/login-screen/login-screen.js +32 -0
- package/components/login-screen/login-screen.less +100 -0
- package/components/messagebar/messagebar-class.js +367 -0
- package/components/messagebar/messagebar-ios.less +88 -0
- package/components/messagebar/messagebar-md.less +114 -0
- package/components/messagebar/messagebar-rtl.css +1 -0
- package/components/messagebar/messagebar-vars.less +75 -0
- package/components/messagebar/messagebar.css +1 -0
- package/components/messagebar/messagebar.d.ts +165 -0
- package/components/messagebar/messagebar.js +66 -0
- package/components/messagebar/messagebar.less +162 -0
- package/components/messages/messages-class.js +487 -0
- package/components/messages/messages-ios.less +165 -0
- package/components/messages/messages-md.less +140 -0
- package/components/messages/messages-rtl.css +1 -0
- package/components/messages/messages-vars.less +82 -0
- package/components/messages/messages.css +1 -0
- package/components/messages/messages.d.ts +162 -0
- package/components/messages/messages.js +65 -0
- package/components/messages/messages.less +218 -0
- package/components/modal/custom-modal-class.js +66 -0
- package/components/modal/modal-class.js +224 -0
- package/components/modal/modal.d.ts +82 -0
- package/components/modal/modal.js +22 -0
- package/components/modal/modal.less +14 -0
- package/components/navbar/navbar-ios.less +755 -0
- package/components/navbar/navbar-md.less +65 -0
- package/components/navbar/navbar-vars.less +74 -0
- package/components/navbar/navbar.d.ts +77 -0
- package/components/navbar/navbar.js +712 -0
- package/components/navbar/navbar.less +311 -0
- package/components/notification/notification-class.js +212 -0
- package/components/notification/notification-ios.less +55 -0
- package/components/notification/notification-md.less +87 -0
- package/components/notification/notification-rtl.css +1 -0
- package/components/notification/notification-vars.less +75 -0
- package/components/notification/notification.css +1 -0
- package/components/notification/notification.d.ts +122 -0
- package/components/notification/notification.js +33 -0
- package/components/notification/notification.less +94 -0
- package/components/page/page-ios.less +154 -0
- package/components/page/page-md.less +83 -0
- package/components/page/page-transitions/circle.less +107 -0
- package/components/page/page-transitions/cover-v.less +61 -0
- package/components/page/page-transitions/cover.less +71 -0
- package/components/page/page-transitions/dive.less +77 -0
- package/components/page/page-transitions/fade.less +53 -0
- package/components/page/page-transitions/flip.less +91 -0
- package/components/page/page-transitions/parallax.less +75 -0
- package/components/page/page-transitions/push.less +75 -0
- package/components/page/page-vars.less +47 -0
- package/components/page/page.d.ts +14 -0
- package/components/page/page.js +3 -0
- package/components/page/page.less +204 -0
- package/components/panel/panel-class.js +556 -0
- package/components/panel/panel-ios.less +2 -0
- package/components/panel/panel-md.less +11 -0
- package/components/panel/panel-rtl.css +3 -0
- package/components/panel/panel-vars.less +24 -0
- package/components/panel/panel.css +3 -0
- package/components/panel/panel.d.ts +198 -0
- package/components/panel/panel.js +189 -0
- package/components/panel/panel.less +403 -0
- package/components/panel/resizable-panel.js +160 -0
- package/components/panel/swipe-panel.js +311 -0
- package/components/photo-browser/photo-browser-class.js +734 -0
- package/components/photo-browser/photo-browser-ios.less +2 -0
- package/components/photo-browser/photo-browser-md.less +2 -0
- package/components/photo-browser/photo-browser-rtl.css +1 -0
- package/components/photo-browser/photo-browser-vars.less +16 -0
- package/components/photo-browser/photo-browser.css +1 -0
- package/components/photo-browser/photo-browser.d.ts +204 -0
- package/components/photo-browser/photo-browser.js +73 -0
- package/components/photo-browser/photo-browser.less +358 -0
- package/components/picker/picker-class.js +588 -0
- package/components/picker/picker-column.js +121 -0
- package/components/picker/picker-ios.less +12 -0
- package/components/picker/picker-md.less +8 -0
- package/components/picker/picker-rtl.css +1 -0
- package/components/picker/picker-vars.less +35 -0
- package/components/picker/picker.css +1 -0
- package/components/picker/picker.d.ts +209 -0
- package/components/picker/picker.js +59 -0
- package/components/picker/picker.less +180 -0
- package/components/pie-chart/pie-chart-class.js +250 -0
- package/components/pie-chart/pie-chart-ios.less +2 -0
- package/components/pie-chart/pie-chart-md.less +2 -0
- package/components/pie-chart/pie-chart-rtl.css +1 -0
- package/components/pie-chart/pie-chart.css +1 -0
- package/components/pie-chart/pie-chart.d.ts +99 -0
- package/components/pie-chart/pie-chart.js +32 -0
- package/components/pie-chart/pie-chart.less +43 -0
- package/components/popover/popover-class.js +293 -0
- package/components/popover/popover-ios.less +6 -0
- package/components/popover/popover-md.less +41 -0
- package/components/popover/popover-rtl.css +1 -0
- package/components/popover/popover-vars.less +25 -0
- package/components/popover/popover.css +1 -0
- package/components/popover/popover.d.ts +137 -0
- package/components/popover/popover.js +75 -0
- package/components/popover/popover.less +168 -0
- package/components/popup/popup-class.js +329 -0
- package/components/popup/popup-ios.less +2 -0
- package/components/popup/popup-md.less +2 -0
- package/components/popup/popup-rtl.css +1 -0
- package/components/popup/popup-vars.less +21 -0
- package/components/popup/popup.css +1 -0
- package/components/popup/popup.d.ts +143 -0
- package/components/popup/popup.js +46 -0
- package/components/popup/popup.less +204 -0
- package/components/preloader/preloader-ios.less +57 -0
- package/components/preloader/preloader-md.less +114 -0
- package/components/preloader/preloader-rtl.css +1 -0
- package/components/preloader/preloader-vars.less +16 -0
- package/components/preloader/preloader.css +1 -0
- package/components/preloader/preloader.d.ts +26 -0
- package/components/preloader/preloader.js +106 -0
- package/components/preloader/preloader.less +60 -0
- package/components/progressbar/progressbar-ios.less +59 -0
- package/components/progressbar/progressbar-md.less +141 -0
- package/components/progressbar/progressbar-rtl.css +1 -0
- package/components/progressbar/progressbar-vars.less +22 -0
- package/components/progressbar/progressbar.css +1 -0
- package/components/progressbar/progressbar.d.ts +31 -0
- package/components/progressbar/progressbar.js +150 -0
- package/components/progressbar/progressbar.less +111 -0
- package/components/pull-to-refresh/pull-to-refresh-class.js +512 -0
- package/components/pull-to-refresh/pull-to-refresh-ios.less +88 -0
- package/components/pull-to-refresh/pull-to-refresh-md.less +129 -0
- package/components/pull-to-refresh/pull-to-refresh-rtl.css +1 -0
- package/components/pull-to-refresh/pull-to-refresh-vars.less +14 -0
- package/components/pull-to-refresh/pull-to-refresh.css +1 -0
- package/components/pull-to-refresh/pull-to-refresh.d.ts +103 -0
- package/components/pull-to-refresh/pull-to-refresh.js +62 -0
- package/components/pull-to-refresh/pull-to-refresh.less +38 -0
- package/components/radio/radio-ios.less +61 -0
- package/components/radio/radio-md.less +64 -0
- package/components/radio/radio-rtl.css +1 -0
- package/components/radio/radio-vars.less +24 -0
- package/components/radio/radio.css +1 -0
- package/components/radio/radio.d.ts +14 -0
- package/components/radio/radio.js +3 -0
- package/components/radio/radio.less +64 -0
- package/components/range/range-class.js +577 -0
- package/components/range/range-ios.less +9 -0
- package/components/range/range-md.less +41 -0
- package/components/range/range-rtl.css +1 -0
- package/components/range/range-vars.less +61 -0
- package/components/range/range.css +1 -0
- package/components/range/range.d.ts +143 -0
- package/components/range/range.js +75 -0
- package/components/range/range.less +235 -0
- package/components/searchbar/remove-diacritics.js +271 -0
- package/components/searchbar/searchbar-class.js +592 -0
- package/components/searchbar/searchbar-ios.less +107 -0
- package/components/searchbar/searchbar-md.less +147 -0
- package/components/searchbar/searchbar-rtl.css +1 -0
- package/components/searchbar/searchbar-vars.less +77 -0
- package/components/searchbar/searchbar.css +1 -0
- package/components/searchbar/searchbar.d.ts +161 -0
- package/components/searchbar/searchbar.js +122 -0
- package/components/searchbar/searchbar.less +322 -0
- package/components/sheet/sheet-class.js +673 -0
- package/components/sheet/sheet-ios.less +2 -0
- package/components/sheet/sheet-md.less +9 -0
- package/components/sheet/sheet-rtl.css +1 -0
- package/components/sheet/sheet-vars.less +27 -0
- package/components/sheet/sheet.css +1 -0
- package/components/sheet/sheet.d.ts +170 -0
- package/components/sheet/sheet.js +76 -0
- package/components/sheet/sheet.less +196 -0
- package/components/skeleton/skeleton-ios.less +2 -0
- package/components/skeleton/skeleton-md.less +2 -0
- package/components/skeleton/skeleton-rtl.css +1 -0
- package/components/skeleton/skeleton-vars.less +8 -0
- package/components/skeleton/skeleton.css +1 -0
- package/components/skeleton/skeleton.d.ts +14 -0
- package/components/skeleton/skeleton.js +3 -0
- package/components/skeleton/skeleton.less +11 -0
- package/components/smart-select/smart-select-class.js +874 -0
- package/components/smart-select/smart-select-ios.less +2 -0
- package/components/smart-select/smart-select-md.less +2 -0
- package/components/smart-select/smart-select-rtl.css +1 -0
- package/components/smart-select/smart-select-vars.less +6 -0
- package/components/smart-select/smart-select.css +1 -0
- package/components/smart-select/smart-select.d.ts +204 -0
- package/components/smart-select/smart-select.js +138 -0
- package/components/smart-select/smart-select.less +42 -0
- package/components/sortable/sortable-ios.less +7 -0
- package/components/sortable/sortable-md.less +7 -0
- package/components/sortable/sortable-rtl.css +1 -0
- package/components/sortable/sortable-vars.less +22 -0
- package/components/sortable/sortable.css +1 -0
- package/components/sortable/sortable.d.ts +50 -0
- package/components/sortable/sortable.js +286 -0
- package/components/sortable/sortable.less +133 -0
- package/components/statusbar/statusbar-ios.less +2 -0
- package/components/statusbar/statusbar-md.less +2 -0
- package/components/statusbar/statusbar.d.ts +54 -0
- package/components/statusbar/statusbar.js +190 -0
- package/components/statusbar/statusbar.less +7 -0
- package/components/stepper/stepper-class.js +403 -0
- package/components/stepper/stepper-ios.less +36 -0
- package/components/stepper/stepper-md.less +16 -0
- package/components/stepper/stepper-rtl.css +1 -0
- package/components/stepper/stepper-vars.less +40 -0
- package/components/stepper/stepper.css +1 -0
- package/components/stepper/stepper.d.ts +121 -0
- package/components/stepper/stepper.js +82 -0
- package/components/stepper/stepper.less +178 -0
- package/components/subnavbar/subnavbar-ios.less +51 -0
- package/components/subnavbar/subnavbar-md.less +47 -0
- package/components/subnavbar/subnavbar-vars.less +36 -0
- package/components/subnavbar/subnavbar.d.ts +11 -0
- package/components/subnavbar/subnavbar.js +17 -0
- package/components/subnavbar/subnavbar.less +128 -0
- package/components/swipeout/swipeout-ios.less +2 -0
- package/components/swipeout/swipeout-md.less +2 -0
- package/components/swipeout/swipeout-rtl.css +1 -0
- package/components/swipeout/swipeout-vars.less +24 -0
- package/components/swipeout/swipeout.css +1 -0
- package/components/swipeout/swipeout.d.ts +68 -0
- package/components/swipeout/swipeout.js +513 -0
- package/components/swipeout/swipeout.less +109 -0
- package/components/swiper/swiper-ios.less +2 -0
- package/components/swiper/swiper-md.less +2 -0
- package/components/swiper/swiper-rtl.css +1 -0
- package/components/swiper/swiper.css +1 -0
- package/components/swiper/swiper.d.ts +25 -0
- package/components/swiper/swiper.js +141 -0
- package/components/swiper/swiper.less +5 -0
- package/components/tabs/tabs-ios.less +2 -0
- package/components/tabs/tabs-md.less +2 -0
- package/components/tabs/tabs-rtl.css +1 -0
- package/components/tabs/tabs.css +1 -0
- package/components/tabs/tabs.d.ts +39 -0
- package/components/tabs/tabs.js +243 -0
- package/components/tabs/tabs.less +45 -0
- package/components/text-editor/text-editor-class.js +516 -0
- package/components/text-editor/text-editor-ios.less +9 -0
- package/components/text-editor/text-editor-md.less +11 -0
- package/components/text-editor/text-editor-rtl.css +1 -0
- package/components/text-editor/text-editor-vars.less +51 -0
- package/components/text-editor/text-editor.css +1 -0
- package/components/text-editor/text-editor.d.ts +166 -0
- package/components/text-editor/text-editor.js +81 -0
- package/components/text-editor/text-editor.less +153 -0
- package/components/timeline/timeline-ios.less +11 -0
- package/components/timeline/timeline-md.less +7 -0
- package/components/timeline/timeline-rtl.css +1 -0
- package/components/timeline/timeline-vars.less +64 -0
- package/components/timeline/timeline.css +1 -0
- package/components/timeline/timeline.d.ts +14 -0
- package/components/timeline/timeline.js +3 -0
- package/components/timeline/timeline.less +413 -0
- package/components/toast/toast-class.js +105 -0
- package/components/toast/toast-ios.less +81 -0
- package/components/toast/toast-md.less +72 -0
- package/components/toast/toast-rtl.css +1 -0
- package/components/toast/toast-vars.less +24 -0
- package/components/toast/toast.css +1 -0
- package/components/toast/toast.d.ts +121 -0
- package/components/toast/toast.js +40 -0
- package/components/toast/toast.less +62 -0
- package/components/toggle/toggle-class.js +165 -0
- package/components/toggle/toggle-ios.less +70 -0
- package/components/toggle/toggle-md.less +44 -0
- package/components/toggle/toggle-rtl.css +1 -0
- package/components/toggle/toggle-vars.less +30 -0
- package/components/toggle/toggle.css +1 -0
- package/components/toggle/toggle.d.ts +73 -0
- package/components/toggle/toggle.js +57 -0
- package/components/toggle/toggle.less +52 -0
- package/components/toolbar/toolbar-ios.less +47 -0
- package/components/toolbar/toolbar-md.less +77 -0
- package/components/toolbar/toolbar-vars.less +71 -0
- package/components/toolbar/toolbar.d.ts +43 -0
- package/components/toolbar/toolbar.js +198 -0
- package/components/toolbar/toolbar.less +306 -0
- package/components/tooltip/tooltip-class.js +336 -0
- package/components/tooltip/tooltip-ios.less +2 -0
- package/components/tooltip/tooltip-md.less +2 -0
- package/components/tooltip/tooltip-rtl.css +1 -0
- package/components/tooltip/tooltip-vars.less +19 -0
- package/components/tooltip/tooltip.css +1 -0
- package/components/tooltip/tooltip.d.ts +105 -0
- package/components/tooltip/tooltip.js +129 -0
- package/components/tooltip/tooltip.less +39 -0
- package/components/touch-ripple/touch-ripple-class.js +85 -0
- package/components/touch-ripple/touch-ripple-ios.less +2 -0
- package/components/touch-ripple/touch-ripple-md.less +2 -0
- package/components/touch-ripple/touch-ripple-vars.less +8 -0
- package/components/touch-ripple/touch-ripple.d.ts +25 -0
- package/components/touch-ripple/touch-ripple.js +18 -0
- package/components/touch-ripple/touch-ripple.less +114 -0
- package/components/treeview/treeview-ios.less +2 -0
- package/components/treeview/treeview-md.less +2 -0
- package/components/treeview/treeview-rtl.css +1 -0
- package/components/treeview/treeview-vars.less +38 -0
- package/components/treeview/treeview.css +1 -0
- package/components/treeview/treeview.d.ts +42 -0
- package/components/treeview/treeview.js +74 -0
- package/components/treeview/treeview.less +160 -0
- package/components/typography/typography-ios.less +2 -0
- package/components/typography/typography-md.less +2 -0
- package/components/typography/typography-rtl.css +1 -0
- package/components/typography/typography-vars.less +4 -0
- package/components/typography/typography.css +1 -0
- package/components/typography/typography.d.ts +14 -0
- package/components/typography/typography.js +3 -0
- package/components/typography/typography.less +220 -0
- package/components/view/resizable-view.js +125 -0
- package/components/view/view-class.js +206 -0
- package/components/view/view-ios.less +2 -0
- package/components/view/view-md.less +2 -0
- package/components/view/view.d.ts +199 -0
- package/components/view/view.js +173 -0
- package/components/view/view.less +35 -0
- package/components/virtual-list/virtual-list-class.js +583 -0
- package/components/virtual-list/virtual-list-ios.less +2 -0
- package/components/virtual-list/virtual-list-md.less +2 -0
- package/components/virtual-list/virtual-list-rtl.css +0 -0
- package/components/virtual-list/virtual-list.css +0 -0
- package/components/virtual-list/virtual-list.d.ts +142 -0
- package/components/virtual-list/virtual-list.js +17 -0
- package/components/virtual-list/virtual-list.less +7 -0
- package/framework7-bundle-rtl.css +19821 -0
- package/framework7-bundle-rtl.min.css +19 -0
- package/framework7-bundle.css +19802 -0
- package/framework7-bundle.esm.js +93 -0
- package/framework7-bundle.js +48416 -0
- package/framework7-bundle.js.map +1 -0
- package/framework7-bundle.less +92 -0
- package/framework7-bundle.min.css +19 -0
- package/framework7-bundle.min.js +14 -0
- package/framework7-bundle.min.js.map +1 -0
- package/framework7-lite-bundle.esm.js +86 -0
- package/framework7-lite.esm.js +37 -0
- package/framework7-lite.js +31 -0
- package/framework7-rtl.css +5252 -0
- package/framework7-rtl.min.css +17 -0
- package/framework7-types.d.ts +336 -0
- package/framework7.css +5245 -0
- package/framework7.d.ts +322 -0
- package/framework7.esm.js +41 -0
- package/framework7.js +42 -0
- package/framework7.less +41 -0
- package/framework7.min.css +17 -0
- package/less/mixins.less +281 -0
- package/less/plugin.js +15 -0
- package/less/vars.less +7 -0
- package/modules/clicks/clicks.d.ts +19 -0
- package/modules/clicks/clicks.js +94 -0
- package/modules/component/$h.js +15 -0
- package/modules/component/$jsx.js +17 -0
- package/modules/component/component-class.js +517 -0
- package/modules/component/component.d.ts +111 -0
- package/modules/component/component.js +44 -0
- package/modules/component/custom-components.js +1 -0
- package/modules/component/eventslisteners.js +74 -0
- package/modules/component/parse-component.js +79 -0
- package/modules/component/patch.js +8 -0
- package/modules/component/snabbdom/h.d.ts +10 -0
- package/modules/component/snabbdom/h.js +50 -0
- package/modules/component/snabbdom/helpers/attachto.d.ts +9 -0
- package/modules/component/snabbdom/helpers/attachto.js +49 -0
- package/modules/component/snabbdom/hooks.d.ts +23 -0
- package/modules/component/snabbdom/hooks.js +0 -0
- package/modules/component/snabbdom/htmldomapi.d.ts +19 -0
- package/modules/component/snabbdom/htmldomapi.js +67 -0
- package/modules/component/snabbdom/is.d.ts +2 -0
- package/modules/component/snabbdom/is.js +4 -0
- package/modules/component/snabbdom/modules/attributes.d.ts +4 -0
- package/modules/component/snabbdom/modules/attributes.js +51 -0
- package/modules/component/snabbdom/modules/class.d.ts +4 -0
- package/modules/component/snabbdom/modules/class.js +27 -0
- package/modules/component/snabbdom/modules/dataset.d.ts +4 -0
- package/modules/component/snabbdom/modules/dataset.js +37 -0
- package/modules/component/snabbdom/modules/eventlisteners.d.ts +8 -0
- package/modules/component/snabbdom/modules/eventlisteners.js +93 -0
- package/modules/component/snabbdom/modules/hero.d.ts +6 -0
- package/modules/component/snabbdom/modules/hero.js +147 -0
- package/modules/component/snabbdom/modules/module.d.ts +9 -0
- package/modules/component/snabbdom/modules/module.js +0 -0
- package/modules/component/snabbdom/modules/props.d.ts +4 -0
- package/modules/component/snabbdom/modules/props.js +29 -0
- package/modules/component/snabbdom/modules/style.d.ts +7 -0
- package/modules/component/snabbdom/modules/style.js +93 -0
- package/modules/component/snabbdom/snabbdom.bundle.d.ts +5 -0
- package/modules/component/snabbdom/snabbdom.bundle.js +13 -0
- package/modules/component/snabbdom/snabbdom.d.ts +6 -0
- package/modules/component/snabbdom/snabbdom.js +282 -0
- package/modules/component/snabbdom/thunk.d.ts +14 -0
- package/modules/component/snabbdom/thunk.js +50 -0
- package/modules/component/snabbdom/tovnode.d.ts +4 -0
- package/modules/component/snabbdom/tovnode.js +40 -0
- package/modules/component/snabbdom/vnode.d.ts +36 -0
- package/modules/component/snabbdom/vnode.js +12 -0
- package/modules/component/vdom.js +319 -0
- package/modules/demo-module.js +44 -0
- package/modules/device/device.d.ts +14 -0
- package/modules/device/device.js +44 -0
- package/modules/history/history.js +12 -0
- package/modules/resize/resize.d.ts +25 -0
- package/modules/resize/resize.js +62 -0
- package/modules/router/app-router-check.js +5 -0
- package/modules/router/async-component.js +27 -0
- package/modules/router/back.js +723 -0
- package/modules/router/clear-previous-history.js +31 -0
- package/modules/router/component-loader.js +200 -0
- package/modules/router/modal.js +223 -0
- package/modules/router/navigate.js +814 -0
- package/modules/router/process-route-queue.js +66 -0
- package/modules/router/redirect.js +38 -0
- package/modules/router/router-class.js +1268 -0
- package/modules/router/router.d.ts +354 -0
- package/modules/router/router.js +26 -0
- package/modules/router/swipe-back.js +589 -0
- package/modules/router/tab.js +230 -0
- package/modules/service-worker/service-worker.d.ts +38 -0
- package/modules/service-worker/service-worker.js +86 -0
- package/modules/store/create-store.js +138 -0
- package/modules/store/store.d.ts +40 -0
- package/modules/store/store.js +11 -0
- package/modules/support/support.d.ts +15 -0
- package/modules/support/support.js +7 -0
- package/modules/touch/touch.d.ts +60 -0
- package/modules/touch/touch.js +482 -0
- package/modules/utils/utils.d.ts +15 -0
- package/modules/utils/utils.js +10 -0
- package/package.json +458 -0
- package/shared/$jsx.js +21 -0
- package/shared/class.js +146 -0
- package/shared/constructor-methods.js +52 -0
- package/shared/dom7.js +7 -0
- package/shared/events-class.js +95 -0
- package/shared/get-device.d.ts +52 -0
- package/shared/get-device.js +147 -0
- package/shared/get-support.d.ts +12 -0
- package/shared/get-support.js +35 -0
- package/shared/history.js +171 -0
- package/shared/material-color-utils.js +1377 -0
- package/shared/material-colors.js +75 -0
- package/shared/modal-methods.js +80 -0
- package/shared/utils.d.ts +88 -0
- package/shared/utils.js +535 -0
|
@@ -0,0 +1,1377 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
function signum(num) {
|
|
3
|
+
return num < 0 ? -1 : 0 === num ? 0 : 1;
|
|
4
|
+
}
|
|
5
|
+
function lerp(start, stop, amount) {
|
|
6
|
+
return (1 - amount) * start + amount * stop;
|
|
7
|
+
}
|
|
8
|
+
function clampInt(min, max, input) {
|
|
9
|
+
return input < min ? min : input > max ? max : input;
|
|
10
|
+
}
|
|
11
|
+
function clampDouble(min, max, input) {
|
|
12
|
+
return input < min ? min : input > max ? max : input;
|
|
13
|
+
}
|
|
14
|
+
function sanitizeDegreesDouble(degrees) {
|
|
15
|
+
return (degrees %= 360) < 0 && (degrees += 360), degrees;
|
|
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);
|
|
22
|
+
}
|
|
23
|
+
function matrixMultiply(row, matrix) {
|
|
24
|
+
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]];
|
|
25
|
+
}
|
|
26
|
+
const SRGB_TO_XYZ = [[.41233895, .35762064, .18051042], [.2126, .7152, .0722], [.01932141, .11916382, .95034478]],
|
|
27
|
+
XYZ_TO_SRGB = [[3.2413774792388685, -1.5376652402851851, -.49885366846268053], [-.9691452513005321, 1.8758853451067872, .04156585616912061], [.05562093689691305, -.20395524564742123, 1.0571799111220335]],
|
|
28
|
+
WHITE_POINT_D65 = [95.047, 100, 108.883];
|
|
29
|
+
function argbFromRgb(red, green, blue) {
|
|
30
|
+
return (255 << 24 | (255 & red) << 16 | (255 & green) << 8 | 255 & blue) >>> 0;
|
|
31
|
+
}
|
|
32
|
+
function argbFromLinrgb(linrgb) {
|
|
33
|
+
return argbFromRgb(delinearized(linrgb[0]), delinearized(linrgb[1]), delinearized(linrgb[2]));
|
|
34
|
+
}
|
|
35
|
+
function redFromArgb(argb) {
|
|
36
|
+
return argb >> 16 & 255;
|
|
37
|
+
}
|
|
38
|
+
function greenFromArgb(argb) {
|
|
39
|
+
return argb >> 8 & 255;
|
|
40
|
+
}
|
|
41
|
+
function blueFromArgb(argb) {
|
|
42
|
+
return 255 & argb;
|
|
43
|
+
}
|
|
44
|
+
function argbFromXyz(x, y, z) {
|
|
45
|
+
const matrix = XYZ_TO_SRGB,
|
|
46
|
+
linearR = matrix[0][0] * x + matrix[0][1] * y + matrix[0][2] * z,
|
|
47
|
+
linearG = matrix[1][0] * x + matrix[1][1] * y + matrix[1][2] * z,
|
|
48
|
+
linearB = matrix[2][0] * x + matrix[2][1] * y + matrix[2][2] * z;
|
|
49
|
+
return argbFromRgb(delinearized(linearR), delinearized(linearG), delinearized(linearB));
|
|
50
|
+
}
|
|
51
|
+
function xyzFromArgb(argb) {
|
|
52
|
+
return matrixMultiply([linearized(redFromArgb(argb)), linearized(greenFromArgb(argb)), linearized(blueFromArgb(argb))], SRGB_TO_XYZ);
|
|
53
|
+
}
|
|
54
|
+
function argbFromLstar(lstar) {
|
|
55
|
+
const component = delinearized(yFromLstar(lstar));
|
|
56
|
+
return argbFromRgb(component, component, component);
|
|
57
|
+
}
|
|
58
|
+
function lstarFromArgb(argb) {
|
|
59
|
+
return 116 * labF(xyzFromArgb(argb)[1] / 100) - 16;
|
|
60
|
+
}
|
|
61
|
+
function yFromLstar(lstar) {
|
|
62
|
+
return 100 * labInvf((lstar + 16) / 116);
|
|
63
|
+
}
|
|
64
|
+
function lstarFromY(y) {
|
|
65
|
+
return 116 * labF(y / 100) - 16;
|
|
66
|
+
}
|
|
67
|
+
function linearized(rgbComponent) {
|
|
68
|
+
const normalized = rgbComponent / 255;
|
|
69
|
+
return normalized <= .040449936 ? normalized / 12.92 * 100 : 100 * Math.pow((normalized + .055) / 1.055, 2.4);
|
|
70
|
+
}
|
|
71
|
+
function delinearized(rgbComponent) {
|
|
72
|
+
const normalized = rgbComponent / 100;
|
|
73
|
+
let delinearized = 0;
|
|
74
|
+
return delinearized = normalized <= .0031308 ? 12.92 * normalized : 1.055 * Math.pow(normalized, 1 / 2.4) - .055, clampInt(0, 255, Math.round(255 * delinearized));
|
|
75
|
+
}
|
|
76
|
+
function whitePointD65() {
|
|
77
|
+
return WHITE_POINT_D65;
|
|
78
|
+
}
|
|
79
|
+
function labF(t) {
|
|
80
|
+
return t > 216 / 24389 ? Math.pow(t, 1 / 3) : (903.2962962962963 * t + 16) / 116;
|
|
81
|
+
}
|
|
82
|
+
function labInvf(ft) {
|
|
83
|
+
const ft3 = ft * ft * ft;
|
|
84
|
+
return ft3 > 216 / 24389 ? ft3 : (116 * ft - 16) / 903.2962962962963;
|
|
85
|
+
}
|
|
86
|
+
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
|
+
}
|
|
103
|
+
const xyz = whitePoint,
|
|
104
|
+
rW = .401288 * xyz[0] + .650173 * xyz[1] + -.051461 * xyz[2],
|
|
105
|
+
gW = -.250268 * xyz[0] + 1.204414 * xyz[1] + .045854 * xyz[2],
|
|
106
|
+
bW = -.002079 * xyz[0] + .048952 * xyz[1] + .953127 * xyz[2],
|
|
107
|
+
f = .8 + surround / 10,
|
|
108
|
+
c = f >= .9 ? lerp(.59, .69, 10 * (f - .9)) : lerp(.525, .59, 10 * (f - .8));
|
|
109
|
+
let d = discountingIlluminant ? 1 : f * (1 - 1 / 3.6 * Math.exp((-adaptingLuminance - 42) / 92));
|
|
110
|
+
d = d > 1 ? 1 : d < 0 ? 0 : d;
|
|
111
|
+
const nc = f,
|
|
112
|
+
rgbD = [d * (100 / rW) + 1 - d, d * (100 / gW) + 1 - d, d * (100 / bW) + 1 - d],
|
|
113
|
+
k = 1 / (5 * adaptingLuminance + 1),
|
|
114
|
+
k4 = k * k * k * k,
|
|
115
|
+
k4F = 1 - k4,
|
|
116
|
+
fl = k4 * adaptingLuminance + .1 * k4F * k4F * Math.cbrt(5 * adaptingLuminance),
|
|
117
|
+
n = yFromLstar(backgroundLstar) / whitePoint[1],
|
|
118
|
+
z = 1.48 + Math.sqrt(n),
|
|
119
|
+
nbb = .725 / Math.pow(n, .2),
|
|
120
|
+
ncb = nbb,
|
|
121
|
+
rgbAFactors = [Math.pow(fl * rgbD[0] * rW / 100, .42), Math.pow(fl * rgbD[1] * gW / 100, .42), Math.pow(fl * rgbD[2] * bW / 100, .42)],
|
|
122
|
+
rgbA = [400 * rgbAFactors[0] / (rgbAFactors[0] + 27.13), 400 * rgbAFactors[1] / (rgbAFactors[1] + 27.13), 400 * rgbAFactors[2] / (rgbAFactors[2] + 27.13)];
|
|
123
|
+
return new ViewingConditions(n, (2 * rgbA[0] + rgbA[1] + .05 * rgbA[2]) * nbb, nbb, ncb, c, nc, rgbD, fl, Math.pow(fl, .25), z);
|
|
124
|
+
}
|
|
125
|
+
constructor(n, aw, nbb, ncb, c, nc, rgbD, fl, fLRoot, z) {
|
|
126
|
+
this.n = n, this.aw = aw, this.nbb = nbb, this.ncb = ncb, this.c = c, this.nc = nc, this.rgbD = rgbD, this.fl = fl, this.fLRoot = fLRoot, this.z = z;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
ViewingConditions.DEFAULT = ViewingConditions.make();
|
|
130
|
+
class Cam16 {
|
|
131
|
+
constructor(hue, chroma, j, q, m, s, jstar, astar, bstar) {
|
|
132
|
+
this.hue = hue, this.chroma = chroma, this.j = j, this.q = q, this.m = m, this.s = s, this.jstar = jstar, this.astar = astar, this.bstar = bstar;
|
|
133
|
+
}
|
|
134
|
+
distance(other) {
|
|
135
|
+
const dJ = this.jstar - other.jstar,
|
|
136
|
+
dA = this.astar - other.astar,
|
|
137
|
+
dB = this.bstar - other.bstar,
|
|
138
|
+
dEPrime = Math.sqrt(dJ * dJ + dA * dA + dB * dB);
|
|
139
|
+
return 1.41 * Math.pow(dEPrime, .63);
|
|
140
|
+
}
|
|
141
|
+
static fromInt(argb) {
|
|
142
|
+
return Cam16.fromIntInViewingConditions(argb, ViewingConditions.DEFAULT);
|
|
143
|
+
}
|
|
144
|
+
static fromIntInViewingConditions(argb, viewingConditions) {
|
|
145
|
+
const green = (65280 & argb) >> 8,
|
|
146
|
+
blue = 255 & argb,
|
|
147
|
+
redL = linearized((16711680 & argb) >> 16),
|
|
148
|
+
greenL = linearized(green),
|
|
149
|
+
blueL = linearized(blue),
|
|
150
|
+
x = .41233895 * redL + .35762064 * greenL + .18051042 * blueL,
|
|
151
|
+
y = .2126 * redL + .7152 * greenL + .0722 * blueL,
|
|
152
|
+
z = .01932141 * redL + .11916382 * greenL + .95034478 * blueL,
|
|
153
|
+
rC = .401288 * x + .650173 * y - .051461 * z,
|
|
154
|
+
gC = -.250268 * x + 1.204414 * y + .045854 * z,
|
|
155
|
+
bC = -.002079 * x + .048952 * y + .953127 * z,
|
|
156
|
+
rD = viewingConditions.rgbD[0] * rC,
|
|
157
|
+
gD = viewingConditions.rgbD[1] * gC,
|
|
158
|
+
bD = viewingConditions.rgbD[2] * bC,
|
|
159
|
+
rAF = Math.pow(viewingConditions.fl * Math.abs(rD) / 100, .42),
|
|
160
|
+
gAF = Math.pow(viewingConditions.fl * Math.abs(gD) / 100, .42),
|
|
161
|
+
bAF = Math.pow(viewingConditions.fl * Math.abs(bD) / 100, .42),
|
|
162
|
+
rA = 400 * signum(rD) * rAF / (rAF + 27.13),
|
|
163
|
+
gA = 400 * signum(gD) * gAF / (gAF + 27.13),
|
|
164
|
+
bA = 400 * signum(bD) * bAF / (bAF + 27.13),
|
|
165
|
+
a = (11 * rA + -12 * gA + bA) / 11,
|
|
166
|
+
b = (rA + gA - 2 * bA) / 9,
|
|
167
|
+
u = (20 * rA + 20 * gA + 21 * bA) / 20,
|
|
168
|
+
p2 = (40 * rA + 20 * gA + bA) / 20,
|
|
169
|
+
atanDegrees = 180 * Math.atan2(b, a) / Math.PI,
|
|
170
|
+
hue = atanDegrees < 0 ? atanDegrees + 360 : atanDegrees >= 360 ? atanDegrees - 360 : atanDegrees,
|
|
171
|
+
hueRadians = hue * Math.PI / 180,
|
|
172
|
+
ac = p2 * viewingConditions.nbb,
|
|
173
|
+
j = 100 * Math.pow(ac / viewingConditions.aw, viewingConditions.c * viewingConditions.z),
|
|
174
|
+
q = 4 / viewingConditions.c * Math.sqrt(j / 100) * (viewingConditions.aw + 4) * viewingConditions.fLRoot,
|
|
175
|
+
huePrime = hue < 20.14 ? hue + 360 : hue,
|
|
176
|
+
t = 5e4 / 13 * (.25 * (Math.cos(huePrime * Math.PI / 180 + 2) + 3.8)) * viewingConditions.nc * viewingConditions.ncb * Math.sqrt(a * a + b * b) / (u + .305),
|
|
177
|
+
alpha = Math.pow(t, .9) * Math.pow(1.64 - Math.pow(.29, viewingConditions.n), .73),
|
|
178
|
+
c = alpha * Math.sqrt(j / 100),
|
|
179
|
+
m = c * viewingConditions.fLRoot,
|
|
180
|
+
s = 50 * Math.sqrt(alpha * viewingConditions.c / (viewingConditions.aw + 4)),
|
|
181
|
+
jstar = (1 + 100 * .007) * j / (1 + .007 * j),
|
|
182
|
+
mstar = 1 / .0228 * Math.log(1 + .0228 * m),
|
|
183
|
+
astar = mstar * Math.cos(hueRadians),
|
|
184
|
+
bstar = mstar * Math.sin(hueRadians);
|
|
185
|
+
return new Cam16(hue, c, j, q, m, s, jstar, astar, bstar);
|
|
186
|
+
}
|
|
187
|
+
static fromJch(j, c, h) {
|
|
188
|
+
return Cam16.fromJchInViewingConditions(j, c, h, ViewingConditions.DEFAULT);
|
|
189
|
+
}
|
|
190
|
+
static fromJchInViewingConditions(j, c, h, viewingConditions) {
|
|
191
|
+
const q = 4 / viewingConditions.c * Math.sqrt(j / 100) * (viewingConditions.aw + 4) * viewingConditions.fLRoot,
|
|
192
|
+
m = c * viewingConditions.fLRoot,
|
|
193
|
+
alpha = c / Math.sqrt(j / 100),
|
|
194
|
+
s = 50 * Math.sqrt(alpha * viewingConditions.c / (viewingConditions.aw + 4)),
|
|
195
|
+
hueRadians = h * Math.PI / 180,
|
|
196
|
+
jstar = (1 + 100 * .007) * j / (1 + .007 * j),
|
|
197
|
+
mstar = 1 / .0228 * Math.log(1 + .0228 * m),
|
|
198
|
+
astar = mstar * Math.cos(hueRadians),
|
|
199
|
+
bstar = mstar * Math.sin(hueRadians);
|
|
200
|
+
return new Cam16(h, c, j, q, m, s, jstar, astar, bstar);
|
|
201
|
+
}
|
|
202
|
+
static fromUcs(jstar, astar, bstar) {
|
|
203
|
+
return Cam16.fromUcsInViewingConditions(jstar, astar, bstar, ViewingConditions.DEFAULT);
|
|
204
|
+
}
|
|
205
|
+
static fromUcsInViewingConditions(jstar, astar, bstar, viewingConditions) {
|
|
206
|
+
const a = astar,
|
|
207
|
+
b = bstar,
|
|
208
|
+
m = Math.sqrt(a * a + b * b),
|
|
209
|
+
c = (Math.exp(.0228 * m) - 1) / .0228 / viewingConditions.fLRoot;
|
|
210
|
+
let h = Math.atan2(b, a) * (180 / Math.PI);
|
|
211
|
+
h < 0 && (h += 360);
|
|
212
|
+
const j = jstar / (1 - .007 * (jstar - 100));
|
|
213
|
+
return Cam16.fromJchInViewingConditions(j, c, h, viewingConditions);
|
|
214
|
+
}
|
|
215
|
+
toInt() {
|
|
216
|
+
return this.viewed(ViewingConditions.DEFAULT);
|
|
217
|
+
}
|
|
218
|
+
viewed(viewingConditions) {
|
|
219
|
+
const alpha = 0 === this.chroma || 0 === this.j ? 0 : this.chroma / Math.sqrt(this.j / 100),
|
|
220
|
+
t = Math.pow(alpha / Math.pow(1.64 - Math.pow(.29, viewingConditions.n), .73), 1 / .9),
|
|
221
|
+
hRad = this.hue * Math.PI / 180,
|
|
222
|
+
eHue = .25 * (Math.cos(hRad + 2) + 3.8),
|
|
223
|
+
ac = viewingConditions.aw * Math.pow(this.j / 100, 1 / viewingConditions.c / viewingConditions.z),
|
|
224
|
+
p1 = eHue * (5e4 / 13) * viewingConditions.nc * viewingConditions.ncb,
|
|
225
|
+
p2 = ac / viewingConditions.nbb,
|
|
226
|
+
hSin = Math.sin(hRad),
|
|
227
|
+
hCos = Math.cos(hRad),
|
|
228
|
+
gamma = 23 * (p2 + .305) * t / (23 * p1 + 11 * t * hCos + 108 * t * hSin),
|
|
229
|
+
a = gamma * hCos,
|
|
230
|
+
b = gamma * hSin,
|
|
231
|
+
rA = (460 * p2 + 451 * a + 288 * b) / 1403,
|
|
232
|
+
gA = (460 * p2 - 891 * a - 261 * b) / 1403,
|
|
233
|
+
bA = (460 * p2 - 220 * a - 6300 * b) / 1403,
|
|
234
|
+
rCBase = Math.max(0, 27.13 * Math.abs(rA) / (400 - Math.abs(rA))),
|
|
235
|
+
rC = signum(rA) * (100 / viewingConditions.fl) * Math.pow(rCBase, 1 / .42),
|
|
236
|
+
gCBase = Math.max(0, 27.13 * Math.abs(gA) / (400 - Math.abs(gA))),
|
|
237
|
+
gC = signum(gA) * (100 / viewingConditions.fl) * Math.pow(gCBase, 1 / .42),
|
|
238
|
+
bCBase = Math.max(0, 27.13 * Math.abs(bA) / (400 - Math.abs(bA))),
|
|
239
|
+
bC = signum(bA) * (100 / viewingConditions.fl) * Math.pow(bCBase, 1 / .42),
|
|
240
|
+
rF = rC / viewingConditions.rgbD[0],
|
|
241
|
+
gF = gC / viewingConditions.rgbD[1],
|
|
242
|
+
bF = bC / viewingConditions.rgbD[2];
|
|
243
|
+
return argbFromXyz(1.86206786 * rF - 1.01125463 * gF + .14918677 * bF, .38752654 * rF + .62144744 * gF - .00897398 * bF, -.0158415 * rF - .03412294 * gF + 1.04996444 * bF);
|
|
244
|
+
}
|
|
245
|
+
static fromXyzInViewingConditions(x, y, z, viewingConditions) {
|
|
246
|
+
const rC = .401288 * x + .650173 * y - .051461 * z,
|
|
247
|
+
gC = -.250268 * x + 1.204414 * y + .045854 * z,
|
|
248
|
+
bC = -.002079 * x + .048952 * y + .953127 * z,
|
|
249
|
+
rD = viewingConditions.rgbD[0] * rC,
|
|
250
|
+
gD = viewingConditions.rgbD[1] * gC,
|
|
251
|
+
bD = viewingConditions.rgbD[2] * bC,
|
|
252
|
+
rAF = Math.pow(viewingConditions.fl * Math.abs(rD) / 100, .42),
|
|
253
|
+
gAF = Math.pow(viewingConditions.fl * Math.abs(gD) / 100, .42),
|
|
254
|
+
bAF = Math.pow(viewingConditions.fl * Math.abs(bD) / 100, .42),
|
|
255
|
+
rA = 400 * signum(rD) * rAF / (rAF + 27.13),
|
|
256
|
+
gA = 400 * signum(gD) * gAF / (gAF + 27.13),
|
|
257
|
+
bA = 400 * signum(bD) * bAF / (bAF + 27.13),
|
|
258
|
+
a = (11 * rA + -12 * gA + bA) / 11,
|
|
259
|
+
b = (rA + gA - 2 * bA) / 9,
|
|
260
|
+
u = (20 * rA + 20 * gA + 21 * bA) / 20,
|
|
261
|
+
p2 = (40 * rA + 20 * gA + bA) / 20,
|
|
262
|
+
atanDegrees = 180 * Math.atan2(b, a) / Math.PI,
|
|
263
|
+
hue = atanDegrees < 0 ? atanDegrees + 360 : atanDegrees >= 360 ? atanDegrees - 360 : atanDegrees,
|
|
264
|
+
hueRadians = hue * Math.PI / 180,
|
|
265
|
+
ac = p2 * viewingConditions.nbb,
|
|
266
|
+
J = 100 * Math.pow(ac / viewingConditions.aw, viewingConditions.c * viewingConditions.z),
|
|
267
|
+
Q = 4 / viewingConditions.c * Math.sqrt(J / 100) * (viewingConditions.aw + 4) * viewingConditions.fLRoot,
|
|
268
|
+
huePrime = hue < 20.14 ? hue + 360 : hue,
|
|
269
|
+
t = 5e4 / 13 * (1 / 4 * (Math.cos(huePrime * Math.PI / 180 + 2) + 3.8)) * viewingConditions.nc * viewingConditions.ncb * Math.sqrt(a * a + b * b) / (u + .305),
|
|
270
|
+
alpha = Math.pow(t, .9) * Math.pow(1.64 - Math.pow(.29, viewingConditions.n), .73),
|
|
271
|
+
C = alpha * Math.sqrt(J / 100),
|
|
272
|
+
M = C * viewingConditions.fLRoot,
|
|
273
|
+
s = 50 * Math.sqrt(alpha * viewingConditions.c / (viewingConditions.aw + 4)),
|
|
274
|
+
jstar = (1 + 100 * .007) * J / (1 + .007 * J),
|
|
275
|
+
mstar = Math.log(1 + .0228 * M) / .0228,
|
|
276
|
+
astar = mstar * Math.cos(hueRadians),
|
|
277
|
+
bstar = mstar * Math.sin(hueRadians);
|
|
278
|
+
return new Cam16(hue, C, J, Q, M, s, jstar, astar, bstar);
|
|
279
|
+
}
|
|
280
|
+
xyzInViewingConditions(viewingConditions) {
|
|
281
|
+
const alpha = 0 === this.chroma || 0 === this.j ? 0 : this.chroma / Math.sqrt(this.j / 100),
|
|
282
|
+
t = Math.pow(alpha / Math.pow(1.64 - Math.pow(.29, viewingConditions.n), .73), 1 / .9),
|
|
283
|
+
hRad = this.hue * Math.PI / 180,
|
|
284
|
+
eHue = .25 * (Math.cos(hRad + 2) + 3.8),
|
|
285
|
+
ac = viewingConditions.aw * Math.pow(this.j / 100, 1 / viewingConditions.c / viewingConditions.z),
|
|
286
|
+
p1 = eHue * (5e4 / 13) * viewingConditions.nc * viewingConditions.ncb,
|
|
287
|
+
p2 = ac / viewingConditions.nbb,
|
|
288
|
+
hSin = Math.sin(hRad),
|
|
289
|
+
hCos = Math.cos(hRad),
|
|
290
|
+
gamma = 23 * (p2 + .305) * t / (23 * p1 + 11 * t * hCos + 108 * t * hSin),
|
|
291
|
+
a = gamma * hCos,
|
|
292
|
+
b = gamma * hSin,
|
|
293
|
+
rA = (460 * p2 + 451 * a + 288 * b) / 1403,
|
|
294
|
+
gA = (460 * p2 - 891 * a - 261 * b) / 1403,
|
|
295
|
+
bA = (460 * p2 - 220 * a - 6300 * b) / 1403,
|
|
296
|
+
rCBase = Math.max(0, 27.13 * Math.abs(rA) / (400 - Math.abs(rA))),
|
|
297
|
+
rC = signum(rA) * (100 / viewingConditions.fl) * Math.pow(rCBase, 1 / .42),
|
|
298
|
+
gCBase = Math.max(0, 27.13 * Math.abs(gA) / (400 - Math.abs(gA))),
|
|
299
|
+
gC = signum(gA) * (100 / viewingConditions.fl) * Math.pow(gCBase, 1 / .42),
|
|
300
|
+
bCBase = Math.max(0, 27.13 * Math.abs(bA) / (400 - Math.abs(bA))),
|
|
301
|
+
bC = signum(bA) * (100 / viewingConditions.fl) * Math.pow(bCBase, 1 / .42),
|
|
302
|
+
rF = rC / viewingConditions.rgbD[0],
|
|
303
|
+
gF = gC / viewingConditions.rgbD[1],
|
|
304
|
+
bF = bC / viewingConditions.rgbD[2];
|
|
305
|
+
return [1.86206786 * rF - 1.01125463 * gF + .14918677 * bF, .38752654 * rF + .62144744 * gF - .00897398 * bF, -.0158415 * rF - .03412294 * gF + 1.04996444 * bF];
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
class HctSolver {
|
|
309
|
+
static sanitizeRadians(angle) {
|
|
310
|
+
return (angle + 8 * Math.PI) % (2 * Math.PI);
|
|
311
|
+
}
|
|
312
|
+
static trueDelinearized(rgbComponent) {
|
|
313
|
+
const normalized = rgbComponent / 100;
|
|
314
|
+
let delinearized = 0;
|
|
315
|
+
return delinearized = normalized <= .0031308 ? 12.92 * normalized : 1.055 * Math.pow(normalized, 1 / 2.4) - .055, 255 * delinearized;
|
|
316
|
+
}
|
|
317
|
+
static chromaticAdaptation(component) {
|
|
318
|
+
const af = Math.pow(Math.abs(component), .42);
|
|
319
|
+
return 400 * signum(component) * af / (af + 27.13);
|
|
320
|
+
}
|
|
321
|
+
static hueOf(linrgb) {
|
|
322
|
+
const scaledDiscount = matrixMultiply(linrgb, HctSolver.SCALED_DISCOUNT_FROM_LINRGB),
|
|
323
|
+
rA = HctSolver.chromaticAdaptation(scaledDiscount[0]),
|
|
324
|
+
gA = HctSolver.chromaticAdaptation(scaledDiscount[1]),
|
|
325
|
+
bA = HctSolver.chromaticAdaptation(scaledDiscount[2]),
|
|
326
|
+
a = (11 * rA + -12 * gA + bA) / 11,
|
|
327
|
+
b = (rA + gA - 2 * bA) / 9;
|
|
328
|
+
return Math.atan2(b, a);
|
|
329
|
+
}
|
|
330
|
+
static areInCyclicOrder(a, b, c) {
|
|
331
|
+
return HctSolver.sanitizeRadians(b - a) < HctSolver.sanitizeRadians(c - a);
|
|
332
|
+
}
|
|
333
|
+
static intercept(source, mid, target) {
|
|
334
|
+
return (mid - source) / (target - source);
|
|
335
|
+
}
|
|
336
|
+
static lerpPoint(source, t, target) {
|
|
337
|
+
return [source[0] + (target[0] - source[0]) * t, source[1] + (target[1] - source[1]) * t, source[2] + (target[2] - source[2]) * t];
|
|
338
|
+
}
|
|
339
|
+
static setCoordinate(source, coordinate, target, axis) {
|
|
340
|
+
const t = HctSolver.intercept(source[axis], coordinate, target[axis]);
|
|
341
|
+
return HctSolver.lerpPoint(source, t, target);
|
|
342
|
+
}
|
|
343
|
+
static isBounded(x) {
|
|
344
|
+
return 0 <= x && x <= 100;
|
|
345
|
+
}
|
|
346
|
+
static nthVertex(y, n) {
|
|
347
|
+
const kR = HctSolver.Y_FROM_LINRGB[0],
|
|
348
|
+
kG = HctSolver.Y_FROM_LINRGB[1],
|
|
349
|
+
kB = HctSolver.Y_FROM_LINRGB[2],
|
|
350
|
+
coordA = n % 4 <= 1 ? 0 : 100,
|
|
351
|
+
coordB = n % 2 == 0 ? 0 : 100;
|
|
352
|
+
if (n < 4) {
|
|
353
|
+
const g = coordA,
|
|
354
|
+
b = coordB,
|
|
355
|
+
r = (y - g * kG - b * kB) / kR;
|
|
356
|
+
return HctSolver.isBounded(r) ? [r, g, b] : [-1, -1, -1];
|
|
357
|
+
}
|
|
358
|
+
if (n < 8) {
|
|
359
|
+
const b = coordA,
|
|
360
|
+
r = coordB,
|
|
361
|
+
g = (y - r * kR - b * kB) / kG;
|
|
362
|
+
return HctSolver.isBounded(g) ? [r, g, b] : [-1, -1, -1];
|
|
363
|
+
}
|
|
364
|
+
{
|
|
365
|
+
const r = coordA,
|
|
366
|
+
g = coordB,
|
|
367
|
+
b = (y - r * kR - g * kG) / kB;
|
|
368
|
+
return HctSolver.isBounded(b) ? [r, g, b] : [-1, -1, -1];
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
static bisectToSegment(y, targetHue) {
|
|
372
|
+
let left = [-1, -1, -1],
|
|
373
|
+
right = left,
|
|
374
|
+
leftHue = 0,
|
|
375
|
+
rightHue = 0,
|
|
376
|
+
initialized = !1,
|
|
377
|
+
uncut = !0;
|
|
378
|
+
for (let n = 0; n < 12; n++) {
|
|
379
|
+
const mid = HctSolver.nthVertex(y, n);
|
|
380
|
+
if (mid[0] < 0) continue;
|
|
381
|
+
const midHue = HctSolver.hueOf(mid);
|
|
382
|
+
initialized ? (uncut || HctSolver.areInCyclicOrder(leftHue, midHue, rightHue)) && (uncut = !1, HctSolver.areInCyclicOrder(leftHue, targetHue, midHue) ? (right = mid, rightHue = midHue) : (left = mid, leftHue = midHue)) : (left = mid, right = mid, leftHue = midHue, rightHue = midHue, initialized = !0);
|
|
383
|
+
}
|
|
384
|
+
return [left, right];
|
|
385
|
+
}
|
|
386
|
+
static midpoint(a, b) {
|
|
387
|
+
return [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[2] + b[2]) / 2];
|
|
388
|
+
}
|
|
389
|
+
static criticalPlaneBelow(x) {
|
|
390
|
+
return Math.floor(x - .5);
|
|
391
|
+
}
|
|
392
|
+
static criticalPlaneAbove(x) {
|
|
393
|
+
return Math.ceil(x - .5);
|
|
394
|
+
}
|
|
395
|
+
static bisectToLimit(y, targetHue) {
|
|
396
|
+
const segment = HctSolver.bisectToSegment(y, targetHue);
|
|
397
|
+
let left = segment[0],
|
|
398
|
+
leftHue = HctSolver.hueOf(left),
|
|
399
|
+
right = segment[1];
|
|
400
|
+
for (let axis = 0; axis < 3; axis++) if (left[axis] !== right[axis]) {
|
|
401
|
+
let lPlane = -1,
|
|
402
|
+
rPlane = 255;
|
|
403
|
+
left[axis] < right[axis] ? (lPlane = HctSolver.criticalPlaneBelow(HctSolver.trueDelinearized(left[axis])), rPlane = HctSolver.criticalPlaneAbove(HctSolver.trueDelinearized(right[axis]))) : (lPlane = HctSolver.criticalPlaneAbove(HctSolver.trueDelinearized(left[axis])), rPlane = HctSolver.criticalPlaneBelow(HctSolver.trueDelinearized(right[axis])));
|
|
404
|
+
for (let i = 0; i < 8 && !(Math.abs(rPlane - lPlane) <= 1); i++) {
|
|
405
|
+
const mPlane = Math.floor((lPlane + rPlane) / 2),
|
|
406
|
+
midPlaneCoordinate = HctSolver.CRITICAL_PLANES[mPlane],
|
|
407
|
+
mid = HctSolver.setCoordinate(left, midPlaneCoordinate, right, axis),
|
|
408
|
+
midHue = HctSolver.hueOf(mid);
|
|
409
|
+
HctSolver.areInCyclicOrder(leftHue, targetHue, midHue) ? (right = mid, rPlane = mPlane) : (left = mid, leftHue = midHue, lPlane = mPlane);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
return HctSolver.midpoint(left, right);
|
|
413
|
+
}
|
|
414
|
+
static inverseChromaticAdaptation(adapted) {
|
|
415
|
+
const adaptedAbs = Math.abs(adapted),
|
|
416
|
+
base = Math.max(0, 27.13 * adaptedAbs / (400 - adaptedAbs));
|
|
417
|
+
return signum(adapted) * Math.pow(base, 1 / .42);
|
|
418
|
+
}
|
|
419
|
+
static findResultByJ(hueRadians, chroma, y) {
|
|
420
|
+
let j = 11 * Math.sqrt(y);
|
|
421
|
+
const viewingConditions = ViewingConditions.DEFAULT,
|
|
422
|
+
tInnerCoeff = 1 / Math.pow(1.64 - Math.pow(.29, viewingConditions.n), .73),
|
|
423
|
+
p1 = .25 * (Math.cos(hueRadians + 2) + 3.8) * (5e4 / 13) * viewingConditions.nc * viewingConditions.ncb,
|
|
424
|
+
hSin = Math.sin(hueRadians),
|
|
425
|
+
hCos = Math.cos(hueRadians);
|
|
426
|
+
for (let iterationRound = 0; iterationRound < 5; iterationRound++) {
|
|
427
|
+
const jNormalized = j / 100,
|
|
428
|
+
alpha = 0 === chroma || 0 === j ? 0 : chroma / Math.sqrt(jNormalized),
|
|
429
|
+
t = Math.pow(alpha * tInnerCoeff, 1 / .9),
|
|
430
|
+
p2 = viewingConditions.aw * Math.pow(jNormalized, 1 / viewingConditions.c / viewingConditions.z) / viewingConditions.nbb,
|
|
431
|
+
gamma = 23 * (p2 + .305) * t / (23 * p1 + 11 * t * hCos + 108 * t * hSin),
|
|
432
|
+
a = gamma * hCos,
|
|
433
|
+
b = gamma * hSin,
|
|
434
|
+
rA = (460 * p2 + 451 * a + 288 * b) / 1403,
|
|
435
|
+
gA = (460 * p2 - 891 * a - 261 * b) / 1403,
|
|
436
|
+
bA = (460 * p2 - 220 * a - 6300 * b) / 1403,
|
|
437
|
+
linrgb = matrixMultiply([HctSolver.inverseChromaticAdaptation(rA), HctSolver.inverseChromaticAdaptation(gA), HctSolver.inverseChromaticAdaptation(bA)], HctSolver.LINRGB_FROM_SCALED_DISCOUNT);
|
|
438
|
+
if (linrgb[0] < 0 || linrgb[1] < 0 || linrgb[2] < 0) return 0;
|
|
439
|
+
const kR = HctSolver.Y_FROM_LINRGB[0],
|
|
440
|
+
kG = HctSolver.Y_FROM_LINRGB[1],
|
|
441
|
+
kB = HctSolver.Y_FROM_LINRGB[2],
|
|
442
|
+
fnj = kR * linrgb[0] + kG * linrgb[1] + kB * linrgb[2];
|
|
443
|
+
if (fnj <= 0) return 0;
|
|
444
|
+
if (4 === iterationRound || Math.abs(fnj - y) < .002) return linrgb[0] > 100.01 || linrgb[1] > 100.01 || linrgb[2] > 100.01 ? 0 : argbFromLinrgb(linrgb);
|
|
445
|
+
j -= (fnj - y) * j / (2 * fnj);
|
|
446
|
+
}
|
|
447
|
+
return 0;
|
|
448
|
+
}
|
|
449
|
+
static solveToInt(hueDegrees, chroma, lstar) {
|
|
450
|
+
if (chroma < 1e-4 || lstar < 1e-4 || lstar > 99.9999) return argbFromLstar(lstar);
|
|
451
|
+
const hueRadians = (hueDegrees = sanitizeDegreesDouble(hueDegrees)) / 180 * Math.PI,
|
|
452
|
+
y = yFromLstar(lstar),
|
|
453
|
+
exactAnswer = HctSolver.findResultByJ(hueRadians, chroma, y);
|
|
454
|
+
if (0 !== exactAnswer) return exactAnswer;
|
|
455
|
+
return argbFromLinrgb(HctSolver.bisectToLimit(y, hueRadians));
|
|
456
|
+
}
|
|
457
|
+
static solveToCam(hueDegrees, chroma, lstar) {
|
|
458
|
+
return Cam16.fromInt(HctSolver.solveToInt(hueDegrees, chroma, lstar));
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
HctSolver.SCALED_DISCOUNT_FROM_LINRGB = [[.001200833568784504, .002389694492170889, .0002795742885861124], [.0005891086651375999, .0029785502573438758, .0003270666104008398], [.00010146692491640572, .0005364214359186694, .0032979401770712076]], HctSolver.LINRGB_FROM_SCALED_DISCOUNT = [[1373.2198709594231, -1100.4251190754821, -7.278681089101213], [-271.815969077903, 559.6580465940733, -32.46047482791194], [1.9622899599665666, -57.173814538844006, 308.7233197812385]], HctSolver.Y_FROM_LINRGB = [.2126, .7152, .0722], HctSolver.CRITICAL_PLANES = [.015176349177441876, .045529047532325624, .07588174588720938, .10623444424209313, .13658714259697685, .16693984095186062, .19729253930674434, .2276452376616281, .2579979360165119, .28835063437139563, .3188300904430532, .350925934958123, .3848314933096426, .42057480301049466, .458183274052838, .4976837250274023, .5391024159806381, .5824650784040898, .6277969426914107, .6751227633498623, .7244668422128921, .775853049866786, .829304845476233, .8848452951698498, .942497089126609, 1.0022825574869039, 1.0642236851973577, 1.1283421258858297, 1.1946592148522128, 1.2631959812511864, 1.3339731595349034, 1.407011200216447, 1.4823302800086415, 1.5599503113873272, 1.6398909516233677, 1.7221716113234105, 1.8068114625156377, 1.8938294463134073, 1.9832442801866852, 2.075074464868551, 2.1693382909216234, 2.2660538449872063, 2.36523901573795, 2.4669114995532007, 2.5710888059345764, 2.6777882626779785, 2.7870270208169257, 2.898822059350997, 3.0131901897720907, 3.1301480604002863, 3.2497121605402226, 3.3718988244681087, 3.4967242352587946, 3.624204428461639, 3.754355295633311, 3.887192587735158, 4.022731918402185, 4.160988767090289, 4.301978482107941, 4.445716283538092, 4.592217266055746, 4.741496401646282, 4.893568542229298, 5.048448422192488, 5.20615066083972, 5.3666897647573375, 5.5300801301023865, 5.696336044816294, 5.865471690767354, 6.037501145825082, 6.212438385869475, 6.390297286737924, 6.571091626112461, 6.7548350853498045, 6.941541251256611, 7.131223617812143, 7.323895587840543, 7.5195704746346665, 7.7182615035334345, 7.919981813454504, 8.124744458384042, 8.332562408825165, 8.543448553206703, 8.757415699253682, 8.974476575321063, 9.194643831691977, 9.417930041841839, 9.644347703669503, 9.873909240696694, 10.106627003236781, 10.342513269534024, 10.58158024687427, 10.8238400726681, 11.069304815507364, 11.317986476196008, 11.569896988756009, 11.825048221409341, 12.083451977536606, 12.345119996613247, 12.610063955123938, 12.878295467455942, 13.149826086772048, 13.42466730586372, 13.702830557985108, 13.984327217668513, 14.269168601521828, 14.55736596900856, 14.848930523210871, 15.143873411576273, 15.44220572664832, 15.743938506781891, 16.04908273684337, 16.35764934889634, 16.66964922287304, 16.985093187232053, 17.30399201960269, 17.62635644741625, 17.95219714852476, 18.281524751807332, 18.614349837764564, 18.95068293910138, 19.290534541298456, 19.633915083172692, 19.98083495742689, 20.331304511189067, 20.685334046541502, 21.042933821039977, 21.404114048223256, 21.76888489811322, 22.137256497705877, 22.50923893145328, 22.884842241736916, 23.264076429332462, 23.6469514538663, 24.033477234264016, 24.42366364919083, 24.817520537484558, 25.21505769858089, 25.61628489293138, 26.021211842414342, 26.429848230738664, 26.842203703840827, 27.258287870275353, 27.678110301598522, 28.10168053274597, 28.529008062403893, 28.96010235337422, 29.39497283293396, 29.83362889318845, 30.276079891419332, 30.722335150426627, 31.172403958865512, 31.62629557157785, 32.08401920991837, 32.54558406207592, 33.010999283389665, 33.4802739966603, 33.953417292456834, 34.430438229418264, 34.911345834551085, 35.39614910352207, 35.88485700094671, 36.37747846067349, 36.87402238606382, 37.37449765026789, 37.87891309649659, 38.38727753828926, 38.89959975977785, 39.41588851594697, 39.93615253289054, 40.460400508064545, 40.98864111053629, 41.520882981230194, 42.05713473317016, 42.597404951718396, 43.141702194811224, 43.6900349931913, 44.24241185063697, 44.798841244188324, 45.35933162437017, 45.92389141541209, 46.49252901546552, 47.065252796817916, 47.64207110610409, 48.22299226451468, 48.808024568002054, 49.3971762874833, 49.9904556690408, 50.587870934119984, 51.189430279724725, 51.79514187861014, 52.40501387947288, 53.0190544071392, 53.637271562750364, 54.259673423945976, 54.88626804504493, 55.517063457223934, 56.15206766869424, 56.79128866487574, 57.43473440856916, 58.08241284012621, 58.734331877617365, 59.39049941699807, 60.05092333227251, 60.715611475655585, 61.38457167773311, 62.057811747619894, 62.7353394731159, 63.417162620860914, 64.10328893648692, 64.79372614476921, 65.48848194977529, 66.18756403501224, 66.89098006357258, 67.59873767827808, 68.31084450182222, 69.02730813691093, 69.74813616640164, 70.47333615344107, 71.20291564160104, 71.93688215501312, 72.67524319850172, 73.41800625771542, 74.16517879925733, 74.9167682708136, 75.67278210128072, 76.43322770089146, 77.1981124613393, 77.96744375590167, 78.74122893956174, 79.51947534912904, 80.30219030335869, 81.08938110306934, 81.88105503125999, 82.67721935322541, 83.4778813166706, 84.28304815182372, 85.09272707154808, 85.90692527145302, 86.72564993000343, 87.54890820862819, 88.3767072518277, 89.2090541872801, 90.04595612594655, 90.88742016217518, 91.73345337380438, 92.58406282226491, 93.43925555268066, 94.29903859396902, 95.16341895893969, 96.03240364439274, 96.9059996312159, 97.78421388448044, 98.6670533535366, 99.55452497210776];
|
|
462
|
+
class Hct {
|
|
463
|
+
static from(hue, chroma, tone) {
|
|
464
|
+
return new Hct(HctSolver.solveToInt(hue, chroma, tone));
|
|
465
|
+
}
|
|
466
|
+
static fromInt(argb) {
|
|
467
|
+
return new Hct(argb);
|
|
468
|
+
}
|
|
469
|
+
toInt() {
|
|
470
|
+
return this.argb;
|
|
471
|
+
}
|
|
472
|
+
get hue() {
|
|
473
|
+
return this.internalHue;
|
|
474
|
+
}
|
|
475
|
+
set hue(newHue) {
|
|
476
|
+
this.setInternalState(HctSolver.solveToInt(newHue, this.internalChroma, this.internalTone));
|
|
477
|
+
}
|
|
478
|
+
get chroma() {
|
|
479
|
+
return this.internalChroma;
|
|
480
|
+
}
|
|
481
|
+
set chroma(newChroma) {
|
|
482
|
+
this.setInternalState(HctSolver.solveToInt(this.internalHue, newChroma, this.internalTone));
|
|
483
|
+
}
|
|
484
|
+
get tone() {
|
|
485
|
+
return this.internalTone;
|
|
486
|
+
}
|
|
487
|
+
set tone(newTone) {
|
|
488
|
+
this.setInternalState(HctSolver.solveToInt(this.internalHue, this.internalChroma, newTone));
|
|
489
|
+
}
|
|
490
|
+
constructor(argb) {
|
|
491
|
+
this.argb = argb;
|
|
492
|
+
const cam = Cam16.fromInt(argb);
|
|
493
|
+
this.internalHue = cam.hue, this.internalChroma = cam.chroma, this.internalTone = lstarFromArgb(argb), this.argb = argb;
|
|
494
|
+
}
|
|
495
|
+
setInternalState(argb) {
|
|
496
|
+
const cam = Cam16.fromInt(argb);
|
|
497
|
+
this.internalHue = cam.hue, this.internalChroma = cam.chroma, this.internalTone = lstarFromArgb(argb), this.argb = argb;
|
|
498
|
+
}
|
|
499
|
+
inViewingConditions(vc) {
|
|
500
|
+
const viewedInVc = Cam16.fromInt(this.toInt()).xyzInViewingConditions(vc),
|
|
501
|
+
recastInVc = Cam16.fromXyzInViewingConditions(viewedInVc[0], viewedInVc[1], viewedInVc[2], ViewingConditions.make());
|
|
502
|
+
return Hct.from(recastInVc.hue, recastInVc.chroma, lstarFromY(viewedInVc[1]));
|
|
503
|
+
}
|
|
504
|
+
}
|
|
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
|
+
class Contrast {
|
|
533
|
+
static ratioOfTones(toneA, toneB) {
|
|
534
|
+
return toneA = clampDouble(0, 100, toneA), toneB = clampDouble(0, 100, toneB), Contrast.ratioOfYs(yFromLstar(toneA), yFromLstar(toneB));
|
|
535
|
+
}
|
|
536
|
+
static ratioOfYs(y1, y2) {
|
|
537
|
+
const lighter = y1 > y2 ? y1 : y2;
|
|
538
|
+
return (lighter + 5) / ((lighter === y2 ? y1 : y2) + 5);
|
|
539
|
+
}
|
|
540
|
+
static lighter(tone, ratio) {
|
|
541
|
+
if (tone < 0 || tone > 100) return -1;
|
|
542
|
+
const darkY = yFromLstar(tone),
|
|
543
|
+
lightY = ratio * (darkY + 5) - 5,
|
|
544
|
+
realContrast = Contrast.ratioOfYs(lightY, darkY),
|
|
545
|
+
delta = Math.abs(realContrast - ratio);
|
|
546
|
+
if (realContrast < ratio && delta > .04) return -1;
|
|
547
|
+
const returnValue = lstarFromY(lightY) + .4;
|
|
548
|
+
return returnValue < 0 || returnValue > 100 ? -1 : returnValue;
|
|
549
|
+
}
|
|
550
|
+
static darker(tone, ratio) {
|
|
551
|
+
if (tone < 0 || tone > 100) return -1;
|
|
552
|
+
const lightY = yFromLstar(tone),
|
|
553
|
+
darkY = (lightY + 5) / ratio - 5,
|
|
554
|
+
realContrast = Contrast.ratioOfYs(lightY, darkY),
|
|
555
|
+
delta = Math.abs(realContrast - ratio);
|
|
556
|
+
if (realContrast < ratio && delta > .04) return -1;
|
|
557
|
+
const returnValue = lstarFromY(darkY) - .4;
|
|
558
|
+
return returnValue < 0 || returnValue > 100 ? -1 : returnValue;
|
|
559
|
+
}
|
|
560
|
+
static lighterUnsafe(tone, ratio) {
|
|
561
|
+
const lighterSafe = Contrast.lighter(tone, ratio);
|
|
562
|
+
return lighterSafe < 0 ? 100 : lighterSafe;
|
|
563
|
+
}
|
|
564
|
+
static darkerUnsafe(tone, ratio) {
|
|
565
|
+
const darkerSafe = Contrast.darker(tone, ratio);
|
|
566
|
+
return darkerSafe < 0 ? 0 : darkerSafe;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
class DislikeAnalyzer {
|
|
570
|
+
static isDisliked(hct) {
|
|
571
|
+
const huePasses = Math.round(hct.hue) >= 90 && Math.round(hct.hue) <= 111,
|
|
572
|
+
chromaPasses = Math.round(hct.chroma) > 16,
|
|
573
|
+
tonePasses = Math.round(hct.tone) < 65;
|
|
574
|
+
return huePasses && chromaPasses && tonePasses;
|
|
575
|
+
}
|
|
576
|
+
static fixIfDisliked(hct) {
|
|
577
|
+
return DislikeAnalyzer.isDisliked(hct) ? Hct.from(hct.hue, hct.chroma, 70) : hct;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
class DynamicColor {
|
|
581
|
+
static fromPalette(args) {
|
|
582
|
+
return new DynamicColor(args.name ?? "", args.palette, args.tone, args.isBackground ?? !1, args.background, args.secondBackground, args.contrastCurve, args.toneDeltaPair);
|
|
583
|
+
}
|
|
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.`);
|
|
586
|
+
if (!background && contrastCurve) throw new Error(`Color ${name} has contrastCurvedefined, but background is not defined.`);
|
|
587
|
+
if (background && !contrastCurve) throw new Error(`Color ${name} has backgrounddefined, but contrastCurve is not defined.`);
|
|
588
|
+
}
|
|
589
|
+
getArgb(scheme) {
|
|
590
|
+
return this.getHct(scheme).toInt();
|
|
591
|
+
}
|
|
592
|
+
getHct(scheme) {
|
|
593
|
+
const cachedAnswer = this.hctCache.get(scheme);
|
|
594
|
+
if (null != cachedAnswer) return cachedAnswer;
|
|
595
|
+
const tone = this.getTone(scheme),
|
|
596
|
+
answer = this.palette(scheme).getHct(tone);
|
|
597
|
+
return this.hctCache.size > 4 && this.hctCache.clear(), this.hctCache.set(scheme, answer), answer;
|
|
598
|
+
}
|
|
599
|
+
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
|
+
}
|
|
640
|
+
}
|
|
641
|
+
static foregroundTone(bgTone, ratio) {
|
|
642
|
+
const lighterTone = Contrast.lighterUnsafe(bgTone, ratio),
|
|
643
|
+
darkerTone = Contrast.darkerUnsafe(bgTone, ratio),
|
|
644
|
+
lighterRatio = Contrast.ratioOfTones(lighterTone, bgTone),
|
|
645
|
+
darkerRatio = Contrast.ratioOfTones(darkerTone, bgTone);
|
|
646
|
+
if (DynamicColor.tonePrefersLightForeground(bgTone)) {
|
|
647
|
+
const negligibleDifference = Math.abs(lighterRatio - darkerRatio) < .1 && lighterRatio < ratio && darkerRatio < ratio;
|
|
648
|
+
return lighterRatio >= ratio || lighterRatio >= darkerRatio || negligibleDifference ? lighterTone : darkerTone;
|
|
649
|
+
}
|
|
650
|
+
return darkerRatio >= ratio || darkerRatio >= lighterRatio ? darkerTone : lighterTone;
|
|
651
|
+
}
|
|
652
|
+
static tonePrefersLightForeground(tone) {
|
|
653
|
+
return Math.round(tone) < 60;
|
|
654
|
+
}
|
|
655
|
+
static toneAllowsLightForeground(tone) {
|
|
656
|
+
return Math.round(tone) <= 49;
|
|
657
|
+
}
|
|
658
|
+
static enableLightForeground(tone) {
|
|
659
|
+
return DynamicColor.tonePrefersLightForeground(tone) && !DynamicColor.toneAllowsLightForeground(tone) ? 49 : tone;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
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 = {}));
|
|
666
|
+
class ContrastCurve {
|
|
667
|
+
constructor(low, normal, medium, high) {
|
|
668
|
+
this.low = low, this.normal = normal, this.medium = medium, this.high = high;
|
|
669
|
+
}
|
|
670
|
+
getContrast(contrastLevel) {
|
|
671
|
+
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
|
+
}
|
|
673
|
+
}
|
|
674
|
+
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;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
function isFidelity(scheme) {
|
|
680
|
+
return scheme.variant === Variant.FIDELITY || scheme.variant === Variant.CONTENT;
|
|
681
|
+
}
|
|
682
|
+
function isMonochrome(scheme) {
|
|
683
|
+
return scheme.variant === Variant.MONOCHROME;
|
|
684
|
+
}
|
|
685
|
+
function findDesiredChromaByTone(hue, chroma, tone, byDecreasingTone) {
|
|
686
|
+
let answer = tone,
|
|
687
|
+
closestToChroma = Hct.from(hue, chroma, tone);
|
|
688
|
+
if (closestToChroma.chroma < chroma) {
|
|
689
|
+
let chromaPeak = closestToChroma.chroma;
|
|
690
|
+
for (; closestToChroma.chroma < chroma;) {
|
|
691
|
+
answer += byDecreasingTone ? -1 : 1;
|
|
692
|
+
const potentialSolution = Hct.from(hue, chroma, answer);
|
|
693
|
+
if (chromaPeak > potentialSolution.chroma) break;
|
|
694
|
+
if (Math.abs(potentialSolution.chroma - chroma) < .4) break;
|
|
695
|
+
Math.abs(potentialSolution.chroma - chroma) < Math.abs(closestToChroma.chroma - chroma) && (closestToChroma = potentialSolution), chromaPeak = Math.max(chromaPeak, potentialSolution.chroma);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
return answer;
|
|
699
|
+
}
|
|
700
|
+
function viewingConditionsForAlbers(scheme) {
|
|
701
|
+
return ViewingConditions.make(void 0, void 0, scheme.isDark ? 30 : 80, void 0, void 0);
|
|
702
|
+
}
|
|
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);
|
|
706
|
+
}
|
|
707
|
+
class MaterialDynamicColors {
|
|
708
|
+
static highestSurface(s) {
|
|
709
|
+
return s.isDark ? MaterialDynamicColors.surfaceBright : MaterialDynamicColors.surfaceDim;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
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);
|
|
1060
|
+
}
|
|
1061
|
+
static fromHct(hct) {
|
|
1062
|
+
return new TonalPalette(hct.hue, hct.chroma, hct);
|
|
1063
|
+
}
|
|
1064
|
+
static fromHueAndChroma(hue, chroma) {
|
|
1065
|
+
return new TonalPalette(hue, chroma, TonalPalette.createKeyColor(hue, chroma));
|
|
1066
|
+
}
|
|
1067
|
+
constructor(hue, chroma, keyColor) {
|
|
1068
|
+
this.hue = hue, this.chroma = chroma, this.keyColor = keyColor, this.cache = new Map();
|
|
1069
|
+
}
|
|
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;
|
|
1083
|
+
}
|
|
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;
|
|
1087
|
+
}
|
|
1088
|
+
getHct(tone) {
|
|
1089
|
+
return Hct.fromInt(this.tone(tone));
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
class CorePalette {
|
|
1093
|
+
static of(argb) {
|
|
1094
|
+
return new CorePalette(argb, !1);
|
|
1095
|
+
}
|
|
1096
|
+
static contentOf(argb) {
|
|
1097
|
+
return new CorePalette(argb, !0);
|
|
1098
|
+
}
|
|
1099
|
+
static fromColors(colors) {
|
|
1100
|
+
return CorePalette.createPaletteFromColors(!1, colors);
|
|
1101
|
+
}
|
|
1102
|
+
static contentFromColors(colors) {
|
|
1103
|
+
return CorePalette.createPaletteFromColors(!0, colors);
|
|
1104
|
+
}
|
|
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;
|
|
1128
|
+
}
|
|
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);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
class Scheme {
|
|
1137
|
+
get primary() {
|
|
1138
|
+
return this.props.primary;
|
|
1139
|
+
}
|
|
1140
|
+
get onPrimary() {
|
|
1141
|
+
return this.props.onPrimary;
|
|
1142
|
+
}
|
|
1143
|
+
get primaryContainer() {
|
|
1144
|
+
return this.props.primaryContainer;
|
|
1145
|
+
}
|
|
1146
|
+
get onPrimaryContainer() {
|
|
1147
|
+
return this.props.onPrimaryContainer;
|
|
1148
|
+
}
|
|
1149
|
+
get secondary() {
|
|
1150
|
+
return this.props.secondary;
|
|
1151
|
+
}
|
|
1152
|
+
get onSecondary() {
|
|
1153
|
+
return this.props.onSecondary;
|
|
1154
|
+
}
|
|
1155
|
+
get secondaryContainer() {
|
|
1156
|
+
return this.props.secondaryContainer;
|
|
1157
|
+
}
|
|
1158
|
+
get onSecondaryContainer() {
|
|
1159
|
+
return this.props.onSecondaryContainer;
|
|
1160
|
+
}
|
|
1161
|
+
get tertiary() {
|
|
1162
|
+
return this.props.tertiary;
|
|
1163
|
+
}
|
|
1164
|
+
get onTertiary() {
|
|
1165
|
+
return this.props.onTertiary;
|
|
1166
|
+
}
|
|
1167
|
+
get tertiaryContainer() {
|
|
1168
|
+
return this.props.tertiaryContainer;
|
|
1169
|
+
}
|
|
1170
|
+
get onTertiaryContainer() {
|
|
1171
|
+
return this.props.onTertiaryContainer;
|
|
1172
|
+
}
|
|
1173
|
+
get error() {
|
|
1174
|
+
return this.props.error;
|
|
1175
|
+
}
|
|
1176
|
+
get onError() {
|
|
1177
|
+
return this.props.onError;
|
|
1178
|
+
}
|
|
1179
|
+
get errorContainer() {
|
|
1180
|
+
return this.props.errorContainer;
|
|
1181
|
+
}
|
|
1182
|
+
get onErrorContainer() {
|
|
1183
|
+
return this.props.onErrorContainer;
|
|
1184
|
+
}
|
|
1185
|
+
get background() {
|
|
1186
|
+
return this.props.background;
|
|
1187
|
+
}
|
|
1188
|
+
get onBackground() {
|
|
1189
|
+
return this.props.onBackground;
|
|
1190
|
+
}
|
|
1191
|
+
get surface() {
|
|
1192
|
+
return this.props.surface;
|
|
1193
|
+
}
|
|
1194
|
+
get onSurface() {
|
|
1195
|
+
return this.props.onSurface;
|
|
1196
|
+
}
|
|
1197
|
+
get surfaceVariant() {
|
|
1198
|
+
return this.props.surfaceVariant;
|
|
1199
|
+
}
|
|
1200
|
+
get onSurfaceVariant() {
|
|
1201
|
+
return this.props.onSurfaceVariant;
|
|
1202
|
+
}
|
|
1203
|
+
get outline() {
|
|
1204
|
+
return this.props.outline;
|
|
1205
|
+
}
|
|
1206
|
+
get outlineVariant() {
|
|
1207
|
+
return this.props.outlineVariant;
|
|
1208
|
+
}
|
|
1209
|
+
get shadow() {
|
|
1210
|
+
return this.props.shadow;
|
|
1211
|
+
}
|
|
1212
|
+
get scrim() {
|
|
1213
|
+
return this.props.scrim;
|
|
1214
|
+
}
|
|
1215
|
+
get inverseSurface() {
|
|
1216
|
+
return this.props.inverseSurface;
|
|
1217
|
+
}
|
|
1218
|
+
get inverseOnSurface() {
|
|
1219
|
+
return this.props.inverseOnSurface;
|
|
1220
|
+
}
|
|
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
|
+
};
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
function hexFromArgb(argb) {
|
|
1312
|
+
const r = redFromArgb(argb),
|
|
1313
|
+
g = greenFromArgb(argb),
|
|
1314
|
+
b = blueFromArgb(argb),
|
|
1315
|
+
outParts = [r.toString(16), g.toString(16), b.toString(16)];
|
|
1316
|
+
for (const [i, part] of outParts.entries()) 1 === part.length && (outParts[i] = "0" + part);
|
|
1317
|
+
return "#" + outParts.join("");
|
|
1318
|
+
}
|
|
1319
|
+
function argbFromHex(hex) {
|
|
1320
|
+
const isThree = 3 === (hex = hex.replace("#", "")).length,
|
|
1321
|
+
isSix = 6 === hex.length,
|
|
1322
|
+
isEight = 8 === hex.length;
|
|
1323
|
+
if (!isThree && !isSix && !isEight) throw new Error("unexpected hex " + hex);
|
|
1324
|
+
let r = 0,
|
|
1325
|
+
g = 0,
|
|
1326
|
+
b = 0;
|
|
1327
|
+
return isThree ? (r = parseIntHex(hex.slice(0, 1).repeat(2)), g = parseIntHex(hex.slice(1, 2).repeat(2)), b = parseIntHex(hex.slice(2, 3).repeat(2))) : isSix ? (r = parseIntHex(hex.slice(0, 2)), g = parseIntHex(hex.slice(2, 4)), b = parseIntHex(hex.slice(4, 6))) : isEight && (r = parseIntHex(hex.slice(2, 4)), g = parseIntHex(hex.slice(4, 6)), b = parseIntHex(hex.slice(6, 8))), (255 << 24 | (255 & r) << 16 | (255 & g) << 8 | 255 & b) >>> 0;
|
|
1328
|
+
}
|
|
1329
|
+
function parseIntHex(value) {
|
|
1330
|
+
return parseInt(value, 16);
|
|
1331
|
+
}
|
|
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 };
|