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