@lukso/web-components 1.17.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/color-palette.cjs +236 -334
- package/dist/color-palette.d.ts +1 -1
- package/dist/color-palette.d.ts.map +1 -1
- package/dist/color-palette.js +236 -334
- package/dist/components/index.cjs +2 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/lukso-button/index.cjs +6 -6
- package/dist/components/lukso-button/index.d.ts +7 -7
- package/dist/components/lukso-button/index.d.ts.map +1 -1
- package/dist/components/lukso-button/index.js +6 -6
- package/dist/components/lukso-card/index.cjs +7 -7
- package/dist/components/lukso-card/index.d.ts +5 -5
- package/dist/components/lukso-card/index.d.ts.map +1 -1
- package/dist/components/lukso-card/index.js +7 -7
- package/dist/components/lukso-icon/icons/add-photo.d.ts +1 -1
- package/dist/components/lukso-icon/icons/add-photo.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/arrow-down-lg.d.ts +1 -1
- package/dist/components/lukso-icon/icons/arrow-down-lg.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/arrow-down-sm.d.ts +1 -1
- package/dist/components/lukso-icon/icons/arrow-down-sm.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/arrow-left-lg.d.ts +1 -1
- package/dist/components/lukso-icon/icons/arrow-left-lg.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/arrow-left-sm.d.ts +1 -1
- package/dist/components/lukso-icon/icons/arrow-left-sm.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/arrow-right-lg.d.ts +1 -1
- package/dist/components/lukso-icon/icons/arrow-right-lg.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/arrow-right-sm.d.ts +1 -1
- package/dist/components/lukso-icon/icons/arrow-right-sm.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/arrow-up-lg.d.ts +1 -1
- package/dist/components/lukso-icon/icons/arrow-up-lg.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/arrow-up-sm.d.ts +1 -1
- package/dist/components/lukso-icon/icons/arrow-up-sm.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/barbell-outline.d.ts +1 -1
- package/dist/components/lukso-icon/icons/barbell-outline.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/bulb-outline.d.ts +1 -1
- package/dist/components/lukso-icon/icons/bulb-outline.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/camera.d.ts +1 -1
- package/dist/components/lukso-icon/icons/camera.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/clipboard.d.ts +1 -1
- package/dist/components/lukso-icon/icons/clipboard.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/clock.d.ts +1 -1
- package/dist/components/lukso-icon/icons/clock.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/close-lg.d.ts +1 -1
- package/dist/components/lukso-icon/icons/close-lg.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/close-sm.d.ts +1 -1
- package/dist/components/lukso-icon/icons/close-sm.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/cloud.d.ts +1 -1
- package/dist/components/lukso-icon/icons/cloud.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/compass-outline.d.ts +1 -1
- package/dist/components/lukso-icon/icons/compass-outline.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/complete-filled-fade-in.d.ts +1 -1
- package/dist/components/lukso-icon/icons/complete-filled-fade-in.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/complete-filled.d.ts +1 -1
- package/dist/components/lukso-icon/icons/complete-filled.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/complete-outline.d.ts +1 -1
- package/dist/components/lukso-icon/icons/complete-outline.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/connect.d.ts +1 -1
- package/dist/components/lukso-icon/icons/connect.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/connections.d.ts +1 -1
- package/dist/components/lukso-icon/icons/connections.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/contract-lock.d.ts +1 -1
- package/dist/components/lukso-icon/icons/contract-lock.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/contract-signed.d.ts +1 -1
- package/dist/components/lukso-icon/icons/contract-signed.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/controller.d.ts +1 -1
- package/dist/components/lukso-icon/icons/controller.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/copy.d.ts +1 -1
- package/dist/components/lukso-icon/icons/copy.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/cross-outline.d.ts +1 -1
- package/dist/components/lukso-icon/icons/cross-outline.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/desktop-sharp.d.ts +1 -1
- package/dist/components/lukso-icon/icons/desktop-sharp.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/dots.d.ts +1 -1
- package/dist/components/lukso-icon/icons/dots.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/edit.d.ts +1 -1
- package/dist/components/lukso-icon/icons/edit.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/error.d.ts +1 -1
- package/dist/components/lukso-icon/icons/error.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/eth-logo.d.ts +1 -1
- package/dist/components/lukso-icon/icons/eth-logo.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/expand.d.ts +1 -1
- package/dist/components/lukso-icon/icons/expand.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/extension.d.ts +1 -1
- package/dist/components/lukso-icon/icons/extension.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/eye-hide.d.ts +1 -1
- package/dist/components/lukso-icon/icons/eye-hide.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/eye-show.d.ts +1 -1
- package/dist/components/lukso-icon/icons/eye-show.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/filter.d.ts +1 -1
- package/dist/components/lukso-icon/icons/filter.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/fish-outline.d.ts +1 -1
- package/dist/components/lukso-icon/icons/fish-outline.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/flip.d.ts +1 -1
- package/dist/components/lukso-icon/icons/flip.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/globe.d.ts +1 -1
- package/dist/components/lukso-icon/icons/globe.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/google-color.d.ts +1 -1
- package/dist/components/lukso-icon/icons/google-color.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/hamburger.d.ts +1 -1
- package/dist/components/lukso-icon/icons/hamburger.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/infinite.d.ts +1 -1
- package/dist/components/lukso-icon/icons/infinite.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/information.d.ts +1 -1
- package/dist/components/lukso-icon/icons/information.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/key-outline.d.ts +1 -1
- package/dist/components/lukso-icon/icons/key-outline.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/link.d.ts +1 -1
- package/dist/components/lukso-icon/icons/link.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/link1.d.ts +1 -1
- package/dist/components/lukso-icon/icons/link1.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/link2.d.ts +1 -1
- package/dist/components/lukso-icon/icons/link2.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/link3.d.ts +1 -1
- package/dist/components/lukso-icon/icons/link3.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/link4.d.ts +1 -1
- package/dist/components/lukso-icon/icons/link4.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/loading.d.ts +1 -1
- package/dist/components/lukso-icon/icons/loading.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/location.d.ts +1 -1
- package/dist/components/lukso-icon/icons/location.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/locked.d.ts +1 -1
- package/dist/components/lukso-icon/icons/locked.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/login-2.d.ts +1 -1
- package/dist/components/lukso-icon/icons/login-2.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/login-3.d.ts +1 -1
- package/dist/components/lukso-icon/icons/login-3.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/login.d.ts +1 -1
- package/dist/components/lukso-icon/icons/login.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/logo-brave.d.ts +1 -1
- package/dist/components/lukso-icon/icons/logo-brave.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/logo-chrome.d.ts +1 -1
- package/dist/components/lukso-icon/icons/logo-chrome.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/logo-edge.d.ts +1 -1
- package/dist/components/lukso-icon/icons/logo-edge.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/logo-firefox.d.ts +1 -1
- package/dist/components/lukso-icon/icons/logo-firefox.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/logo-opera.d.ts +1 -1
- package/dist/components/lukso-icon/icons/logo-opera.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/logo-safari.d.ts +1 -1
- package/dist/components/lukso-icon/icons/logo-safari.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/lyx-logo.d.ts +1 -1
- package/dist/components/lukso-icon/icons/lyx-logo.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/mail.d.ts +1 -1
- package/dist/components/lukso-icon/icons/mail.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/menu-1.d.ts +1 -1
- package/dist/components/lukso-icon/icons/menu-1.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/menu-2.d.ts +1 -1
- package/dist/components/lukso-icon/icons/menu-2.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/migrate.d.ts +1 -1
- package/dist/components/lukso-icon/icons/migrate.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/minimize.d.ts +1 -1
- package/dist/components/lukso-icon/icons/minimize.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/network.d.ts +1 -1
- package/dist/components/lukso-icon/icons/network.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/notifications.d.ts +1 -1
- package/dist/components/lukso-icon/icons/notifications.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/phone-portrait-outline.d.ts +1 -1
- package/dist/components/lukso-icon/icons/phone-portrait-outline.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/pin.d.ts +1 -1
- package/dist/components/lukso-icon/icons/pin.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/play-filled.d.ts +1 -1
- package/dist/components/lukso-icon/icons/play-filled.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/play-outline.d.ts +1 -1
- package/dist/components/lukso-icon/icons/play-outline.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/plus.d.ts +1 -1
- package/dist/components/lukso-icon/icons/plus.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/profile-add.d.ts +1 -1
- package/dist/components/lukso-icon/icons/profile-add.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/profile-export.d.ts +1 -1
- package/dist/components/lukso-icon/icons/profile-export.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/profile-import.d.ts +1 -1
- package/dist/components/lukso-icon/icons/profile-import.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/profile-recovery-2.d.ts +1 -1
- package/dist/components/lukso-icon/icons/profile-recovery-2.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/profile-recovery.d.ts +1 -1
- package/dist/components/lukso-icon/icons/profile-recovery.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/profile-restore.d.ts +1 -1
- package/dist/components/lukso-icon/icons/profile-restore.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/profile.d.ts +1 -1
- package/dist/components/lukso-icon/icons/profile.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/progress-complete.d.ts +1 -1
- package/dist/components/lukso-icon/icons/progress-complete.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/progress-indicator.d.ts +1 -1
- package/dist/components/lukso-icon/icons/progress-indicator.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/pulse-dot.d.ts +1 -1
- package/dist/components/lukso-icon/icons/pulse-dot.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/qr-code.d.ts +1 -1
- package/dist/components/lukso-icon/icons/qr-code.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/relayer.d.ts +1 -1
- package/dist/components/lukso-icon/icons/relayer.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/reload.d.ts +1 -1
- package/dist/components/lukso-icon/icons/reload.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/return-down.d.ts +1 -1
- package/dist/components/lukso-icon/icons/return-down.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/return-left.d.ts +1 -1
- package/dist/components/lukso-icon/icons/return-left.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/return-right.d.ts +1 -1
- package/dist/components/lukso-icon/icons/return-right.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/return-up.d.ts +1 -1
- package/dist/components/lukso-icon/icons/return-up.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/search.d.ts +1 -1
- package/dist/components/lukso-icon/icons/search.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/settings.d.ts +1 -1
- package/dist/components/lukso-icon/icons/settings.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/smart-contract-doc.d.ts +1 -1
- package/dist/components/lukso-icon/icons/smart-contract-doc.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/smart-contract.d.ts +1 -1
- package/dist/components/lukso-icon/icons/smart-contract.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/spinner.d.ts +1 -1
- package/dist/components/lukso-icon/icons/spinner.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/star-filled.d.ts +1 -1
- package/dist/components/lukso-icon/icons/star-filled.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/star-outline.d.ts +1 -1
- package/dist/components/lukso-icon/icons/star-outline.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/step-dot.d.ts +1 -1
- package/dist/components/lukso-icon/icons/step-dot.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/step-progress.d.ts +1 -1
- package/dist/components/lukso-icon/icons/step-progress.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/steps.d.ts +1 -1
- package/dist/components/lukso-icon/icons/steps.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/tick.d.ts +1 -1
- package/dist/components/lukso-icon/icons/tick.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/timer-outline.d.ts +1 -1
- package/dist/components/lukso-icon/icons/timer-outline.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/transaction-receive.d.ts +1 -1
- package/dist/components/lukso-icon/icons/transaction-receive.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/transaction-send.d.ts +1 -1
- package/dist/components/lukso-icon/icons/transaction-send.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/transfer.d.ts +1 -1
- package/dist/components/lukso-icon/icons/transfer.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/trash.d.ts +1 -1
- package/dist/components/lukso-icon/icons/trash.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/turn-down.d.ts +1 -1
- package/dist/components/lukso-icon/icons/turn-down.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/turn-left.d.ts +1 -1
- package/dist/components/lukso-icon/icons/turn-left.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/turn-right.d.ts +1 -1
- package/dist/components/lukso-icon/icons/turn-right.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/turn-up.d.ts +1 -1
- package/dist/components/lukso-icon/icons/turn-up.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/unlocked.d.ts +1 -1
- package/dist/components/lukso-icon/icons/unlocked.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/wallet-outline.d.ts +1 -1
- package/dist/components/lukso-icon/icons/wallet-outline.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/warning-round.d.ts +1 -1
- package/dist/components/lukso-icon/icons/warning-round.d.ts.map +1 -1
- package/dist/components/lukso-icon/icons/warning-triangle.d.ts +1 -1
- package/dist/components/lukso-icon/icons/warning-triangle.d.ts.map +1 -1
- package/dist/components/lukso-icon/index.cjs +238 -238
- package/dist/components/lukso-icon/index.d.ts +3 -3
- package/dist/components/lukso-icon/index.d.ts.map +1 -1
- package/dist/components/lukso-icon/index.js +238 -238
- package/dist/components/lukso-input/index.cjs +23 -13
- package/dist/components/lukso-input/index.d.ts +8 -6
- package/dist/components/lukso-input/index.d.ts.map +1 -1
- package/dist/components/lukso-input/index.js +23 -13
- package/dist/components/lukso-modal/index.cjs +2 -2
- package/dist/components/lukso-modal/index.d.ts +2 -2
- package/dist/components/lukso-modal/index.d.ts.map +1 -1
- package/dist/components/lukso-modal/index.js +2 -2
- package/dist/components/lukso-navbar/index.cjs +4 -4
- package/dist/components/lukso-navbar/index.d.ts +3 -3
- package/dist/components/lukso-navbar/index.d.ts.map +1 -1
- package/dist/components/lukso-navbar/index.js +4 -4
- package/dist/components/lukso-profile/index.cjs +7 -7
- package/dist/components/lukso-profile/index.d.ts +3 -3
- package/dist/components/lukso-profile/index.d.ts.map +1 -1
- package/dist/components/lukso-profile/index.js +7 -7
- package/dist/components/lukso-progress/index.cjs +4 -4
- package/dist/components/lukso-progress/index.d.ts +2 -2
- package/dist/components/lukso-progress/index.d.ts.map +1 -1
- package/dist/components/lukso-progress/index.js +4 -4
- package/dist/components/lukso-sanitize/index.cjs +271 -366
- package/dist/components/lukso-sanitize/index.d.ts +1 -1
- package/dist/components/lukso-sanitize/index.d.ts.map +1 -1
- package/dist/components/lukso-sanitize/index.js +271 -366
- package/dist/components/lukso-tag/index.cjs +4 -4
- package/dist/components/lukso-tag/index.d.ts +2 -2
- package/dist/components/lukso-tag/index.d.ts.map +1 -1
- package/dist/components/lukso-tag/index.js +4 -4
- package/dist/components/lukso-terms/index.cjs +3 -3
- package/dist/components/lukso-terms/index.d.ts +1 -1
- package/dist/components/lukso-terms/index.d.ts.map +1 -1
- package/dist/components/lukso-terms/index.js +3 -3
- package/dist/components/lukso-test/index.cjs +3 -3
- package/dist/components/lukso-test/index.d.ts +1 -1
- package/dist/components/lukso-test/index.d.ts.map +1 -1
- package/dist/components/lukso-test/index.js +3 -3
- package/dist/components/lukso-username/index.cjs +8 -8
- package/dist/components/lukso-username/index.d.ts +2 -2
- package/dist/components/lukso-username/index.d.ts.map +1 -1
- package/dist/components/lukso-username/index.js +8 -8
- package/dist/components/lukso-wizard/index.cjs +7 -7
- package/dist/components/lukso-wizard/index.d.ts +3 -3
- package/dist/components/lukso-wizard/index.d.ts.map +1 -1
- package/dist/components/lukso-wizard/index.js +7 -7
- package/dist/index-72e2de9b.js +52 -0
- package/dist/index-8c1d1d13.cjs +59 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/shared/tailwind-element/index.cjs +1 -1
- package/dist/shared/tailwind-element/index.d.ts.map +1 -1
- package/dist/shared/tailwind-element/index.js +1 -1
- package/dist/style-map-0750a4f6.cjs +12 -0
- package/dist/style-map-6dc1088b.js +10 -0
- package/package.json +1 -1
- package/tools/assets/fonts/index.cjs +1 -1
- package/tools/assets/fonts/index.d.ts.map +1 -1
- package/tools/assets/images/index.cjs +1 -1
- package/tools/assets/images/index.d.ts.map +1 -1
- package/tools/assets/index.cjs +1 -1
- package/tools/assets/index.d.ts.map +1 -1
- package/tools/{color-palette-bf5780ed.cjs → color-palette-18dd9e2f.cjs} +236 -334
- package/tools/{color-palette-a34f5d09.js → color-palette-2786d7c1.js} +236 -334
- package/tools/color-palette.cjs +1 -1
- package/tools/color-palette.d.ts +1 -1
- package/tools/color-palette.d.ts.map +1 -1
- package/tools/color-palette.js +1 -1
- package/tools/copy-assets.d.ts.map +1 -1
- package/tools/hsl-color-map.d.ts.map +1 -1
- package/tools/index.cjs +1 -1
- package/tools/index.d.ts.map +1 -1
- package/tools/index.js +1 -1
- package/tools/sass/index.d.ts.map +1 -1
- package/tools/slice-address.d.ts.map +1 -1
- package/tools/styles/index.cjs +1 -1
- package/tools/styles/index.d.ts.map +1 -1
- package/dist/index-0f13d58e.cjs +0 -67
- package/dist/index-7a686142.js +0 -59
- package/dist/shared/globals.d.ts +0 -5
- package/dist/style-map-0d95bd3c.cjs +0 -12
- package/dist/style-map-9d612f4e.js +0 -10
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// This file is autogenerated. It's used to publish ESM to npm.
|
|
4
|
+
function _typeof(obj) {
|
|
5
|
+
"@babel/helpers - typeof";
|
|
6
|
+
|
|
7
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
8
|
+
return typeof obj;
|
|
9
|
+
} : function (obj) {
|
|
10
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
11
|
+
}, _typeof(obj);
|
|
12
|
+
}
|
|
13
|
+
|
|
4
14
|
// https://github.com/bgrins/TinyColor
|
|
5
15
|
// Brian Grinstead, MIT License
|
|
6
16
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
17
|
+
var trimLeft = /^\s+/;
|
|
18
|
+
var trimRight = /\s+$/;
|
|
10
19
|
function tinycolor(color, opts) {
|
|
11
20
|
color = color ? color : "";
|
|
12
21
|
opts = opts || {};
|
|
@@ -19,15 +28,8 @@ function tinycolor(color, opts) {
|
|
|
19
28
|
if (!(this instanceof tinycolor)) {
|
|
20
29
|
return new tinycolor(color, opts);
|
|
21
30
|
}
|
|
22
|
-
|
|
23
31
|
var rgb = inputToRGB(color);
|
|
24
|
-
|
|
25
|
-
(this._r = rgb.r),
|
|
26
|
-
(this._g = rgb.g),
|
|
27
|
-
(this._b = rgb.b),
|
|
28
|
-
(this._a = rgb.a),
|
|
29
|
-
(this._roundA = Math.round(100 * this._a) / 100),
|
|
30
|
-
(this._format = opts.format || rgb.format);
|
|
32
|
+
this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
|
|
31
33
|
this._gradientType = opts.gradientType;
|
|
32
34
|
|
|
33
35
|
// Don't let the range of [0,255] come back in [0,1].
|
|
@@ -37,194 +39,140 @@ function tinycolor(color, opts) {
|
|
|
37
39
|
if (this._r < 1) this._r = Math.round(this._r);
|
|
38
40
|
if (this._g < 1) this._g = Math.round(this._g);
|
|
39
41
|
if (this._b < 1) this._b = Math.round(this._b);
|
|
40
|
-
|
|
41
42
|
this._ok = rgb.ok;
|
|
42
43
|
}
|
|
43
|
-
|
|
44
44
|
tinycolor.prototype = {
|
|
45
|
-
isDark: function () {
|
|
45
|
+
isDark: function isDark() {
|
|
46
46
|
return this.getBrightness() < 128;
|
|
47
47
|
},
|
|
48
|
-
isLight: function () {
|
|
48
|
+
isLight: function isLight() {
|
|
49
49
|
return !this.isDark();
|
|
50
50
|
},
|
|
51
|
-
isValid: function () {
|
|
51
|
+
isValid: function isValid() {
|
|
52
52
|
return this._ok;
|
|
53
53
|
},
|
|
54
|
-
getOriginalInput: function () {
|
|
54
|
+
getOriginalInput: function getOriginalInput() {
|
|
55
55
|
return this._originalInput;
|
|
56
56
|
},
|
|
57
|
-
getFormat: function () {
|
|
57
|
+
getFormat: function getFormat() {
|
|
58
58
|
return this._format;
|
|
59
59
|
},
|
|
60
|
-
getAlpha: function () {
|
|
60
|
+
getAlpha: function getAlpha() {
|
|
61
61
|
return this._a;
|
|
62
62
|
},
|
|
63
|
-
getBrightness: function () {
|
|
63
|
+
getBrightness: function getBrightness() {
|
|
64
64
|
//http://www.w3.org/TR/AERT#color-contrast
|
|
65
65
|
var rgb = this.toRgb();
|
|
66
66
|
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
67
67
|
},
|
|
68
|
-
getLuminance: function () {
|
|
68
|
+
getLuminance: function getLuminance() {
|
|
69
69
|
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
70
70
|
var rgb = this.toRgb();
|
|
71
71
|
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
72
72
|
RsRGB = rgb.r / 255;
|
|
73
73
|
GsRGB = rgb.g / 255;
|
|
74
74
|
BsRGB = rgb.b / 255;
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
else
|
|
78
|
-
if (GsRGB <= 0.03928) G = GsRGB / 12.92;
|
|
79
|
-
else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
80
|
-
if (BsRGB <= 0.03928) B = BsRGB / 12.92;
|
|
81
|
-
else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
75
|
+
if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
76
|
+
if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
77
|
+
if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
82
78
|
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
83
79
|
},
|
|
84
|
-
setAlpha: function (value) {
|
|
80
|
+
setAlpha: function setAlpha(value) {
|
|
85
81
|
this._a = boundAlpha(value);
|
|
86
82
|
this._roundA = Math.round(100 * this._a) / 100;
|
|
87
83
|
return this;
|
|
88
84
|
},
|
|
89
|
-
toHsv: function () {
|
|
85
|
+
toHsv: function toHsv() {
|
|
90
86
|
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
91
|
-
return {
|
|
87
|
+
return {
|
|
88
|
+
h: hsv.h * 360,
|
|
89
|
+
s: hsv.s,
|
|
90
|
+
v: hsv.v,
|
|
91
|
+
a: this._a
|
|
92
|
+
};
|
|
92
93
|
},
|
|
93
|
-
toHsvString: function () {
|
|
94
|
+
toHsvString: function toHsvString() {
|
|
94
95
|
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
95
96
|
var h = Math.round(hsv.h * 360),
|
|
96
97
|
s = Math.round(hsv.s * 100),
|
|
97
98
|
v = Math.round(hsv.v * 100);
|
|
98
|
-
return this._a == 1
|
|
99
|
-
? "hsv(" + h + ", " + s + "%, " + v + "%)"
|
|
100
|
-
: "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
99
|
+
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
101
100
|
},
|
|
102
|
-
toHsl: function () {
|
|
101
|
+
toHsl: function toHsl() {
|
|
103
102
|
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
104
|
-
return {
|
|
103
|
+
return {
|
|
104
|
+
h: hsl.h * 360,
|
|
105
|
+
s: hsl.s,
|
|
106
|
+
l: hsl.l,
|
|
107
|
+
a: this._a
|
|
108
|
+
};
|
|
105
109
|
},
|
|
106
|
-
toHslString: function () {
|
|
110
|
+
toHslString: function toHslString() {
|
|
107
111
|
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
108
112
|
var h = Math.round(hsl.h * 360),
|
|
109
113
|
s = Math.round(hsl.s * 100),
|
|
110
114
|
l = Math.round(hsl.l * 100);
|
|
111
|
-
return this._a == 1
|
|
112
|
-
? "hsl(" + h + ", " + s + "%, " + l + "%)"
|
|
113
|
-
: "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
115
|
+
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
114
116
|
},
|
|
115
|
-
toHex: function (allow3Char) {
|
|
117
|
+
toHex: function toHex(allow3Char) {
|
|
116
118
|
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
117
119
|
},
|
|
118
|
-
toHexString: function (allow3Char) {
|
|
120
|
+
toHexString: function toHexString(allow3Char) {
|
|
119
121
|
return "#" + this.toHex(allow3Char);
|
|
120
122
|
},
|
|
121
|
-
toHex8: function (allow4Char) {
|
|
123
|
+
toHex8: function toHex8(allow4Char) {
|
|
122
124
|
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
123
125
|
},
|
|
124
|
-
toHex8String: function (allow4Char) {
|
|
126
|
+
toHex8String: function toHex8String(allow4Char) {
|
|
125
127
|
return "#" + this.toHex8(allow4Char);
|
|
126
128
|
},
|
|
127
|
-
toRgb: function () {
|
|
129
|
+
toRgb: function toRgb() {
|
|
128
130
|
return {
|
|
129
131
|
r: Math.round(this._r),
|
|
130
132
|
g: Math.round(this._g),
|
|
131
133
|
b: Math.round(this._b),
|
|
132
|
-
a: this._a
|
|
134
|
+
a: this._a
|
|
133
135
|
};
|
|
134
136
|
},
|
|
135
|
-
toRgbString: function () {
|
|
136
|
-
return this._a == 1
|
|
137
|
-
? "rgb(" +
|
|
138
|
-
Math.round(this._r) +
|
|
139
|
-
", " +
|
|
140
|
-
Math.round(this._g) +
|
|
141
|
-
", " +
|
|
142
|
-
Math.round(this._b) +
|
|
143
|
-
")"
|
|
144
|
-
: "rgba(" +
|
|
145
|
-
Math.round(this._r) +
|
|
146
|
-
", " +
|
|
147
|
-
Math.round(this._g) +
|
|
148
|
-
", " +
|
|
149
|
-
Math.round(this._b) +
|
|
150
|
-
", " +
|
|
151
|
-
this._roundA +
|
|
152
|
-
")";
|
|
137
|
+
toRgbString: function toRgbString() {
|
|
138
|
+
return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
|
|
153
139
|
},
|
|
154
|
-
toPercentageRgb: function () {
|
|
140
|
+
toPercentageRgb: function toPercentageRgb() {
|
|
155
141
|
return {
|
|
156
142
|
r: Math.round(bound01(this._r, 255) * 100) + "%",
|
|
157
143
|
g: Math.round(bound01(this._g, 255) * 100) + "%",
|
|
158
144
|
b: Math.round(bound01(this._b, 255) * 100) + "%",
|
|
159
|
-
a: this._a
|
|
145
|
+
a: this._a
|
|
160
146
|
};
|
|
161
147
|
},
|
|
162
|
-
toPercentageRgbString: function () {
|
|
163
|
-
return this._a == 1
|
|
164
|
-
? "rgb(" +
|
|
165
|
-
Math.round(bound01(this._r, 255) * 100) +
|
|
166
|
-
"%, " +
|
|
167
|
-
Math.round(bound01(this._g, 255) * 100) +
|
|
168
|
-
"%, " +
|
|
169
|
-
Math.round(bound01(this._b, 255) * 100) +
|
|
170
|
-
"%)"
|
|
171
|
-
: "rgba(" +
|
|
172
|
-
Math.round(bound01(this._r, 255) * 100) +
|
|
173
|
-
"%, " +
|
|
174
|
-
Math.round(bound01(this._g, 255) * 100) +
|
|
175
|
-
"%, " +
|
|
176
|
-
Math.round(bound01(this._b, 255) * 100) +
|
|
177
|
-
"%, " +
|
|
178
|
-
this._roundA +
|
|
179
|
-
")";
|
|
148
|
+
toPercentageRgbString: function toPercentageRgbString() {
|
|
149
|
+
return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
180
150
|
},
|
|
181
|
-
toName: function () {
|
|
151
|
+
toName: function toName() {
|
|
182
152
|
if (this._a === 0) {
|
|
183
153
|
return "transparent";
|
|
184
154
|
}
|
|
185
|
-
|
|
186
155
|
if (this._a < 1) {
|
|
187
156
|
return false;
|
|
188
157
|
}
|
|
189
|
-
|
|
190
158
|
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
191
159
|
},
|
|
192
|
-
toFilter: function (secondColor) {
|
|
160
|
+
toFilter: function toFilter(secondColor) {
|
|
193
161
|
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
194
162
|
var secondHex8String = hex8String;
|
|
195
163
|
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
196
|
-
|
|
197
164
|
if (secondColor) {
|
|
198
165
|
var s = tinycolor(secondColor);
|
|
199
166
|
secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
200
167
|
}
|
|
201
|
-
|
|
202
|
-
return (
|
|
203
|
-
"progid:DXImageTransform.Microsoft.gradient(" +
|
|
204
|
-
gradientType +
|
|
205
|
-
"startColorstr=" +
|
|
206
|
-
hex8String +
|
|
207
|
-
",endColorstr=" +
|
|
208
|
-
secondHex8String +
|
|
209
|
-
")"
|
|
210
|
-
);
|
|
168
|
+
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
|
|
211
169
|
},
|
|
212
|
-
toString: function (format) {
|
|
170
|
+
toString: function toString(format) {
|
|
213
171
|
var formatSet = !!format;
|
|
214
172
|
format = format || this._format;
|
|
215
|
-
|
|
216
173
|
var formattedString = false;
|
|
217
174
|
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
218
|
-
var needsAlphaFormat =
|
|
219
|
-
!formatSet &&
|
|
220
|
-
hasAlpha &&
|
|
221
|
-
(format === "hex" ||
|
|
222
|
-
format === "hex6" ||
|
|
223
|
-
format === "hex3" ||
|
|
224
|
-
format === "hex4" ||
|
|
225
|
-
format === "hex8" ||
|
|
226
|
-
format === "name");
|
|
227
|
-
|
|
175
|
+
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
228
176
|
if (needsAlphaFormat) {
|
|
229
177
|
// Special case for "transparent", all other non-alpha formats
|
|
230
178
|
// will return rgba when there is transparency.
|
|
@@ -260,14 +208,12 @@ tinycolor.prototype = {
|
|
|
260
208
|
if (format === "hsv") {
|
|
261
209
|
formattedString = this.toHsvString();
|
|
262
210
|
}
|
|
263
|
-
|
|
264
211
|
return formattedString || this.toHexString();
|
|
265
212
|
},
|
|
266
|
-
clone: function () {
|
|
213
|
+
clone: function clone() {
|
|
267
214
|
return tinycolor(this.toString());
|
|
268
215
|
},
|
|
269
|
-
|
|
270
|
-
_applyModification: function (fn, args) {
|
|
216
|
+
_applyModification: function _applyModification(fn, args) {
|
|
271
217
|
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
272
218
|
this._r = color._r;
|
|
273
219
|
this._g = color._g;
|
|
@@ -275,59 +221,58 @@ tinycolor.prototype = {
|
|
|
275
221
|
this.setAlpha(color._a);
|
|
276
222
|
return this;
|
|
277
223
|
},
|
|
278
|
-
lighten: function () {
|
|
279
|
-
return this._applyModification(
|
|
224
|
+
lighten: function lighten() {
|
|
225
|
+
return this._applyModification(_lighten, arguments);
|
|
280
226
|
},
|
|
281
|
-
brighten: function () {
|
|
282
|
-
return this._applyModification(
|
|
227
|
+
brighten: function brighten() {
|
|
228
|
+
return this._applyModification(_brighten, arguments);
|
|
283
229
|
},
|
|
284
|
-
darken: function () {
|
|
285
|
-
return this._applyModification(
|
|
230
|
+
darken: function darken() {
|
|
231
|
+
return this._applyModification(_darken, arguments);
|
|
286
232
|
},
|
|
287
|
-
desaturate: function () {
|
|
288
|
-
return this._applyModification(
|
|
233
|
+
desaturate: function desaturate() {
|
|
234
|
+
return this._applyModification(_desaturate, arguments);
|
|
289
235
|
},
|
|
290
|
-
saturate: function () {
|
|
291
|
-
return this._applyModification(
|
|
236
|
+
saturate: function saturate() {
|
|
237
|
+
return this._applyModification(_saturate, arguments);
|
|
292
238
|
},
|
|
293
|
-
greyscale: function () {
|
|
294
|
-
return this._applyModification(
|
|
239
|
+
greyscale: function greyscale() {
|
|
240
|
+
return this._applyModification(_greyscale, arguments);
|
|
295
241
|
},
|
|
296
|
-
spin: function () {
|
|
297
|
-
return this._applyModification(
|
|
242
|
+
spin: function spin() {
|
|
243
|
+
return this._applyModification(_spin, arguments);
|
|
298
244
|
},
|
|
299
|
-
|
|
300
|
-
_applyCombination: function (fn, args) {
|
|
245
|
+
_applyCombination: function _applyCombination(fn, args) {
|
|
301
246
|
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
302
247
|
},
|
|
303
|
-
analogous: function () {
|
|
304
|
-
return this._applyCombination(
|
|
248
|
+
analogous: function analogous() {
|
|
249
|
+
return this._applyCombination(_analogous, arguments);
|
|
305
250
|
},
|
|
306
|
-
complement: function () {
|
|
307
|
-
return this._applyCombination(
|
|
251
|
+
complement: function complement() {
|
|
252
|
+
return this._applyCombination(_complement, arguments);
|
|
308
253
|
},
|
|
309
|
-
monochromatic: function () {
|
|
310
|
-
return this._applyCombination(
|
|
254
|
+
monochromatic: function monochromatic() {
|
|
255
|
+
return this._applyCombination(_monochromatic, arguments);
|
|
311
256
|
},
|
|
312
|
-
splitcomplement: function () {
|
|
313
|
-
return this._applyCombination(
|
|
257
|
+
splitcomplement: function splitcomplement() {
|
|
258
|
+
return this._applyCombination(_splitcomplement, arguments);
|
|
314
259
|
},
|
|
315
260
|
// Disabled until https://github.com/bgrins/TinyColor/issues/254
|
|
316
261
|
// polyad: function (number) {
|
|
317
262
|
// return this._applyCombination(polyad, [number]);
|
|
318
263
|
// },
|
|
319
|
-
triad: function () {
|
|
264
|
+
triad: function triad() {
|
|
320
265
|
return this._applyCombination(polyad, [3]);
|
|
321
266
|
},
|
|
322
|
-
tetrad: function () {
|
|
267
|
+
tetrad: function tetrad() {
|
|
323
268
|
return this._applyCombination(polyad, [4]);
|
|
324
|
-
}
|
|
269
|
+
}
|
|
325
270
|
};
|
|
326
271
|
|
|
327
272
|
// If input is an object, force 1 into "1.0" to handle ratios properly
|
|
328
273
|
// String input requires "1.0" as input, so 1 will be treated as 1
|
|
329
274
|
tinycolor.fromRatio = function (color, opts) {
|
|
330
|
-
if (
|
|
275
|
+
if (_typeof(color) == "object") {
|
|
331
276
|
var newColor = {};
|
|
332
277
|
for (var i in color) {
|
|
333
278
|
if (color.hasOwnProperty(i)) {
|
|
@@ -340,7 +285,6 @@ tinycolor.fromRatio = function (color, opts) {
|
|
|
340
285
|
}
|
|
341
286
|
color = newColor;
|
|
342
287
|
}
|
|
343
|
-
|
|
344
288
|
return tinycolor(color, opts);
|
|
345
289
|
};
|
|
346
290
|
|
|
@@ -360,63 +304,50 @@ tinycolor.fromRatio = function (color, opts) {
|
|
|
360
304
|
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
361
305
|
//
|
|
362
306
|
function inputToRGB(color) {
|
|
363
|
-
var rgb = {
|
|
307
|
+
var rgb = {
|
|
308
|
+
r: 0,
|
|
309
|
+
g: 0,
|
|
310
|
+
b: 0
|
|
311
|
+
};
|
|
364
312
|
var a = 1;
|
|
365
313
|
var s = null;
|
|
366
314
|
var v = null;
|
|
367
315
|
var l = null;
|
|
368
316
|
var ok = false;
|
|
369
317
|
var format = false;
|
|
370
|
-
|
|
371
318
|
if (typeof color == "string") {
|
|
372
319
|
color = stringInputToObject(color);
|
|
373
320
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
if (
|
|
377
|
-
isValidCSSUnit(color.r) &&
|
|
378
|
-
isValidCSSUnit(color.g) &&
|
|
379
|
-
isValidCSSUnit(color.b)
|
|
380
|
-
) {
|
|
321
|
+
if (_typeof(color) == "object") {
|
|
322
|
+
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
381
323
|
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
382
324
|
ok = true;
|
|
383
325
|
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
384
|
-
} else if (
|
|
385
|
-
isValidCSSUnit(color.h) &&
|
|
386
|
-
isValidCSSUnit(color.s) &&
|
|
387
|
-
isValidCSSUnit(color.v)
|
|
388
|
-
) {
|
|
326
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
389
327
|
s = convertToPercentage(color.s);
|
|
390
328
|
v = convertToPercentage(color.v);
|
|
391
329
|
rgb = hsvToRgb(color.h, s, v);
|
|
392
330
|
ok = true;
|
|
393
331
|
format = "hsv";
|
|
394
|
-
} else if (
|
|
395
|
-
isValidCSSUnit(color.h) &&
|
|
396
|
-
isValidCSSUnit(color.s) &&
|
|
397
|
-
isValidCSSUnit(color.l)
|
|
398
|
-
) {
|
|
332
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
399
333
|
s = convertToPercentage(color.s);
|
|
400
334
|
l = convertToPercentage(color.l);
|
|
401
335
|
rgb = hslToRgb(color.h, s, l);
|
|
402
336
|
ok = true;
|
|
403
337
|
format = "hsl";
|
|
404
338
|
}
|
|
405
|
-
|
|
406
339
|
if (color.hasOwnProperty("a")) {
|
|
407
340
|
a = color.a;
|
|
408
341
|
}
|
|
409
342
|
}
|
|
410
|
-
|
|
411
343
|
a = boundAlpha(a);
|
|
412
|
-
|
|
413
344
|
return {
|
|
414
345
|
ok: ok,
|
|
415
346
|
format: color.format || format,
|
|
416
347
|
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
417
348
|
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
418
349
|
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
419
|
-
a: a
|
|
350
|
+
a: a
|
|
420
351
|
};
|
|
421
352
|
}
|
|
422
353
|
|
|
@@ -435,7 +366,7 @@ function rgbToRgb(r, g, b) {
|
|
|
435
366
|
return {
|
|
436
367
|
r: bound01(r, 255) * 255,
|
|
437
368
|
g: bound01(g, 255) * 255,
|
|
438
|
-
b: bound01(b, 255) * 255
|
|
369
|
+
b: bound01(b, 255) * 255
|
|
439
370
|
};
|
|
440
371
|
}
|
|
441
372
|
|
|
@@ -447,13 +378,11 @@ function rgbToHsl(r, g, b) {
|
|
|
447
378
|
r = bound01(r, 255);
|
|
448
379
|
g = bound01(g, 255);
|
|
449
380
|
b = bound01(b, 255);
|
|
450
|
-
|
|
451
381
|
var max = Math.max(r, g, b),
|
|
452
382
|
min = Math.min(r, g, b);
|
|
453
383
|
var h,
|
|
454
384
|
s,
|
|
455
385
|
l = (max + min) / 2;
|
|
456
|
-
|
|
457
386
|
if (max == min) {
|
|
458
387
|
h = s = 0; // achromatic
|
|
459
388
|
} else {
|
|
@@ -470,11 +399,13 @@ function rgbToHsl(r, g, b) {
|
|
|
470
399
|
h = (r - g) / d + 4;
|
|
471
400
|
break;
|
|
472
401
|
}
|
|
473
|
-
|
|
474
402
|
h /= 6;
|
|
475
403
|
}
|
|
476
|
-
|
|
477
|
-
|
|
404
|
+
return {
|
|
405
|
+
h: h,
|
|
406
|
+
s: s,
|
|
407
|
+
l: l
|
|
408
|
+
};
|
|
478
409
|
}
|
|
479
410
|
|
|
480
411
|
// `hslToRgb`
|
|
@@ -483,11 +414,9 @@ function rgbToHsl(r, g, b) {
|
|
|
483
414
|
// *Returns:* { r, g, b } in the set [0, 255]
|
|
484
415
|
function hslToRgb(h, s, l) {
|
|
485
416
|
var r, g, b;
|
|
486
|
-
|
|
487
417
|
h = bound01(h, 360);
|
|
488
418
|
s = bound01(s, 100);
|
|
489
419
|
l = bound01(l, 100);
|
|
490
|
-
|
|
491
420
|
function hue2rgb(p, q, t) {
|
|
492
421
|
if (t < 0) t += 1;
|
|
493
422
|
if (t > 1) t -= 1;
|
|
@@ -496,7 +425,6 @@ function hslToRgb(h, s, l) {
|
|
|
496
425
|
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
497
426
|
return p;
|
|
498
427
|
}
|
|
499
|
-
|
|
500
428
|
if (s === 0) {
|
|
501
429
|
r = g = b = l; // achromatic
|
|
502
430
|
} else {
|
|
@@ -506,8 +434,11 @@ function hslToRgb(h, s, l) {
|
|
|
506
434
|
g = hue2rgb(p, q, h);
|
|
507
435
|
b = hue2rgb(p, q, h - 1 / 3);
|
|
508
436
|
}
|
|
509
|
-
|
|
510
|
-
|
|
437
|
+
return {
|
|
438
|
+
r: r * 255,
|
|
439
|
+
g: g * 255,
|
|
440
|
+
b: b * 255
|
|
441
|
+
};
|
|
511
442
|
}
|
|
512
443
|
|
|
513
444
|
// `rgbToHsv`
|
|
@@ -518,16 +449,13 @@ function rgbToHsv(r, g, b) {
|
|
|
518
449
|
r = bound01(r, 255);
|
|
519
450
|
g = bound01(g, 255);
|
|
520
451
|
b = bound01(b, 255);
|
|
521
|
-
|
|
522
452
|
var max = Math.max(r, g, b),
|
|
523
453
|
min = Math.min(r, g, b);
|
|
524
454
|
var h,
|
|
525
455
|
s,
|
|
526
456
|
v = max;
|
|
527
|
-
|
|
528
457
|
var d = max - min;
|
|
529
458
|
s = max === 0 ? 0 : d / max;
|
|
530
|
-
|
|
531
459
|
if (max == min) {
|
|
532
460
|
h = 0; // achromatic
|
|
533
461
|
} else {
|
|
@@ -544,7 +472,11 @@ function rgbToHsv(r, g, b) {
|
|
|
544
472
|
}
|
|
545
473
|
h /= 6;
|
|
546
474
|
}
|
|
547
|
-
return {
|
|
475
|
+
return {
|
|
476
|
+
h: h,
|
|
477
|
+
s: s,
|
|
478
|
+
v: v
|
|
479
|
+
};
|
|
548
480
|
}
|
|
549
481
|
|
|
550
482
|
// `hsvToRgb`
|
|
@@ -555,7 +487,6 @@ function hsvToRgb(h, s, v) {
|
|
|
555
487
|
h = bound01(h, 360) * 6;
|
|
556
488
|
s = bound01(s, 100);
|
|
557
489
|
v = bound01(v, 100);
|
|
558
|
-
|
|
559
490
|
var i = Math.floor(h),
|
|
560
491
|
f = h - i,
|
|
561
492
|
p = v * (1 - s),
|
|
@@ -565,8 +496,11 @@ function hsvToRgb(h, s, v) {
|
|
|
565
496
|
r = [v, q, p, p, t, v][mod],
|
|
566
497
|
g = [t, v, v, q, p, p][mod],
|
|
567
498
|
b = [p, p, t, v, v, q][mod];
|
|
568
|
-
|
|
569
|
-
|
|
499
|
+
return {
|
|
500
|
+
r: r * 255,
|
|
501
|
+
g: g * 255,
|
|
502
|
+
b: b * 255
|
|
503
|
+
};
|
|
570
504
|
}
|
|
571
505
|
|
|
572
506
|
// `rgbToHex`
|
|
@@ -574,22 +508,12 @@ function hsvToRgb(h, s, v) {
|
|
|
574
508
|
// Assumes r, g, and b are contained in the set [0, 255]
|
|
575
509
|
// Returns a 3 or 6 character hex
|
|
576
510
|
function rgbToHex(r, g, b, allow3Char) {
|
|
577
|
-
var hex = [
|
|
578
|
-
pad2(Math.round(r).toString(16)),
|
|
579
|
-
pad2(Math.round(g).toString(16)),
|
|
580
|
-
pad2(Math.round(b).toString(16)),
|
|
581
|
-
];
|
|
511
|
+
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
|
|
582
512
|
|
|
583
513
|
// Return a 3 character hex if possible
|
|
584
|
-
if (
|
|
585
|
-
allow3Char &&
|
|
586
|
-
hex[0].charAt(0) == hex[0].charAt(1) &&
|
|
587
|
-
hex[1].charAt(0) == hex[1].charAt(1) &&
|
|
588
|
-
hex[2].charAt(0) == hex[2].charAt(1)
|
|
589
|
-
) {
|
|
514
|
+
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
|
|
590
515
|
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
591
516
|
}
|
|
592
|
-
|
|
593
517
|
return hex.join("");
|
|
594
518
|
}
|
|
595
519
|
|
|
@@ -598,26 +522,12 @@ function rgbToHex(r, g, b, allow3Char) {
|
|
|
598
522
|
// Assumes r, g, b are contained in the set [0, 255] and
|
|
599
523
|
// a in [0, 1]. Returns a 4 or 8 character rgba hex
|
|
600
524
|
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
601
|
-
var hex = [
|
|
602
|
-
pad2(Math.round(r).toString(16)),
|
|
603
|
-
pad2(Math.round(g).toString(16)),
|
|
604
|
-
pad2(Math.round(b).toString(16)),
|
|
605
|
-
pad2(convertDecimalToHex(a)),
|
|
606
|
-
];
|
|
525
|
+
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
|
|
607
526
|
|
|
608
527
|
// Return a 4 character hex if possible
|
|
609
|
-
if (
|
|
610
|
-
|
|
611
|
-
hex[0].charAt(0) == hex[0].charAt(1) &&
|
|
612
|
-
hex[1].charAt(0) == hex[1].charAt(1) &&
|
|
613
|
-
hex[2].charAt(0) == hex[2].charAt(1) &&
|
|
614
|
-
hex[3].charAt(0) == hex[3].charAt(1)
|
|
615
|
-
) {
|
|
616
|
-
return (
|
|
617
|
-
hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0)
|
|
618
|
-
);
|
|
528
|
+
if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
|
|
529
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
619
530
|
}
|
|
620
|
-
|
|
621
531
|
return hex.join("");
|
|
622
532
|
}
|
|
623
533
|
|
|
@@ -625,13 +535,7 @@ function rgbaToHex(r, g, b, a, allow4Char) {
|
|
|
625
535
|
// Converts an RGBA color to an ARGB Hex8 string
|
|
626
536
|
// Rarely used, but required for "toFilter()"
|
|
627
537
|
function rgbaToArgbHex(r, g, b, a) {
|
|
628
|
-
var hex = [
|
|
629
|
-
pad2(convertDecimalToHex(a)),
|
|
630
|
-
pad2(Math.round(r).toString(16)),
|
|
631
|
-
pad2(Math.round(g).toString(16)),
|
|
632
|
-
pad2(Math.round(b).toString(16)),
|
|
633
|
-
];
|
|
634
|
-
|
|
538
|
+
var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
|
|
635
539
|
return hex.join("");
|
|
636
540
|
}
|
|
637
541
|
|
|
@@ -641,12 +545,11 @@ tinycolor.equals = function (color1, color2) {
|
|
|
641
545
|
if (!color1 || !color2) return false;
|
|
642
546
|
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
643
547
|
};
|
|
644
|
-
|
|
645
548
|
tinycolor.random = function () {
|
|
646
549
|
return tinycolor.fromRatio({
|
|
647
550
|
r: Math.random(),
|
|
648
551
|
g: Math.random(),
|
|
649
|
-
b: Math.random()
|
|
552
|
+
b: Math.random()
|
|
650
553
|
});
|
|
651
554
|
};
|
|
652
555
|
|
|
@@ -655,35 +558,31 @@ tinycolor.random = function () {
|
|
|
655
558
|
// Thanks to less.js for some of the basics here
|
|
656
559
|
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
|
|
657
560
|
|
|
658
|
-
function
|
|
561
|
+
function _desaturate(color, amount) {
|
|
659
562
|
amount = amount === 0 ? 0 : amount || 10;
|
|
660
563
|
var hsl = tinycolor(color).toHsl();
|
|
661
564
|
hsl.s -= amount / 100;
|
|
662
565
|
hsl.s = clamp01(hsl.s);
|
|
663
566
|
return tinycolor(hsl);
|
|
664
567
|
}
|
|
665
|
-
|
|
666
|
-
function saturate(color, amount) {
|
|
568
|
+
function _saturate(color, amount) {
|
|
667
569
|
amount = amount === 0 ? 0 : amount || 10;
|
|
668
570
|
var hsl = tinycolor(color).toHsl();
|
|
669
571
|
hsl.s += amount / 100;
|
|
670
572
|
hsl.s = clamp01(hsl.s);
|
|
671
573
|
return tinycolor(hsl);
|
|
672
574
|
}
|
|
673
|
-
|
|
674
|
-
function greyscale(color) {
|
|
575
|
+
function _greyscale(color) {
|
|
675
576
|
return tinycolor(color).desaturate(100);
|
|
676
577
|
}
|
|
677
|
-
|
|
678
|
-
function lighten(color, amount) {
|
|
578
|
+
function _lighten(color, amount) {
|
|
679
579
|
amount = amount === 0 ? 0 : amount || 10;
|
|
680
580
|
var hsl = tinycolor(color).toHsl();
|
|
681
581
|
hsl.l += amount / 100;
|
|
682
582
|
hsl.l = clamp01(hsl.l);
|
|
683
583
|
return tinycolor(hsl);
|
|
684
584
|
}
|
|
685
|
-
|
|
686
|
-
function brighten(color, amount) {
|
|
585
|
+
function _brighten(color, amount) {
|
|
687
586
|
amount = amount === 0 ? 0 : amount || 10;
|
|
688
587
|
var rgb = tinycolor(color).toRgb();
|
|
689
588
|
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
@@ -691,8 +590,7 @@ function brighten(color, amount) {
|
|
|
691
590
|
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
692
591
|
return tinycolor(rgb);
|
|
693
592
|
}
|
|
694
|
-
|
|
695
|
-
function darken(color, amount) {
|
|
593
|
+
function _darken(color, amount) {
|
|
696
594
|
amount = amount === 0 ? 0 : amount || 10;
|
|
697
595
|
var hsl = tinycolor(color).toHsl();
|
|
698
596
|
hsl.l -= amount / 100;
|
|
@@ -702,7 +600,7 @@ function darken(color, amount) {
|
|
|
702
600
|
|
|
703
601
|
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
704
602
|
// Values outside of this range will be wrapped into this range.
|
|
705
|
-
function
|
|
603
|
+
function _spin(color, amount) {
|
|
706
604
|
var hsl = tinycolor(color).toHsl();
|
|
707
605
|
var hue = (hsl.h + amount) % 360;
|
|
708
606
|
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
@@ -714,12 +612,11 @@ function spin(color, amount) {
|
|
|
714
612
|
// Thanks to jQuery xColor for some of the ideas behind these
|
|
715
613
|
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
|
716
614
|
|
|
717
|
-
function
|
|
615
|
+
function _complement(color) {
|
|
718
616
|
var hsl = tinycolor(color).toHsl();
|
|
719
617
|
hsl.h = (hsl.h + 180) % 360;
|
|
720
618
|
return tinycolor(hsl);
|
|
721
619
|
}
|
|
722
|
-
|
|
723
620
|
function polyad(color, number) {
|
|
724
621
|
if (isNaN(number) || number <= 0) {
|
|
725
622
|
throw new Error("Argument to polyad must be a positive number");
|
|
@@ -728,38 +625,40 @@ function polyad(color, number) {
|
|
|
728
625
|
var result = [tinycolor(color)];
|
|
729
626
|
var step = 360 / number;
|
|
730
627
|
for (var i = 1; i < number; i++) {
|
|
731
|
-
result.push(tinycolor({
|
|
628
|
+
result.push(tinycolor({
|
|
629
|
+
h: (hsl.h + i * step) % 360,
|
|
630
|
+
s: hsl.s,
|
|
631
|
+
l: hsl.l
|
|
632
|
+
}));
|
|
732
633
|
}
|
|
733
|
-
|
|
734
634
|
return result;
|
|
735
635
|
}
|
|
736
|
-
|
|
737
|
-
function splitcomplement(color) {
|
|
636
|
+
function _splitcomplement(color) {
|
|
738
637
|
var hsl = tinycolor(color).toHsl();
|
|
739
638
|
var h = hsl.h;
|
|
740
|
-
return [
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
639
|
+
return [tinycolor(color), tinycolor({
|
|
640
|
+
h: (h + 72) % 360,
|
|
641
|
+
s: hsl.s,
|
|
642
|
+
l: hsl.l
|
|
643
|
+
}), tinycolor({
|
|
644
|
+
h: (h + 216) % 360,
|
|
645
|
+
s: hsl.s,
|
|
646
|
+
l: hsl.l
|
|
647
|
+
})];
|
|
745
648
|
}
|
|
746
|
-
|
|
747
|
-
function analogous(color, results, slices) {
|
|
649
|
+
function _analogous(color, results, slices) {
|
|
748
650
|
results = results || 6;
|
|
749
651
|
slices = slices || 30;
|
|
750
|
-
|
|
751
652
|
var hsl = tinycolor(color).toHsl();
|
|
752
653
|
var part = 360 / slices;
|
|
753
654
|
var ret = [tinycolor(color)];
|
|
754
|
-
|
|
755
|
-
for (hsl.h = (hsl.h - ((part * results) >> 1) + 720) % 360; --results; ) {
|
|
655
|
+
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
|
|
756
656
|
hsl.h = (hsl.h + part) % 360;
|
|
757
657
|
ret.push(tinycolor(hsl));
|
|
758
658
|
}
|
|
759
659
|
return ret;
|
|
760
660
|
}
|
|
761
|
-
|
|
762
|
-
function monochromatic(color, results) {
|
|
661
|
+
function _monochromatic(color, results) {
|
|
763
662
|
results = results || 6;
|
|
764
663
|
var hsv = tinycolor(color).toHsv();
|
|
765
664
|
var h = hsv.h,
|
|
@@ -767,12 +666,14 @@ function monochromatic(color, results) {
|
|
|
767
666
|
v = hsv.v;
|
|
768
667
|
var ret = [];
|
|
769
668
|
var modification = 1 / results;
|
|
770
|
-
|
|
771
669
|
while (results--) {
|
|
772
|
-
ret.push(tinycolor({
|
|
670
|
+
ret.push(tinycolor({
|
|
671
|
+
h: h,
|
|
672
|
+
s: s,
|
|
673
|
+
v: v
|
|
674
|
+
}));
|
|
773
675
|
v = (v + modification) % 1;
|
|
774
676
|
}
|
|
775
|
-
|
|
776
677
|
return ret;
|
|
777
678
|
}
|
|
778
679
|
|
|
@@ -781,19 +682,15 @@ function monochromatic(color, results) {
|
|
|
781
682
|
|
|
782
683
|
tinycolor.mix = function (color1, color2, amount) {
|
|
783
684
|
amount = amount === 0 ? 0 : amount || 50;
|
|
784
|
-
|
|
785
685
|
var rgb1 = tinycolor(color1).toRgb();
|
|
786
686
|
var rgb2 = tinycolor(color2).toRgb();
|
|
787
|
-
|
|
788
687
|
var p = amount / 100;
|
|
789
|
-
|
|
790
688
|
var rgba = {
|
|
791
689
|
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
792
690
|
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
793
691
|
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
794
|
-
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
692
|
+
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
795
693
|
};
|
|
796
|
-
|
|
797
694
|
return tinycolor(rgba);
|
|
798
695
|
};
|
|
799
696
|
|
|
@@ -806,10 +703,7 @@ tinycolor.mix = function (color1, color2, amount) {
|
|
|
806
703
|
tinycolor.readability = function (color1, color2) {
|
|
807
704
|
var c1 = tinycolor(color1);
|
|
808
705
|
var c2 = tinycolor(color2);
|
|
809
|
-
return (
|
|
810
|
-
(Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) /
|
|
811
|
-
(Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05)
|
|
812
|
-
);
|
|
706
|
+
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
|
|
813
707
|
};
|
|
814
708
|
|
|
815
709
|
// `isReadable`
|
|
@@ -825,9 +719,7 @@ tinycolor.readability = function (color1, color2) {
|
|
|
825
719
|
tinycolor.isReadable = function (color1, color2, wcag2) {
|
|
826
720
|
var readability = tinycolor.readability(color1, color2);
|
|
827
721
|
var wcag2Parms, out;
|
|
828
|
-
|
|
829
722
|
out = false;
|
|
830
|
-
|
|
831
723
|
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
832
724
|
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
833
725
|
case "AAsmall":
|
|
@@ -862,7 +754,6 @@ tinycolor.mostReadable = function (baseColor, colorList, args) {
|
|
|
862
754
|
includeFallbackColors = args.includeFallbackColors;
|
|
863
755
|
level = args.level;
|
|
864
756
|
size = args.size;
|
|
865
|
-
|
|
866
757
|
for (var i = 0; i < colorList.length; i++) {
|
|
867
758
|
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
868
759
|
if (readability > bestScore) {
|
|
@@ -870,14 +761,10 @@ tinycolor.mostReadable = function (baseColor, colorList, args) {
|
|
|
870
761
|
bestColor = tinycolor(colorList[i]);
|
|
871
762
|
}
|
|
872
763
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
size: size,
|
|
878
|
-
}) ||
|
|
879
|
-
!includeFallbackColors
|
|
880
|
-
) {
|
|
764
|
+
if (tinycolor.isReadable(baseColor, bestColor, {
|
|
765
|
+
level: level,
|
|
766
|
+
size: size
|
|
767
|
+
}) || !includeFallbackColors) {
|
|
881
768
|
return bestColor;
|
|
882
769
|
} else {
|
|
883
770
|
args.includeFallbackColors = false;
|
|
@@ -888,7 +775,7 @@ tinycolor.mostReadable = function (baseColor, colorList, args) {
|
|
|
888
775
|
// Big List of Colors
|
|
889
776
|
// ------------------
|
|
890
777
|
// <https://www.w3.org/TR/css-color-4/#named-colors>
|
|
891
|
-
var names =
|
|
778
|
+
var names = tinycolor.names = {
|
|
892
779
|
aliceblue: "f0f8ff",
|
|
893
780
|
antiquewhite: "faebd7",
|
|
894
781
|
aqua: "0ff",
|
|
@@ -1037,11 +924,11 @@ var names = (tinycolor.names = {
|
|
|
1037
924
|
white: "fff",
|
|
1038
925
|
whitesmoke: "f5f5f5",
|
|
1039
926
|
yellow: "ff0",
|
|
1040
|
-
yellowgreen: "9acd32"
|
|
1041
|
-
}
|
|
927
|
+
yellowgreen: "9acd32"
|
|
928
|
+
};
|
|
1042
929
|
|
|
1043
930
|
// Make it easy to access colors via `hexNames[hex]`
|
|
1044
|
-
var hexNames =
|
|
931
|
+
var hexNames = tinycolor.hexNames = flip(names);
|
|
1045
932
|
|
|
1046
933
|
// Utilities
|
|
1047
934
|
// ---------
|
|
@@ -1060,18 +947,15 @@ function flip(o) {
|
|
|
1060
947
|
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
1061
948
|
function boundAlpha(a) {
|
|
1062
949
|
a = parseFloat(a);
|
|
1063
|
-
|
|
1064
950
|
if (isNaN(a) || a < 0 || a > 1) {
|
|
1065
951
|
a = 1;
|
|
1066
952
|
}
|
|
1067
|
-
|
|
1068
953
|
return a;
|
|
1069
954
|
}
|
|
1070
955
|
|
|
1071
956
|
// Take input from [0, n] and return it as [0, 1]
|
|
1072
957
|
function bound01(n, max) {
|
|
1073
958
|
if (isOnePointZero(n)) n = "100%";
|
|
1074
|
-
|
|
1075
959
|
var processPercent = isPercentage(n);
|
|
1076
960
|
n = Math.min(max, Math.max(0, parseFloat(n)));
|
|
1077
961
|
|
|
@@ -1086,7 +970,7 @@ function bound01(n, max) {
|
|
|
1086
970
|
}
|
|
1087
971
|
|
|
1088
972
|
// Convert into [0, 1] range if it isn't already
|
|
1089
|
-
return
|
|
973
|
+
return n % max / parseFloat(max);
|
|
1090
974
|
}
|
|
1091
975
|
|
|
1092
976
|
// Force a number between 0 and 1
|
|
@@ -1120,7 +1004,6 @@ function convertToPercentage(n) {
|
|
|
1120
1004
|
if (n <= 1) {
|
|
1121
1005
|
n = n * 100 + "%";
|
|
1122
1006
|
}
|
|
1123
|
-
|
|
1124
1007
|
return n;
|
|
1125
1008
|
}
|
|
1126
1009
|
|
|
@@ -1132,8 +1015,7 @@ function convertDecimalToHex(d) {
|
|
|
1132
1015
|
function convertHexToDecimal(h) {
|
|
1133
1016
|
return parseIntFromHex(h) / 255;
|
|
1134
1017
|
}
|
|
1135
|
-
|
|
1136
|
-
var matchers = (function () {
|
|
1018
|
+
var matchers = function () {
|
|
1137
1019
|
// <http://www.w3.org/TR/css3-values/#integers>
|
|
1138
1020
|
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
1139
1021
|
|
|
@@ -1146,25 +1028,8 @@ var matchers = (function () {
|
|
|
1146
1028
|
// Actual matching.
|
|
1147
1029
|
// Parentheses and commas are optional, but not required.
|
|
1148
1030
|
// Whitespace can take the place of commas or opening paren
|
|
1149
|
-
var PERMISSIVE_MATCH3 =
|
|
1150
|
-
|
|
1151
|
-
CSS_UNIT +
|
|
1152
|
-
")[,|\\s]+(" +
|
|
1153
|
-
CSS_UNIT +
|
|
1154
|
-
")[,|\\s]+(" +
|
|
1155
|
-
CSS_UNIT +
|
|
1156
|
-
")\\s*\\)?";
|
|
1157
|
-
var PERMISSIVE_MATCH4 =
|
|
1158
|
-
"[\\s|\\(]+(" +
|
|
1159
|
-
CSS_UNIT +
|
|
1160
|
-
")[,|\\s]+(" +
|
|
1161
|
-
CSS_UNIT +
|
|
1162
|
-
")[,|\\s]+(" +
|
|
1163
|
-
CSS_UNIT +
|
|
1164
|
-
")[,|\\s]+(" +
|
|
1165
|
-
CSS_UNIT +
|
|
1166
|
-
")\\s*\\)?";
|
|
1167
|
-
|
|
1031
|
+
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
1032
|
+
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
1168
1033
|
return {
|
|
1169
1034
|
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
1170
1035
|
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
@@ -1176,9 +1041,9 @@ var matchers = (function () {
|
|
|
1176
1041
|
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1177
1042
|
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
1178
1043
|
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1179
|
-
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})
|
|
1044
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
1180
1045
|
};
|
|
1181
|
-
}
|
|
1046
|
+
}();
|
|
1182
1047
|
|
|
1183
1048
|
// `isValidCSSUnit`
|
|
1184
1049
|
// Take in a single string / number and check to see if it looks like a CSS unit
|
|
@@ -1197,7 +1062,13 @@ function stringInputToObject(color) {
|
|
|
1197
1062
|
color = names[color];
|
|
1198
1063
|
named = true;
|
|
1199
1064
|
} else if (color == "transparent") {
|
|
1200
|
-
return {
|
|
1065
|
+
return {
|
|
1066
|
+
r: 0,
|
|
1067
|
+
g: 0,
|
|
1068
|
+
b: 0,
|
|
1069
|
+
a: 0,
|
|
1070
|
+
format: "name"
|
|
1071
|
+
};
|
|
1201
1072
|
}
|
|
1202
1073
|
|
|
1203
1074
|
// Try to match string input using regular expressions.
|
|
@@ -1205,67 +1076,95 @@ function stringInputToObject(color) {
|
|
|
1205
1076
|
// Just return an object and let the conversion functions handle that.
|
|
1206
1077
|
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
1207
1078
|
var match;
|
|
1208
|
-
if (
|
|
1209
|
-
return {
|
|
1079
|
+
if (match = matchers.rgb.exec(color)) {
|
|
1080
|
+
return {
|
|
1081
|
+
r: match[1],
|
|
1082
|
+
g: match[2],
|
|
1083
|
+
b: match[3]
|
|
1084
|
+
};
|
|
1210
1085
|
}
|
|
1211
|
-
if (
|
|
1212
|
-
return {
|
|
1086
|
+
if (match = matchers.rgba.exec(color)) {
|
|
1087
|
+
return {
|
|
1088
|
+
r: match[1],
|
|
1089
|
+
g: match[2],
|
|
1090
|
+
b: match[3],
|
|
1091
|
+
a: match[4]
|
|
1092
|
+
};
|
|
1213
1093
|
}
|
|
1214
|
-
if (
|
|
1215
|
-
return {
|
|
1094
|
+
if (match = matchers.hsl.exec(color)) {
|
|
1095
|
+
return {
|
|
1096
|
+
h: match[1],
|
|
1097
|
+
s: match[2],
|
|
1098
|
+
l: match[3]
|
|
1099
|
+
};
|
|
1216
1100
|
}
|
|
1217
|
-
if (
|
|
1218
|
-
return {
|
|
1101
|
+
if (match = matchers.hsla.exec(color)) {
|
|
1102
|
+
return {
|
|
1103
|
+
h: match[1],
|
|
1104
|
+
s: match[2],
|
|
1105
|
+
l: match[3],
|
|
1106
|
+
a: match[4]
|
|
1107
|
+
};
|
|
1219
1108
|
}
|
|
1220
|
-
if (
|
|
1221
|
-
return {
|
|
1109
|
+
if (match = matchers.hsv.exec(color)) {
|
|
1110
|
+
return {
|
|
1111
|
+
h: match[1],
|
|
1112
|
+
s: match[2],
|
|
1113
|
+
v: match[3]
|
|
1114
|
+
};
|
|
1222
1115
|
}
|
|
1223
|
-
if (
|
|
1224
|
-
return {
|
|
1116
|
+
if (match = matchers.hsva.exec(color)) {
|
|
1117
|
+
return {
|
|
1118
|
+
h: match[1],
|
|
1119
|
+
s: match[2],
|
|
1120
|
+
v: match[3],
|
|
1121
|
+
a: match[4]
|
|
1122
|
+
};
|
|
1225
1123
|
}
|
|
1226
|
-
if (
|
|
1124
|
+
if (match = matchers.hex8.exec(color)) {
|
|
1227
1125
|
return {
|
|
1228
1126
|
r: parseIntFromHex(match[1]),
|
|
1229
1127
|
g: parseIntFromHex(match[2]),
|
|
1230
1128
|
b: parseIntFromHex(match[3]),
|
|
1231
1129
|
a: convertHexToDecimal(match[4]),
|
|
1232
|
-
format: named ? "name" : "hex8"
|
|
1130
|
+
format: named ? "name" : "hex8"
|
|
1233
1131
|
};
|
|
1234
1132
|
}
|
|
1235
|
-
if (
|
|
1133
|
+
if (match = matchers.hex6.exec(color)) {
|
|
1236
1134
|
return {
|
|
1237
1135
|
r: parseIntFromHex(match[1]),
|
|
1238
1136
|
g: parseIntFromHex(match[2]),
|
|
1239
1137
|
b: parseIntFromHex(match[3]),
|
|
1240
|
-
format: named ? "name" : "hex"
|
|
1138
|
+
format: named ? "name" : "hex"
|
|
1241
1139
|
};
|
|
1242
1140
|
}
|
|
1243
|
-
if (
|
|
1141
|
+
if (match = matchers.hex4.exec(color)) {
|
|
1244
1142
|
return {
|
|
1245
1143
|
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
1246
1144
|
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
1247
1145
|
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
1248
1146
|
a: convertHexToDecimal(match[4] + "" + match[4]),
|
|
1249
|
-
format: named ? "name" : "hex8"
|
|
1147
|
+
format: named ? "name" : "hex8"
|
|
1250
1148
|
};
|
|
1251
1149
|
}
|
|
1252
|
-
if (
|
|
1150
|
+
if (match = matchers.hex3.exec(color)) {
|
|
1253
1151
|
return {
|
|
1254
1152
|
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
1255
1153
|
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
1256
1154
|
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
1257
|
-
format: named ? "name" : "hex"
|
|
1155
|
+
format: named ? "name" : "hex"
|
|
1258
1156
|
};
|
|
1259
1157
|
}
|
|
1260
|
-
|
|
1261
1158
|
return false;
|
|
1262
1159
|
}
|
|
1263
|
-
|
|
1264
1160
|
function validateWCAG2Parms(parms) {
|
|
1265
1161
|
// return valid WCAG2 parms for isReadable.
|
|
1266
1162
|
// If input parms are invalid, return {"level":"AA", "size":"small"}
|
|
1267
1163
|
var level, size;
|
|
1268
|
-
parms = parms || {
|
|
1164
|
+
parms = parms || {
|
|
1165
|
+
level: "AA",
|
|
1166
|
+
size: "small"
|
|
1167
|
+
};
|
|
1269
1168
|
level = (parms.level || "AA").toUpperCase();
|
|
1270
1169
|
size = (parms.size || "small").toLowerCase();
|
|
1271
1170
|
if (level !== "AA" && level !== "AAA") {
|
|
@@ -1274,7 +1173,10 @@ function validateWCAG2Parms(parms) {
|
|
|
1274
1173
|
if (size !== "small" && size !== "large") {
|
|
1275
1174
|
size = "small";
|
|
1276
1175
|
}
|
|
1277
|
-
return {
|
|
1176
|
+
return {
|
|
1177
|
+
level: level,
|
|
1178
|
+
size: size
|
|
1179
|
+
};
|
|
1278
1180
|
}
|
|
1279
1181
|
|
|
1280
1182
|
const hslColorMap = (h, s, l) => {
|