@seeqdev/qomponents 0.0.179 → 0.0.181
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/Accordion/Accordion.d.ts +4 -0
- package/dist/Accordion/Accordion.js +7 -0
- package/dist/Accordion/Accordion.js.map +1 -0
- package/dist/Accordion/Accordion.stories.d.ts +5 -0
- package/dist/Accordion/Accordion.stories.js +75 -0
- package/dist/Accordion/Accordion.stories.js.map +1 -0
- package/dist/Accordion/Accordion.test.d.ts +1 -0
- package/dist/Accordion/Accordion.test.js +55 -0
- package/dist/Accordion/Accordion.test.js.map +1 -0
- package/dist/Accordion/Accordion.types.d.ts +86 -0
- package/dist/Accordion/Accordion.types.js +2 -0
- package/dist/Accordion/Accordion.types.js.map +1 -0
- package/dist/Accordion/index.d.ts +1 -0
- package/dist/Accordion/index.js +2 -0
- package/dist/Accordion/index.js.map +1 -0
- package/dist/Alert/Alert.d.ts +7 -0
- package/dist/Alert/Alert.js +34 -0
- package/dist/Alert/Alert.js.map +1 -0
- package/dist/Alert/Alert.stories.d.ts +6 -0
- package/dist/Alert/Alert.stories.js +65 -0
- package/dist/Alert/Alert.stories.js.map +1 -0
- package/dist/Alert/Alert.test.d.ts +1 -0
- package/dist/Alert/Alert.test.js +50 -0
- package/dist/Alert/Alert.test.js.map +1 -0
- package/dist/Alert/Alert.types.d.ts +62 -0
- package/dist/Alert/Alert.types.js +2 -0
- package/dist/Alert/Alert.types.js.map +1 -0
- package/dist/Alert/index.d.ts +1 -0
- package/dist/Alert/index.js +2 -0
- package/dist/Alert/index.js.map +1 -0
- package/dist/Button/Button.d.ts +10 -0
- package/dist/Button/Button.js +108 -0
- package/dist/Button/Button.js.map +1 -0
- package/dist/Button/Button.stories.d.ts +9 -0
- package/dist/Button/Button.stories.js +29 -0
- package/dist/Button/Button.stories.js.map +1 -0
- package/dist/Button/Button.test.d.ts +1 -0
- package/dist/Button/Button.test.js +65 -0
- package/dist/Button/Button.test.js.map +1 -0
- package/dist/Button/Button.types.d.ts +148 -0
- package/dist/Button/Button.types.js +5 -0
- package/dist/Button/Button.types.js.map +1 -0
- package/dist/Button/index.d.ts +1 -0
- package/dist/Button/index.js +2 -0
- package/dist/Button/index.js.map +1 -0
- package/dist/ButtonGroup/ButtonGroup.d.ts +7 -0
- package/dist/ButtonGroup/ButtonGroup.js +35 -0
- package/dist/ButtonGroup/ButtonGroup.js.map +1 -0
- package/dist/ButtonGroup/ButtonGroup.stories.d.ts +5 -0
- package/dist/ButtonGroup/ButtonGroup.stories.js +317 -0
- package/dist/ButtonGroup/ButtonGroup.stories.js.map +1 -0
- package/dist/ButtonGroup/ButtonGroup.test.d.ts +1 -0
- package/dist/ButtonGroup/ButtonGroup.test.js +66 -0
- package/dist/ButtonGroup/ButtonGroup.test.js.map +1 -0
- package/dist/ButtonGroup/ButtonGroup.types.d.ts +80 -0
- package/dist/ButtonGroup/ButtonGroup.types.js +2 -0
- package/dist/ButtonGroup/ButtonGroup.types.js.map +1 -0
- package/dist/ButtonGroup/index.d.ts +1 -0
- package/dist/ButtonGroup/index.js +2 -0
- package/dist/ButtonGroup/index.js.map +1 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.d.ts +4 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.js +36 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.js.map +1 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.d.ts +5 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js +104 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js.map +1 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.d.ts +1 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js +93 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js.map +1 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.d.ts +232 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js +2 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js.map +1 -0
- package/dist/ButtonWithDropdown/index.d.ts +1 -0
- package/dist/ButtonWithDropdown/index.js +2 -0
- package/dist/ButtonWithDropdown/index.js.map +1 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.d.ts +4 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.js +55 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.js.map +1 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.d.ts +5 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.js +25 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.js.map +1 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.test.d.ts +1 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.test.js +81 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.test.js.map +1 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.types.d.ts +134 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.types.js +2 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.types.js.map +1 -0
- package/dist/ButtonWithPopover/index.d.ts +1 -0
- package/dist/ButtonWithPopover/index.js +2 -0
- package/dist/ButtonWithPopover/index.js.map +1 -0
- package/dist/Carousel/Carousel.d.ts +9 -0
- package/dist/Carousel/Carousel.js +80 -0
- package/dist/Carousel/Carousel.js.map +1 -0
- package/dist/Carousel/Carousel.stories.d.ts +5 -0
- package/dist/Carousel/Carousel.stories.js +63 -0
- package/dist/Carousel/Carousel.stories.js.map +1 -0
- package/dist/Carousel/Carousel.test.d.ts +1 -0
- package/dist/Carousel/Carousel.test.js +48 -0
- package/dist/Carousel/Carousel.test.js.map +1 -0
- package/dist/Carousel/Carousel.types.d.ts +85 -0
- package/dist/Carousel/Carousel.types.js +2 -0
- package/dist/Carousel/Carousel.types.js.map +1 -0
- package/dist/Carousel/index.d.ts +1 -0
- package/dist/Carousel/index.js +2 -0
- package/dist/Carousel/index.js.map +1 -0
- package/dist/Checkbox/Checkbox.d.ts +7 -0
- package/dist/Checkbox/Checkbox.js +24 -0
- package/dist/Checkbox/Checkbox.js.map +1 -0
- package/dist/Checkbox/Checkbox.stories.d.ts +5 -0
- package/dist/Checkbox/Checkbox.stories.js +12 -0
- package/dist/Checkbox/Checkbox.stories.js.map +1 -0
- package/dist/Checkbox/Checkbox.test.d.ts +1 -0
- package/dist/Checkbox/Checkbox.test.js +94 -0
- package/dist/Checkbox/Checkbox.test.js.map +1 -0
- package/dist/Checkbox/Checkbox.types.d.ts +91 -0
- package/dist/Checkbox/Checkbox.types.js +2 -0
- package/dist/Checkbox/Checkbox.types.js.map +1 -0
- package/dist/Checkbox/index.d.ts +1 -0
- package/dist/Checkbox/index.js +2 -0
- package/dist/Checkbox/index.js.map +1 -0
- package/dist/Collapse/Collapse.d.ts +4 -0
- package/dist/Collapse/Collapse.js +17 -0
- package/dist/Collapse/Collapse.js.map +1 -0
- package/dist/Collapse/Collapse.stories.d.ts +5 -0
- package/dist/Collapse/Collapse.stories.js +15 -0
- package/dist/Collapse/Collapse.stories.js.map +1 -0
- package/dist/Collapse/Collapse.test.d.ts +1 -0
- package/dist/Collapse/Collapse.test.js +17 -0
- package/dist/Collapse/Collapse.test.js.map +1 -0
- package/dist/Collapse/Collapse.types.d.ts +18 -0
- package/dist/Collapse/Collapse.types.js +2 -0
- package/dist/Collapse/Collapse.types.js.map +1 -0
- package/dist/Collapse/index.d.ts +1 -0
- package/dist/Collapse/index.js +2 -0
- package/dist/Collapse/index.js.map +1 -0
- package/dist/FontCustom.woff +0 -0
- package/dist/FontCustom.woff2 +0 -0
- package/dist/Icon/Icon.d.ts +10 -0
- package/dist/Icon/Icon.js +56 -0
- package/dist/Icon/Icon.js.map +1 -0
- package/dist/Icon/Icon.stories.d.ts +5 -0
- package/dist/Icon/Icon.stories.js +15 -0
- package/dist/Icon/Icon.stories.js.map +1 -0
- package/dist/Icon/Icon.test.d.ts +1 -0
- package/dist/Icon/Icon.test.js +55 -0
- package/dist/Icon/Icon.test.js.map +1 -0
- package/dist/Icon/Icon.types.d.ts +90 -0
- package/dist/Icon/Icon.types.js +16 -0
- package/dist/Icon/Icon.types.js.map +1 -0
- package/dist/Icon/index.d.ts +1 -0
- package/dist/Icon/index.js +2 -0
- package/dist/Icon/index.js.map +1 -0
- package/dist/InputGroup/InputGroup.d.ts +7 -0
- package/dist/InputGroup/InputGroup.js +36 -0
- package/dist/InputGroup/InputGroup.js.map +1 -0
- package/dist/InputGroup/InputGroup.stories.d.ts +5 -0
- package/dist/InputGroup/InputGroup.stories.js +129 -0
- package/dist/InputGroup/InputGroup.stories.js.map +1 -0
- package/dist/InputGroup/InputGroup.test.d.ts +1 -0
- package/dist/InputGroup/InputGroup.test.js +42 -0
- package/dist/InputGroup/InputGroup.test.js.map +1 -0
- package/dist/InputGroup/InputGroup.types.d.ts +61 -0
- package/dist/InputGroup/InputGroup.types.js +2 -0
- package/dist/InputGroup/InputGroup.types.js.map +1 -0
- package/dist/InputGroup/index.d.ts +2 -0
- package/dist/InputGroup/index.js +2 -0
- package/dist/InputGroup/index.js.map +1 -0
- package/dist/Modal/Modal.d.ts +5 -0
- package/dist/Modal/Modal.js +76 -0
- package/dist/Modal/Modal.js.map +1 -0
- package/dist/Modal/Modal.stories.d.ts +10 -0
- package/dist/Modal/Modal.stories.js +44 -0
- package/dist/Modal/Modal.stories.js.map +1 -0
- package/dist/Modal/Modal.test.d.ts +1 -0
- package/dist/Modal/Modal.test.js +108 -0
- package/dist/Modal/Modal.test.js.map +1 -0
- package/dist/Modal/Modal.types.d.ts +244 -0
- package/dist/Modal/Modal.types.js +2 -0
- package/dist/Modal/Modal.types.js.map +1 -0
- package/dist/Modal/index.d.ts +1 -0
- package/dist/Modal/index.js +2 -0
- package/dist/Modal/index.js.map +1 -0
- package/dist/ProgressBar/ProgressBar.d.ts +4 -0
- package/dist/ProgressBar/ProgressBar.js +72 -0
- package/dist/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/ProgressBar/ProgressBar.stories.d.ts +5 -0
- package/dist/ProgressBar/ProgressBar.stories.js +35 -0
- package/dist/ProgressBar/ProgressBar.stories.js.map +1 -0
- package/dist/ProgressBar/ProgressBar.test.d.ts +1 -0
- package/dist/ProgressBar/ProgressBar.test.js +43 -0
- package/dist/ProgressBar/ProgressBar.test.js.map +1 -0
- package/dist/ProgressBar/ProgressBar.types.d.ts +77 -0
- package/dist/ProgressBar/ProgressBar.types.js +2 -0
- package/dist/ProgressBar/ProgressBar.types.js.map +1 -0
- package/dist/ProgressBar/index.d.ts +1 -0
- package/dist/ProgressBar/index.js +2 -0
- package/dist/ProgressBar/index.js.map +1 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.d.ts +4 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.js +39 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.js.map +1 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.d.ts +5 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js +58 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js.map +1 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.test.d.ts +1 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js +73 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js.map +1 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.types.d.ts +164 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js +2 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js.map +1 -0
- package/dist/SeeqActionDropdown/index.d.ts +1 -0
- package/dist/SeeqActionDropdown/index.js +2 -0
- package/dist/SeeqActionDropdown/index.js.map +1 -0
- package/dist/SeeqActionDropdown/variants.d.ts +5 -0
- package/dist/SeeqActionDropdown/variants.js +23 -0
- package/dist/SeeqActionDropdown/variants.js.map +1 -0
- package/dist/Select/Select.d.ts +15 -0
- package/dist/Select/Select.js +179 -0
- package/dist/Select/Select.js.map +1 -0
- package/dist/Select/Select.stories.d.ts +5 -0
- package/dist/Select/Select.stories.js +40 -0
- package/dist/Select/Select.stories.js.map +1 -0
- package/dist/Select/Select.test.d.ts +1 -0
- package/dist/Select/Select.test.js +175 -0
- package/dist/Select/Select.test.js.map +1 -0
- package/dist/Select/Select.types.d.ts +220 -0
- package/dist/Select/Select.types.js +2 -0
- package/dist/Select/Select.types.js.map +1 -0
- package/dist/Select/index.d.ts +2 -0
- package/dist/Select/index.js +3 -0
- package/dist/Select/index.js.map +1 -0
- package/dist/Slider/Slider.d.ts +6 -0
- package/dist/Slider/Slider.js +10 -0
- package/dist/Slider/Slider.js.map +1 -0
- package/dist/Slider/Slider.stories.d.ts +5 -0
- package/dist/Slider/Slider.stories.js +14 -0
- package/dist/Slider/Slider.stories.js.map +1 -0
- package/dist/Slider/Slider.test.d.ts +1 -0
- package/dist/Slider/Slider.test.js +32 -0
- package/dist/Slider/Slider.test.js.map +1 -0
- package/dist/Slider/Slider.types.d.ts +84 -0
- package/dist/Slider/Slider.types.js +2 -0
- package/dist/Slider/Slider.types.js.map +1 -0
- package/dist/Slider/index.d.ts +1 -0
- package/dist/Slider/index.js +2 -0
- package/dist/Slider/index.js.map +1 -0
- package/dist/SvgIcon/SvgIcon.d.ts +20 -0
- package/dist/SvgIcon/SvgIcon.js +28 -0
- package/dist/SvgIcon/SvgIcon.js.map +1 -0
- package/dist/SvgIcon/SvgIcon.stories.d.ts +5 -0
- package/dist/SvgIcon/SvgIcon.stories.js +18 -0
- package/dist/SvgIcon/SvgIcon.stories.js.map +1 -0
- package/dist/SvgIcon/SvgIcon.test.d.ts +1 -0
- package/dist/SvgIcon/SvgIcon.test.js +41 -0
- package/dist/SvgIcon/SvgIcon.test.js.map +1 -0
- package/dist/SvgIcon/SvgIcon.types.d.ts +75 -0
- package/dist/SvgIcon/SvgIcon.types.js +3 -0
- package/dist/SvgIcon/SvgIcon.types.js.map +1 -0
- package/dist/SvgIcon/index.d.ts +1 -0
- package/dist/SvgIcon/index.js +2 -0
- package/dist/SvgIcon/index.js.map +1 -0
- package/dist/Tabs/Tabs.d.ts +4 -0
- package/dist/Tabs/Tabs.js +17 -0
- package/dist/Tabs/Tabs.js.map +1 -0
- package/dist/Tabs/Tabs.stories.d.ts +5 -0
- package/dist/Tabs/Tabs.stories.js +73 -0
- package/dist/Tabs/Tabs.stories.js.map +1 -0
- package/dist/Tabs/Tabs.test.d.ts +1 -0
- package/dist/Tabs/Tabs.test.js +86 -0
- package/dist/Tabs/Tabs.test.js.map +1 -0
- package/dist/Tabs/Tabs.types.d.ts +100 -0
- package/dist/Tabs/Tabs.types.js +2 -0
- package/dist/Tabs/Tabs.types.js.map +1 -0
- package/dist/Tabs/index.d.ts +1 -0
- package/dist/Tabs/index.js +2 -0
- package/dist/Tabs/index.js.map +1 -0
- package/dist/TextArea/TextArea.d.ts +7 -0
- package/dist/TextArea/TextArea.js +55 -0
- package/dist/TextArea/TextArea.js.map +1 -0
- package/dist/TextArea/TextArea.stories.d.ts +5 -0
- package/dist/TextArea/TextArea.stories.js +10 -0
- package/dist/TextArea/TextArea.stories.js.map +1 -0
- package/dist/TextArea/TextArea.test.d.ts +1 -0
- package/dist/TextArea/TextArea.test.js +130 -0
- package/dist/TextArea/TextArea.test.js.map +1 -0
- package/dist/TextArea/TextArea.types.d.ts +115 -0
- package/dist/TextArea/TextArea.types.js +2 -0
- package/dist/TextArea/TextArea.types.js.map +1 -0
- package/dist/TextArea/index.d.ts +1 -0
- package/dist/TextArea/index.js +2 -0
- package/dist/TextArea/index.js.map +1 -0
- package/dist/TextField/TextField.d.ts +7 -0
- package/dist/TextField/TextField.js +85 -0
- package/dist/TextField/TextField.js.map +1 -0
- package/dist/TextField/TextField.stories.d.ts +5 -0
- package/dist/TextField/TextField.stories.js +11 -0
- package/dist/TextField/TextField.stories.js.map +1 -0
- package/dist/TextField/TextField.test.d.ts +1 -0
- package/dist/TextField/TextField.test.js +41 -0
- package/dist/TextField/TextField.test.js.map +1 -0
- package/dist/TextField/TextField.types.d.ts +198 -0
- package/dist/TextField/TextField.types.js +2 -0
- package/dist/TextField/TextField.types.js.map +1 -0
- package/dist/TextField/index.d.ts +1 -0
- package/dist/TextField/index.js +2 -0
- package/dist/TextField/index.js.map +1 -0
- package/dist/ToolbarButton/ToolbarButton.d.ts +3 -0
- package/dist/ToolbarButton/ToolbarButton.js +56 -0
- package/dist/ToolbarButton/ToolbarButton.js.map +1 -0
- package/dist/ToolbarButton/ToolbarButton.stories.d.ts +5 -0
- package/dist/ToolbarButton/ToolbarButton.stories.js +28 -0
- package/dist/ToolbarButton/ToolbarButton.stories.js.map +1 -0
- package/dist/ToolbarButton/ToolbarButton.test.d.ts +1 -0
- package/dist/ToolbarButton/ToolbarButton.test.js +85 -0
- package/dist/ToolbarButton/ToolbarButton.test.js.map +1 -0
- package/dist/ToolbarButton/ToolbarButton.types.d.ts +122 -0
- package/dist/ToolbarButton/ToolbarButton.types.js +2 -0
- package/dist/ToolbarButton/ToolbarButton.types.js.map +1 -0
- package/dist/ToolbarButton/index.d.ts +1 -0
- package/dist/ToolbarButton/index.js +2 -0
- package/dist/ToolbarButton/index.js.map +1 -0
- package/dist/Tooltip/QTip.stories.d.ts +5 -0
- package/dist/Tooltip/QTip.stories.js +19 -0
- package/dist/Tooltip/QTip.stories.js.map +1 -0
- package/dist/Tooltip/QTip.types.d.ts +13 -0
- package/dist/Tooltip/QTip.types.js +2 -0
- package/dist/Tooltip/QTip.types.js.map +1 -0
- package/dist/Tooltip/QTipPerformance.stories.d.ts +5 -0
- package/dist/Tooltip/QTipPerformance.stories.js +26 -0
- package/dist/Tooltip/QTipPerformance.stories.js.map +1 -0
- package/dist/Tooltip/Qtip.d.ts +26 -0
- package/dist/Tooltip/Qtip.js +168 -0
- package/dist/Tooltip/Qtip.js.map +1 -0
- package/dist/Tooltip/Tooltip.d.ts +13 -0
- package/dist/Tooltip/Tooltip.js +34 -0
- package/dist/Tooltip/Tooltip.js.map +1 -0
- package/dist/Tooltip/Tooltip.stories.d.ts +5 -0
- package/dist/Tooltip/Tooltip.stories.js +15 -0
- package/dist/Tooltip/Tooltip.stories.js.map +1 -0
- package/dist/Tooltip/Tooltip.types.d.ts +22 -0
- package/dist/Tooltip/Tooltip.types.js +3 -0
- package/dist/Tooltip/Tooltip.types.js.map +1 -0
- package/dist/Tooltip/TooltipPerformance.stories.d.ts +5 -0
- package/dist/Tooltip/TooltipPerformance.stories.js +26 -0
- package/dist/Tooltip/TooltipPerformance.stories.js.map +1 -0
- package/dist/Tooltip/index.d.ts +2 -0
- package/dist/Tooltip/index.js +3 -0
- package/dist/Tooltip/index.js.map +1 -0
- package/dist/Tooltip/qTip.utilities.d.ts +3 -0
- package/dist/Tooltip/qTip.utilities.js +11 -0
- package/dist/Tooltip/qTip.utilities.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.esm.js +1220 -1186
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1220 -1186
- package/dist/index.js.map +1 -1
- package/dist/setupTests.d.ts +1 -0
- package/dist/setupTests.js +6 -0
- package/dist/setupTests.js.map +1 -0
- package/dist/styles.css +6 -0
- package/dist/types.d.ts +27 -0
- package/dist/types.js +26 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/browserId.d.ts +9 -0
- package/dist/utils/browserId.js +29 -0
- package/dist/utils/browserId.js.map +1 -0
- package/dist/utils/svg.d.ts +15 -0
- package/dist/utils/svg.js +20 -0
- package/dist/utils/svg.js.map +1 -0
- package/dist/utils/validateStyleDimension.d.ts +2 -0
- package/dist/utils/validateStyleDimension.js +14 -0
- package/dist/utils/validateStyleDimension.js.map +1 -0
- package/dist/utils/validateStyleDimension.test.d.ts +1 -0
- package/dist/utils/validateStyleDimension.test.js +20 -0
- package/dist/utils/validateStyleDimension.test.js.map +1 -0
- package/package.json +10 -10
- package/dist/iconFont/FontCustom.woff +0 -0
- package/dist/iconFont/FontCustom.woff2 +0 -0
package/dist/index.esm.js
CHANGED
|
@@ -1333,7 +1333,7 @@ const arrow$4 = options => ({
|
|
|
1333
1333
|
* clipping boundary. Alternative to `autoPlacement`.
|
|
1334
1334
|
* @see https://floating-ui.com/docs/flip
|
|
1335
1335
|
*/
|
|
1336
|
-
const flip$
|
|
1336
|
+
const flip$3 = function (options) {
|
|
1337
1337
|
if (options === void 0) {
|
|
1338
1338
|
options = {};
|
|
1339
1339
|
}
|
|
@@ -2698,7 +2698,7 @@ const shift$2 = shift$3;
|
|
|
2698
2698
|
* clipping boundary. Alternative to `autoPlacement`.
|
|
2699
2699
|
* @see https://floating-ui.com/docs/flip
|
|
2700
2700
|
*/
|
|
2701
|
-
const flip$
|
|
2701
|
+
const flip$2 = flip$3;
|
|
2702
2702
|
|
|
2703
2703
|
/**
|
|
2704
2704
|
* Provides data that allows you to change the size of the floating element —
|
|
@@ -3056,8 +3056,8 @@ const limitShift = (options, deps) => ({
|
|
|
3056
3056
|
* clipping boundary. Alternative to `autoPlacement`.
|
|
3057
3057
|
* @see https://floating-ui.com/docs/flip
|
|
3058
3058
|
*/
|
|
3059
|
-
const flip$
|
|
3060
|
-
...flip$
|
|
3059
|
+
const flip$1 = (options, deps) => ({
|
|
3060
|
+
...flip$2(options),
|
|
3061
3061
|
options: [options, deps]
|
|
3062
3062
|
});
|
|
3063
3063
|
|
|
@@ -3230,7 +3230,7 @@ var PopperContent = React.forwardRef(
|
|
|
3230
3230
|
limiter: sticky === "partial" ? limitShift() : void 0,
|
|
3231
3231
|
...detectOverflowOptions
|
|
3232
3232
|
}),
|
|
3233
|
-
avoidCollisions && flip$
|
|
3233
|
+
avoidCollisions && flip$1({ ...detectOverflowOptions }),
|
|
3234
3234
|
size({
|
|
3235
3235
|
...detectOverflowOptions,
|
|
3236
3236
|
apply: ({ elements, rects, availableWidth, availableHeight }) => {
|
|
@@ -5024,7 +5024,7 @@ const Tooltip = ({ position = 'bottom', children, text, delay = DEFAULT_TOOL_TIP
|
|
|
5024
5024
|
tw:absolute tw:opacity-0 tw:group-hover:opacity-100 tw:rounded tw:bg-sq-black tw:p-2 tw:text-xs tw:text-sq-white ${placements[position]}`, children: text })] }));
|
|
5025
5025
|
};
|
|
5026
5026
|
|
|
5027
|
-
/*! @license DOMPurify 3.2.
|
|
5027
|
+
/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */
|
|
5028
5028
|
|
|
5029
5029
|
const {
|
|
5030
5030
|
entries,
|
|
@@ -5063,8 +5063,10 @@ if (!construct) {
|
|
|
5063
5063
|
};
|
|
5064
5064
|
}
|
|
5065
5065
|
const arrayForEach = unapply(Array.prototype.forEach);
|
|
5066
|
+
const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
5066
5067
|
const arrayPop = unapply(Array.prototype.pop);
|
|
5067
5068
|
const arrayPush = unapply(Array.prototype.push);
|
|
5069
|
+
const arraySplice = unapply(Array.prototype.splice);
|
|
5068
5070
|
const stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
5069
5071
|
const stringToString = unapply(String.prototype.toString);
|
|
5070
5072
|
const stringMatch = unapply(String.prototype.match);
|
|
@@ -5082,6 +5084,9 @@ const typeErrorCreate = unconstruct(TypeError);
|
|
|
5082
5084
|
*/
|
|
5083
5085
|
function unapply(func) {
|
|
5084
5086
|
return function (thisArg) {
|
|
5087
|
+
if (thisArg instanceof RegExp) {
|
|
5088
|
+
thisArg.lastIndex = 0;
|
|
5089
|
+
}
|
|
5085
5090
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
5086
5091
|
args[_key - 1] = arguments[_key];
|
|
5087
5092
|
}
|
|
@@ -5220,10 +5225,10 @@ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:x
|
|
|
5220
5225
|
// eslint-disable-next-line unicorn/better-regex
|
|
5221
5226
|
const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
|
|
5222
5227
|
const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
|
|
5223
|
-
const TMPLIT_EXPR = seal(/\$\{[\w\W]
|
|
5228
|
+
const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
|
|
5224
5229
|
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
|
|
5225
5230
|
const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
|
|
5226
|
-
const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
5231
|
+
const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
5227
5232
|
);
|
|
5228
5233
|
const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
5229
5234
|
const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
|
|
@@ -5320,9 +5325,9 @@ const _createHooksMap = function _createHooksMap() {
|
|
|
5320
5325
|
function createDOMPurify() {
|
|
5321
5326
|
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
5322
5327
|
const DOMPurify = root => createDOMPurify(root);
|
|
5323
|
-
DOMPurify.version = '3.2.
|
|
5328
|
+
DOMPurify.version = '3.2.6';
|
|
5324
5329
|
DOMPurify.removed = [];
|
|
5325
|
-
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document) {
|
|
5330
|
+
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
5326
5331
|
// Not running in a browser, provide a factory function
|
|
5327
5332
|
// so that you can pass your own Window
|
|
5328
5333
|
DOMPurify.isSupported = false;
|
|
@@ -5559,8 +5564,8 @@ function createDOMPurify() {
|
|
|
5559
5564
|
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
5560
5565
|
DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
|
|
5561
5566
|
FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
5562
|
-
FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
|
|
5563
|
-
FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
|
|
5567
|
+
FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
|
|
5568
|
+
FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
|
|
5564
5569
|
USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
|
|
5565
5570
|
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
|
|
5566
5571
|
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
|
|
@@ -5925,7 +5930,7 @@ function createDOMPurify() {
|
|
|
5925
5930
|
allowedTags: ALLOWED_TAGS
|
|
5926
5931
|
});
|
|
5927
5932
|
/* Detect mXSS attempts abusing namespace confusion */
|
|
5928
|
-
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
|
|
5933
|
+
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
|
|
5929
5934
|
_forceRemove(currentNode);
|
|
5930
5935
|
return true;
|
|
5931
5936
|
}
|
|
@@ -6077,7 +6082,8 @@ function createDOMPurify() {
|
|
|
6077
6082
|
value: attrValue
|
|
6078
6083
|
} = attr;
|
|
6079
6084
|
const lcName = transformCaseFunc(name);
|
|
6080
|
-
|
|
6085
|
+
const initValue = attrValue;
|
|
6086
|
+
let value = name === 'value' ? initValue : stringTrim(initValue);
|
|
6081
6087
|
/* Execute a hook if present */
|
|
6082
6088
|
hookEvent.attrName = lcName;
|
|
6083
6089
|
hookEvent.attrValue = value;
|
|
@@ -6103,10 +6109,9 @@ function createDOMPurify() {
|
|
|
6103
6109
|
if (hookEvent.forceKeepAttr) {
|
|
6104
6110
|
continue;
|
|
6105
6111
|
}
|
|
6106
|
-
/* Remove attribute */
|
|
6107
|
-
_removeAttribute(name, currentNode);
|
|
6108
6112
|
/* Did the hooks approve of the attribute? */
|
|
6109
6113
|
if (!hookEvent.keepAttr) {
|
|
6114
|
+
_removeAttribute(name, currentNode);
|
|
6110
6115
|
continue;
|
|
6111
6116
|
}
|
|
6112
6117
|
/* Work around a security issue in jQuery 3.0 */
|
|
@@ -6123,6 +6128,7 @@ function createDOMPurify() {
|
|
|
6123
6128
|
/* Is `value` valid for this attribute? */
|
|
6124
6129
|
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
6125
6130
|
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
6131
|
+
_removeAttribute(name, currentNode);
|
|
6126
6132
|
continue;
|
|
6127
6133
|
}
|
|
6128
6134
|
/* Handle attributes that require Trusted Types */
|
|
@@ -6143,19 +6149,23 @@ function createDOMPurify() {
|
|
|
6143
6149
|
}
|
|
6144
6150
|
}
|
|
6145
6151
|
/* Handle invalid data-* attribute set by try-catching it */
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6152
|
+
if (value !== initValue) {
|
|
6153
|
+
try {
|
|
6154
|
+
if (namespaceURI) {
|
|
6155
|
+
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
6156
|
+
} else {
|
|
6157
|
+
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
|
6158
|
+
currentNode.setAttribute(name, value);
|
|
6159
|
+
}
|
|
6160
|
+
if (_isClobbered(currentNode)) {
|
|
6161
|
+
_forceRemove(currentNode);
|
|
6162
|
+
} else {
|
|
6163
|
+
arrayPop(DOMPurify.removed);
|
|
6164
|
+
}
|
|
6165
|
+
} catch (_) {
|
|
6166
|
+
_removeAttribute(name, currentNode);
|
|
6157
6167
|
}
|
|
6158
|
-
}
|
|
6168
|
+
}
|
|
6159
6169
|
}
|
|
6160
6170
|
/* Execute a hook if present */
|
|
6161
6171
|
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
@@ -6341,7 +6351,11 @@ function createDOMPurify() {
|
|
|
6341
6351
|
}
|
|
6342
6352
|
arrayPush(hooks[entryPoint], hookFunction);
|
|
6343
6353
|
};
|
|
6344
|
-
DOMPurify.removeHook = function (entryPoint) {
|
|
6354
|
+
DOMPurify.removeHook = function (entryPoint, hookFunction) {
|
|
6355
|
+
if (hookFunction !== undefined) {
|
|
6356
|
+
const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
|
|
6357
|
+
return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
|
|
6358
|
+
}
|
|
6345
6359
|
return arrayPop(hooks[entryPoint]);
|
|
6346
6360
|
};
|
|
6347
6361
|
DOMPurify.removeHooks = function (entryPoint) {
|
|
@@ -6959,7 +6973,7 @@ const shift = shift$3;
|
|
|
6959
6973
|
* clipping boundary. Alternative to `autoPlacement`.
|
|
6960
6974
|
* @see https://floating-ui.com/docs/flip
|
|
6961
6975
|
*/
|
|
6962
|
-
const flip
|
|
6976
|
+
const flip = flip$3;
|
|
6963
6977
|
|
|
6964
6978
|
/**
|
|
6965
6979
|
* Provides data to position an inner element of the floating element so that it
|
|
@@ -7482,7 +7496,7 @@ const QTip = () => {
|
|
|
7482
7496
|
if (tooltipRef.current && tooltipTarget.current) {
|
|
7483
7497
|
computePosition(tooltipTarget.current, tooltipRef.current, {
|
|
7484
7498
|
placement: position,
|
|
7485
|
-
middleware: [offset$2(10), flip
|
|
7499
|
+
middleware: [offset$2(10), flip(), shift({ padding: 8 }), arrow({ element: tooltipArrowRef.current })],
|
|
7486
7500
|
}).then(({ x, y, middlewareData, placement: finalPlacement }) => {
|
|
7487
7501
|
Object.assign(tooltipRef.current?.style, {
|
|
7488
7502
|
left: `${x}px`,
|
|
@@ -7511,22 +7525,22 @@ const QTip = () => {
|
|
|
7511
7525
|
(show ? 'tw:visible' : 'tw:invisible tw:pointer-events-none'), children: [html ? jsx$1(HTMLTip, { text: tooltipText }) : tooltipText, jsx$1("div", { className: "tw:absolute tw:w-2.5 tw:h-2.5 tw:rotate-45 tw:bg-sq-black", ref: tooltipArrowRef })] }) }));
|
|
7512
7526
|
};
|
|
7513
7527
|
|
|
7514
|
-
function _typeof
|
|
7528
|
+
function _typeof(o) {
|
|
7515
7529
|
"@babel/helpers - typeof";
|
|
7516
7530
|
|
|
7517
|
-
return _typeof
|
|
7531
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
7518
7532
|
return typeof o;
|
|
7519
7533
|
} : function (o) {
|
|
7520
7534
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
7521
|
-
}, _typeof
|
|
7535
|
+
}, _typeof(o);
|
|
7522
7536
|
}
|
|
7523
7537
|
|
|
7524
7538
|
function toPrimitive(t, r) {
|
|
7525
|
-
if ("object" != _typeof
|
|
7539
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
7526
7540
|
var e = t[Symbol.toPrimitive];
|
|
7527
7541
|
if (void 0 !== e) {
|
|
7528
7542
|
var i = e.call(t, r || "default");
|
|
7529
|
-
if ("object" != _typeof
|
|
7543
|
+
if ("object" != _typeof(i)) return i;
|
|
7530
7544
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7531
7545
|
}
|
|
7532
7546
|
return ("string" === r ? String : Number)(t);
|
|
@@ -7534,7 +7548,7 @@ function toPrimitive(t, r) {
|
|
|
7534
7548
|
|
|
7535
7549
|
function toPropertyKey(t) {
|
|
7536
7550
|
var i = toPrimitive(t, "string");
|
|
7537
|
-
return "symbol" == _typeof
|
|
7551
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
7538
7552
|
}
|
|
7539
7553
|
|
|
7540
7554
|
function _defineProperty(e, r, t) {
|
|
@@ -7777,7 +7791,7 @@ function _assertThisInitialized(e) {
|
|
|
7777
7791
|
}
|
|
7778
7792
|
|
|
7779
7793
|
function _possibleConstructorReturn(t, e) {
|
|
7780
|
-
if (e && ("object" == _typeof
|
|
7794
|
+
if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
|
|
7781
7795
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
7782
7796
|
return _assertThisInitialized(t);
|
|
7783
7797
|
}
|
|
@@ -9823,7 +9837,7 @@ function classNames$1(prefix, state) {
|
|
|
9823
9837
|
|
|
9824
9838
|
var cleanValue = function cleanValue(value) {
|
|
9825
9839
|
if (isArray(value)) return value.filter(Boolean);
|
|
9826
|
-
if (_typeof
|
|
9840
|
+
if (_typeof(value) === 'object' && value !== null) return [value];
|
|
9827
9841
|
return [];
|
|
9828
9842
|
};
|
|
9829
9843
|
|
|
@@ -27665,1184 +27679,1204 @@ Defaulting to \`null\`.`;
|
|
|
27665
27679
|
var Root = Progress;
|
|
27666
27680
|
var Indicator = ProgressIndicator$1;
|
|
27667
27681
|
|
|
27668
|
-
|
|
27669
|
-
function _typeof(obj) {
|
|
27670
|
-
"@babel/helpers - typeof";
|
|
27682
|
+
var tinycolor$1 = {exports: {}};
|
|
27671
27683
|
|
|
27672
|
-
|
|
27673
|
-
|
|
27674
|
-
|
|
27675
|
-
|
|
27676
|
-
}, _typeof(obj);
|
|
27677
|
-
}
|
|
27678
|
-
|
|
27679
|
-
// https://github.com/bgrins/TinyColor
|
|
27680
|
-
// Brian Grinstead, MIT License
|
|
27681
|
-
|
|
27682
|
-
var trimLeft = /^\s+/;
|
|
27683
|
-
var trimRight = /\s+$/;
|
|
27684
|
-
function tinycolor(color, opts) {
|
|
27685
|
-
color = color ? color : "";
|
|
27686
|
-
opts = opts || {};
|
|
27687
|
-
|
|
27688
|
-
// If input is already a tinycolor, return itself
|
|
27689
|
-
if (color instanceof tinycolor) {
|
|
27690
|
-
return color;
|
|
27691
|
-
}
|
|
27692
|
-
// If we are called as a function, call using new instead
|
|
27693
|
-
if (!(this instanceof tinycolor)) {
|
|
27694
|
-
return new tinycolor(color, opts);
|
|
27695
|
-
}
|
|
27696
|
-
var rgb = inputToRGB(color);
|
|
27697
|
-
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;
|
|
27698
|
-
this._gradientType = opts.gradientType;
|
|
27699
|
-
|
|
27700
|
-
// Don't let the range of [0,255] come back in [0,1].
|
|
27701
|
-
// Potentially lose a little bit of precision here, but will fix issues where
|
|
27702
|
-
// .5 gets interpreted as half of the total, instead of half of 1
|
|
27703
|
-
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
|
27704
|
-
if (this._r < 1) this._r = Math.round(this._r);
|
|
27705
|
-
if (this._g < 1) this._g = Math.round(this._g);
|
|
27706
|
-
if (this._b < 1) this._b = Math.round(this._b);
|
|
27707
|
-
this._ok = rgb.ok;
|
|
27708
|
-
}
|
|
27709
|
-
tinycolor.prototype = {
|
|
27710
|
-
isDark: function isDark() {
|
|
27711
|
-
return this.getBrightness() < 128;
|
|
27712
|
-
},
|
|
27713
|
-
isLight: function isLight() {
|
|
27714
|
-
return !this.isDark();
|
|
27715
|
-
},
|
|
27716
|
-
isValid: function isValid() {
|
|
27717
|
-
return this._ok;
|
|
27718
|
-
},
|
|
27719
|
-
getOriginalInput: function getOriginalInput() {
|
|
27720
|
-
return this._originalInput;
|
|
27721
|
-
},
|
|
27722
|
-
getFormat: function getFormat() {
|
|
27723
|
-
return this._format;
|
|
27724
|
-
},
|
|
27725
|
-
getAlpha: function getAlpha() {
|
|
27726
|
-
return this._a;
|
|
27727
|
-
},
|
|
27728
|
-
getBrightness: function getBrightness() {
|
|
27729
|
-
//http://www.w3.org/TR/AERT#color-contrast
|
|
27730
|
-
var rgb = this.toRgb();
|
|
27731
|
-
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
27732
|
-
},
|
|
27733
|
-
getLuminance: function getLuminance() {
|
|
27734
|
-
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
27735
|
-
var rgb = this.toRgb();
|
|
27736
|
-
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
27737
|
-
RsRGB = rgb.r / 255;
|
|
27738
|
-
GsRGB = rgb.g / 255;
|
|
27739
|
-
BsRGB = rgb.b / 255;
|
|
27740
|
-
if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
27741
|
-
if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
27742
|
-
if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
27743
|
-
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
27744
|
-
},
|
|
27745
|
-
setAlpha: function setAlpha(value) {
|
|
27746
|
-
this._a = boundAlpha(value);
|
|
27747
|
-
this._roundA = Math.round(100 * this._a) / 100;
|
|
27748
|
-
return this;
|
|
27749
|
-
},
|
|
27750
|
-
toHsv: function toHsv() {
|
|
27751
|
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
27752
|
-
return {
|
|
27753
|
-
h: hsv.h * 360,
|
|
27754
|
-
s: hsv.s,
|
|
27755
|
-
v: hsv.v,
|
|
27756
|
-
a: this._a
|
|
27757
|
-
};
|
|
27758
|
-
},
|
|
27759
|
-
toHsvString: function toHsvString() {
|
|
27760
|
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
27761
|
-
var h = Math.round(hsv.h * 360),
|
|
27762
|
-
s = Math.round(hsv.s * 100),
|
|
27763
|
-
v = Math.round(hsv.v * 100);
|
|
27764
|
-
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
27765
|
-
},
|
|
27766
|
-
toHsl: function toHsl() {
|
|
27767
|
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
27768
|
-
return {
|
|
27769
|
-
h: hsl.h * 360,
|
|
27770
|
-
s: hsl.s,
|
|
27771
|
-
l: hsl.l,
|
|
27772
|
-
a: this._a
|
|
27773
|
-
};
|
|
27774
|
-
},
|
|
27775
|
-
toHslString: function toHslString() {
|
|
27776
|
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
27777
|
-
var h = Math.round(hsl.h * 360),
|
|
27778
|
-
s = Math.round(hsl.s * 100),
|
|
27779
|
-
l = Math.round(hsl.l * 100);
|
|
27780
|
-
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
27781
|
-
},
|
|
27782
|
-
toHex: function toHex(allow3Char) {
|
|
27783
|
-
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
27784
|
-
},
|
|
27785
|
-
toHexString: function toHexString(allow3Char) {
|
|
27786
|
-
return "#" + this.toHex(allow3Char);
|
|
27787
|
-
},
|
|
27788
|
-
toHex8: function toHex8(allow4Char) {
|
|
27789
|
-
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
27790
|
-
},
|
|
27791
|
-
toHex8String: function toHex8String(allow4Char) {
|
|
27792
|
-
return "#" + this.toHex8(allow4Char);
|
|
27793
|
-
},
|
|
27794
|
-
toRgb: function toRgb() {
|
|
27795
|
-
return {
|
|
27796
|
-
r: Math.round(this._r),
|
|
27797
|
-
g: Math.round(this._g),
|
|
27798
|
-
b: Math.round(this._b),
|
|
27799
|
-
a: this._a
|
|
27800
|
-
};
|
|
27801
|
-
},
|
|
27802
|
-
toRgbString: function toRgbString() {
|
|
27803
|
-
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 + ")";
|
|
27804
|
-
},
|
|
27805
|
-
toPercentageRgb: function toPercentageRgb() {
|
|
27806
|
-
return {
|
|
27807
|
-
r: Math.round(bound01(this._r, 255) * 100) + "%",
|
|
27808
|
-
g: Math.round(bound01(this._g, 255) * 100) + "%",
|
|
27809
|
-
b: Math.round(bound01(this._b, 255) * 100) + "%",
|
|
27810
|
-
a: this._a
|
|
27811
|
-
};
|
|
27812
|
-
},
|
|
27813
|
-
toPercentageRgbString: function toPercentageRgbString() {
|
|
27814
|
-
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 + ")";
|
|
27815
|
-
},
|
|
27816
|
-
toName: function toName() {
|
|
27817
|
-
if (this._a === 0) {
|
|
27818
|
-
return "transparent";
|
|
27819
|
-
}
|
|
27820
|
-
if (this._a < 1) {
|
|
27821
|
-
return false;
|
|
27822
|
-
}
|
|
27823
|
-
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
27824
|
-
},
|
|
27825
|
-
toFilter: function toFilter(secondColor) {
|
|
27826
|
-
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
27827
|
-
var secondHex8String = hex8String;
|
|
27828
|
-
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
27829
|
-
if (secondColor) {
|
|
27830
|
-
var s = tinycolor(secondColor);
|
|
27831
|
-
secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
27832
|
-
}
|
|
27833
|
-
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
|
|
27834
|
-
},
|
|
27835
|
-
toString: function toString(format) {
|
|
27836
|
-
var formatSet = !!format;
|
|
27837
|
-
format = format || this._format;
|
|
27838
|
-
var formattedString = false;
|
|
27839
|
-
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
27840
|
-
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
27841
|
-
if (needsAlphaFormat) {
|
|
27842
|
-
// Special case for "transparent", all other non-alpha formats
|
|
27843
|
-
// will return rgba when there is transparency.
|
|
27844
|
-
if (format === "name" && this._a === 0) {
|
|
27845
|
-
return this.toName();
|
|
27846
|
-
}
|
|
27847
|
-
return this.toRgbString();
|
|
27848
|
-
}
|
|
27849
|
-
if (format === "rgb") {
|
|
27850
|
-
formattedString = this.toRgbString();
|
|
27851
|
-
}
|
|
27852
|
-
if (format === "prgb") {
|
|
27853
|
-
formattedString = this.toPercentageRgbString();
|
|
27854
|
-
}
|
|
27855
|
-
if (format === "hex" || format === "hex6") {
|
|
27856
|
-
formattedString = this.toHexString();
|
|
27857
|
-
}
|
|
27858
|
-
if (format === "hex3") {
|
|
27859
|
-
formattedString = this.toHexString(true);
|
|
27860
|
-
}
|
|
27861
|
-
if (format === "hex4") {
|
|
27862
|
-
formattedString = this.toHex8String(true);
|
|
27863
|
-
}
|
|
27864
|
-
if (format === "hex8") {
|
|
27865
|
-
formattedString = this.toHex8String();
|
|
27866
|
-
}
|
|
27867
|
-
if (format === "name") {
|
|
27868
|
-
formattedString = this.toName();
|
|
27869
|
-
}
|
|
27870
|
-
if (format === "hsl") {
|
|
27871
|
-
formattedString = this.toHslString();
|
|
27872
|
-
}
|
|
27873
|
-
if (format === "hsv") {
|
|
27874
|
-
formattedString = this.toHsvString();
|
|
27875
|
-
}
|
|
27876
|
-
return formattedString || this.toHexString();
|
|
27877
|
-
},
|
|
27878
|
-
clone: function clone() {
|
|
27879
|
-
return tinycolor(this.toString());
|
|
27880
|
-
},
|
|
27881
|
-
_applyModification: function _applyModification(fn, args) {
|
|
27882
|
-
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
27883
|
-
this._r = color._r;
|
|
27884
|
-
this._g = color._g;
|
|
27885
|
-
this._b = color._b;
|
|
27886
|
-
this.setAlpha(color._a);
|
|
27887
|
-
return this;
|
|
27888
|
-
},
|
|
27889
|
-
lighten: function lighten() {
|
|
27890
|
-
return this._applyModification(_lighten, arguments);
|
|
27891
|
-
},
|
|
27892
|
-
brighten: function brighten() {
|
|
27893
|
-
return this._applyModification(_brighten, arguments);
|
|
27894
|
-
},
|
|
27895
|
-
darken: function darken() {
|
|
27896
|
-
return this._applyModification(_darken, arguments);
|
|
27897
|
-
},
|
|
27898
|
-
desaturate: function desaturate() {
|
|
27899
|
-
return this._applyModification(_desaturate, arguments);
|
|
27900
|
-
},
|
|
27901
|
-
saturate: function saturate() {
|
|
27902
|
-
return this._applyModification(_saturate, arguments);
|
|
27903
|
-
},
|
|
27904
|
-
greyscale: function greyscale() {
|
|
27905
|
-
return this._applyModification(_greyscale, arguments);
|
|
27906
|
-
},
|
|
27907
|
-
spin: function spin() {
|
|
27908
|
-
return this._applyModification(_spin, arguments);
|
|
27909
|
-
},
|
|
27910
|
-
_applyCombination: function _applyCombination(fn, args) {
|
|
27911
|
-
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
27912
|
-
},
|
|
27913
|
-
analogous: function analogous() {
|
|
27914
|
-
return this._applyCombination(_analogous, arguments);
|
|
27915
|
-
},
|
|
27916
|
-
complement: function complement() {
|
|
27917
|
-
return this._applyCombination(_complement, arguments);
|
|
27918
|
-
},
|
|
27919
|
-
monochromatic: function monochromatic() {
|
|
27920
|
-
return this._applyCombination(_monochromatic, arguments);
|
|
27921
|
-
},
|
|
27922
|
-
splitcomplement: function splitcomplement() {
|
|
27923
|
-
return this._applyCombination(_splitcomplement, arguments);
|
|
27924
|
-
},
|
|
27925
|
-
// Disabled until https://github.com/bgrins/TinyColor/issues/254
|
|
27926
|
-
// polyad: function (number) {
|
|
27927
|
-
// return this._applyCombination(polyad, [number]);
|
|
27928
|
-
// },
|
|
27929
|
-
triad: function triad() {
|
|
27930
|
-
return this._applyCombination(polyad, [3]);
|
|
27931
|
-
},
|
|
27932
|
-
tetrad: function tetrad() {
|
|
27933
|
-
return this._applyCombination(polyad, [4]);
|
|
27934
|
-
}
|
|
27935
|
-
};
|
|
27684
|
+
(function (module) {
|
|
27685
|
+
// TinyColor v1.4.1
|
|
27686
|
+
// https://github.com/bgrins/TinyColor
|
|
27687
|
+
// Brian Grinstead, MIT License
|
|
27936
27688
|
|
|
27937
|
-
|
|
27938
|
-
// String input requires "1.0" as input, so 1 will be treated as 1
|
|
27939
|
-
tinycolor.fromRatio = function (color, opts) {
|
|
27940
|
-
if (_typeof(color) == "object") {
|
|
27941
|
-
var newColor = {};
|
|
27942
|
-
for (var i in color) {
|
|
27943
|
-
if (color.hasOwnProperty(i)) {
|
|
27944
|
-
if (i === "a") {
|
|
27945
|
-
newColor[i] = color[i];
|
|
27946
|
-
} else {
|
|
27947
|
-
newColor[i] = convertToPercentage(color[i]);
|
|
27948
|
-
}
|
|
27949
|
-
}
|
|
27950
|
-
}
|
|
27951
|
-
color = newColor;
|
|
27952
|
-
}
|
|
27953
|
-
return tinycolor(color, opts);
|
|
27954
|
-
};
|
|
27955
|
-
|
|
27956
|
-
// Given a string or object, convert that input to RGB
|
|
27957
|
-
// Possible string inputs:
|
|
27958
|
-
//
|
|
27959
|
-
// "red"
|
|
27960
|
-
// "#f00" or "f00"
|
|
27961
|
-
// "#ff0000" or "ff0000"
|
|
27962
|
-
// "#ff000000" or "ff000000"
|
|
27963
|
-
// "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
27964
|
-
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
27965
|
-
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
27966
|
-
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
27967
|
-
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
27968
|
-
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
27969
|
-
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
27970
|
-
//
|
|
27971
|
-
function inputToRGB(color) {
|
|
27972
|
-
var rgb = {
|
|
27973
|
-
r: 0,
|
|
27974
|
-
g: 0,
|
|
27975
|
-
b: 0
|
|
27976
|
-
};
|
|
27977
|
-
var a = 1;
|
|
27978
|
-
var s = null;
|
|
27979
|
-
var v = null;
|
|
27980
|
-
var l = null;
|
|
27981
|
-
var ok = false;
|
|
27982
|
-
var format = false;
|
|
27983
|
-
if (typeof color == "string") {
|
|
27984
|
-
color = stringInputToObject(color);
|
|
27985
|
-
}
|
|
27986
|
-
if (_typeof(color) == "object") {
|
|
27987
|
-
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
27988
|
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
27989
|
-
ok = true;
|
|
27990
|
-
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
27991
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
27992
|
-
s = convertToPercentage(color.s);
|
|
27993
|
-
v = convertToPercentage(color.v);
|
|
27994
|
-
rgb = hsvToRgb(color.h, s, v);
|
|
27995
|
-
ok = true;
|
|
27996
|
-
format = "hsv";
|
|
27997
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
27998
|
-
s = convertToPercentage(color.s);
|
|
27999
|
-
l = convertToPercentage(color.l);
|
|
28000
|
-
rgb = hslToRgb(color.h, s, l);
|
|
28001
|
-
ok = true;
|
|
28002
|
-
format = "hsl";
|
|
28003
|
-
}
|
|
28004
|
-
if (color.hasOwnProperty("a")) {
|
|
28005
|
-
a = color.a;
|
|
28006
|
-
}
|
|
28007
|
-
}
|
|
28008
|
-
a = boundAlpha(a);
|
|
28009
|
-
return {
|
|
28010
|
-
ok: ok,
|
|
28011
|
-
format: color.format || format,
|
|
28012
|
-
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
28013
|
-
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
28014
|
-
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
28015
|
-
a: a
|
|
28016
|
-
};
|
|
28017
|
-
}
|
|
27689
|
+
(function(Math) {
|
|
28018
27690
|
|
|
28019
|
-
|
|
28020
|
-
|
|
27691
|
+
var trimLeft = /^\s+/,
|
|
27692
|
+
trimRight = /\s+$/,
|
|
27693
|
+
tinyCounter = 0,
|
|
27694
|
+
mathRound = Math.round,
|
|
27695
|
+
mathMin = Math.min,
|
|
27696
|
+
mathMax = Math.max,
|
|
27697
|
+
mathRandom = Math.random;
|
|
28021
27698
|
|
|
28022
|
-
|
|
28023
|
-
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
27699
|
+
function tinycolor (color, opts) {
|
|
28024
27700
|
|
|
28025
|
-
|
|
28026
|
-
|
|
28027
|
-
// <http://www.w3.org/TR/css3-color/>
|
|
28028
|
-
// *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
28029
|
-
// *Returns:* { r, g, b } in [0, 255]
|
|
28030
|
-
function rgbToRgb(r, g, b) {
|
|
28031
|
-
return {
|
|
28032
|
-
r: bound01(r, 255) * 255,
|
|
28033
|
-
g: bound01(g, 255) * 255,
|
|
28034
|
-
b: bound01(b, 255) * 255
|
|
28035
|
-
};
|
|
28036
|
-
}
|
|
27701
|
+
color = (color) ? color : '';
|
|
27702
|
+
opts = opts || { };
|
|
28037
27703
|
|
|
28038
|
-
//
|
|
28039
|
-
|
|
28040
|
-
|
|
28041
|
-
|
|
28042
|
-
|
|
28043
|
-
|
|
28044
|
-
|
|
28045
|
-
|
|
28046
|
-
var max = Math.max(r, g, b),
|
|
28047
|
-
min = Math.min(r, g, b);
|
|
28048
|
-
var h,
|
|
28049
|
-
s,
|
|
28050
|
-
l = (max + min) / 2;
|
|
28051
|
-
if (max == min) {
|
|
28052
|
-
h = s = 0; // achromatic
|
|
28053
|
-
} else {
|
|
28054
|
-
var d = max - min;
|
|
28055
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
28056
|
-
switch (max) {
|
|
28057
|
-
case r:
|
|
28058
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
28059
|
-
break;
|
|
28060
|
-
case g:
|
|
28061
|
-
h = (b - r) / d + 2;
|
|
28062
|
-
break;
|
|
28063
|
-
case b:
|
|
28064
|
-
h = (r - g) / d + 4;
|
|
28065
|
-
break;
|
|
28066
|
-
}
|
|
28067
|
-
h /= 6;
|
|
28068
|
-
}
|
|
28069
|
-
return {
|
|
28070
|
-
h: h,
|
|
28071
|
-
s: s,
|
|
28072
|
-
l: l
|
|
28073
|
-
};
|
|
28074
|
-
}
|
|
27704
|
+
// If input is already a tinycolor, return itself
|
|
27705
|
+
if (color instanceof tinycolor) {
|
|
27706
|
+
return color;
|
|
27707
|
+
}
|
|
27708
|
+
// If we are called as a function, call using new instead
|
|
27709
|
+
if (!(this instanceof tinycolor)) {
|
|
27710
|
+
return new tinycolor(color, opts);
|
|
27711
|
+
}
|
|
28075
27712
|
|
|
28076
|
-
|
|
28077
|
-
|
|
28078
|
-
|
|
28079
|
-
|
|
28080
|
-
|
|
28081
|
-
|
|
28082
|
-
|
|
28083
|
-
|
|
28084
|
-
|
|
28085
|
-
|
|
28086
|
-
|
|
28087
|
-
|
|
28088
|
-
|
|
28089
|
-
|
|
28090
|
-
|
|
28091
|
-
|
|
28092
|
-
|
|
28093
|
-
|
|
28094
|
-
|
|
28095
|
-
|
|
28096
|
-
|
|
28097
|
-
var p = 2 * l - q;
|
|
28098
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
28099
|
-
g = hue2rgb(p, q, h);
|
|
28100
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
28101
|
-
}
|
|
28102
|
-
return {
|
|
28103
|
-
r: r * 255,
|
|
28104
|
-
g: g * 255,
|
|
28105
|
-
b: b * 255
|
|
28106
|
-
};
|
|
28107
|
-
}
|
|
27713
|
+
var rgb = inputToRGB(color);
|
|
27714
|
+
this._originalInput = color,
|
|
27715
|
+
this._r = rgb.r,
|
|
27716
|
+
this._g = rgb.g,
|
|
27717
|
+
this._b = rgb.b,
|
|
27718
|
+
this._a = rgb.a,
|
|
27719
|
+
this._roundA = mathRound(100*this._a) / 100,
|
|
27720
|
+
this._format = opts.format || rgb.format;
|
|
27721
|
+
this._gradientType = opts.gradientType;
|
|
27722
|
+
|
|
27723
|
+
// Don't let the range of [0,255] come back in [0,1].
|
|
27724
|
+
// Potentially lose a little bit of precision here, but will fix issues where
|
|
27725
|
+
// .5 gets interpreted as half of the total, instead of half of 1
|
|
27726
|
+
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
|
27727
|
+
if (this._r < 1) { this._r = mathRound(this._r); }
|
|
27728
|
+
if (this._g < 1) { this._g = mathRound(this._g); }
|
|
27729
|
+
if (this._b < 1) { this._b = mathRound(this._b); }
|
|
27730
|
+
|
|
27731
|
+
this._ok = rgb.ok;
|
|
27732
|
+
this._tc_id = tinyCounter++;
|
|
27733
|
+
}
|
|
28108
27734
|
|
|
28109
|
-
|
|
28110
|
-
|
|
28111
|
-
|
|
28112
|
-
|
|
28113
|
-
function
|
|
28114
|
-
|
|
28115
|
-
|
|
28116
|
-
|
|
28117
|
-
|
|
28118
|
-
|
|
28119
|
-
|
|
28120
|
-
|
|
28121
|
-
|
|
28122
|
-
|
|
28123
|
-
|
|
28124
|
-
|
|
28125
|
-
|
|
28126
|
-
|
|
28127
|
-
|
|
28128
|
-
|
|
28129
|
-
|
|
28130
|
-
|
|
28131
|
-
|
|
28132
|
-
|
|
28133
|
-
|
|
28134
|
-
|
|
28135
|
-
|
|
28136
|
-
|
|
28137
|
-
|
|
28138
|
-
|
|
28139
|
-
|
|
28140
|
-
|
|
28141
|
-
|
|
28142
|
-
|
|
28143
|
-
|
|
28144
|
-
|
|
28145
|
-
}
|
|
27735
|
+
tinycolor.prototype = {
|
|
27736
|
+
isDark: function() {
|
|
27737
|
+
return this.getBrightness() < 128;
|
|
27738
|
+
},
|
|
27739
|
+
isLight: function() {
|
|
27740
|
+
return !this.isDark();
|
|
27741
|
+
},
|
|
27742
|
+
isValid: function() {
|
|
27743
|
+
return this._ok;
|
|
27744
|
+
},
|
|
27745
|
+
getOriginalInput: function() {
|
|
27746
|
+
return this._originalInput;
|
|
27747
|
+
},
|
|
27748
|
+
getFormat: function() {
|
|
27749
|
+
return this._format;
|
|
27750
|
+
},
|
|
27751
|
+
getAlpha: function() {
|
|
27752
|
+
return this._a;
|
|
27753
|
+
},
|
|
27754
|
+
getBrightness: function() {
|
|
27755
|
+
//http://www.w3.org/TR/AERT#color-contrast
|
|
27756
|
+
var rgb = this.toRgb();
|
|
27757
|
+
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
27758
|
+
},
|
|
27759
|
+
getLuminance: function() {
|
|
27760
|
+
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
27761
|
+
var rgb = this.toRgb();
|
|
27762
|
+
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
27763
|
+
RsRGB = rgb.r/255;
|
|
27764
|
+
GsRGB = rgb.g/255;
|
|
27765
|
+
BsRGB = rgb.b/255;
|
|
27766
|
+
|
|
27767
|
+
if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}
|
|
27768
|
+
if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}
|
|
27769
|
+
if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);}
|
|
27770
|
+
return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);
|
|
27771
|
+
},
|
|
27772
|
+
setAlpha: function(value) {
|
|
27773
|
+
this._a = boundAlpha(value);
|
|
27774
|
+
this._roundA = mathRound(100*this._a) / 100;
|
|
27775
|
+
return this;
|
|
27776
|
+
},
|
|
27777
|
+
toHsv: function() {
|
|
27778
|
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
27779
|
+
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
|
|
27780
|
+
},
|
|
27781
|
+
toHsvString: function() {
|
|
27782
|
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
27783
|
+
var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
|
|
27784
|
+
return (this._a == 1) ?
|
|
27785
|
+
"hsv(" + h + ", " + s + "%, " + v + "%)" :
|
|
27786
|
+
"hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
|
|
27787
|
+
},
|
|
27788
|
+
toHsl: function() {
|
|
27789
|
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
27790
|
+
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
|
|
27791
|
+
},
|
|
27792
|
+
toHslString: function() {
|
|
27793
|
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
27794
|
+
var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
|
|
27795
|
+
return (this._a == 1) ?
|
|
27796
|
+
"hsl(" + h + ", " + s + "%, " + l + "%)" :
|
|
27797
|
+
"hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
|
|
27798
|
+
},
|
|
27799
|
+
toHex: function(allow3Char) {
|
|
27800
|
+
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
27801
|
+
},
|
|
27802
|
+
toHexString: function(allow3Char) {
|
|
27803
|
+
return '#' + this.toHex(allow3Char);
|
|
27804
|
+
},
|
|
27805
|
+
toHex8: function(allow4Char) {
|
|
27806
|
+
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
27807
|
+
},
|
|
27808
|
+
toHex8String: function(allow4Char) {
|
|
27809
|
+
return '#' + this.toHex8(allow4Char);
|
|
27810
|
+
},
|
|
27811
|
+
toRgb: function() {
|
|
27812
|
+
return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
|
|
27813
|
+
},
|
|
27814
|
+
toRgbString: function() {
|
|
27815
|
+
return (this._a == 1) ?
|
|
27816
|
+
"rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
|
|
27817
|
+
"rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
|
|
27818
|
+
},
|
|
27819
|
+
toPercentageRgb: function() {
|
|
27820
|
+
return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
|
|
27821
|
+
},
|
|
27822
|
+
toPercentageRgbString: function() {
|
|
27823
|
+
return (this._a == 1) ?
|
|
27824
|
+
"rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
|
|
27825
|
+
"rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
27826
|
+
},
|
|
27827
|
+
toName: function() {
|
|
27828
|
+
if (this._a === 0) {
|
|
27829
|
+
return "transparent";
|
|
27830
|
+
}
|
|
28146
27831
|
|
|
28147
|
-
|
|
28148
|
-
|
|
28149
|
-
|
|
28150
|
-
// *Returns:* { r, g, b } in the set [0, 255]
|
|
28151
|
-
function hsvToRgb(h, s, v) {
|
|
28152
|
-
h = bound01(h, 360) * 6;
|
|
28153
|
-
s = bound01(s, 100);
|
|
28154
|
-
v = bound01(v, 100);
|
|
28155
|
-
var i = Math.floor(h),
|
|
28156
|
-
f = h - i,
|
|
28157
|
-
p = v * (1 - s),
|
|
28158
|
-
q = v * (1 - f * s),
|
|
28159
|
-
t = v * (1 - (1 - f) * s),
|
|
28160
|
-
mod = i % 6,
|
|
28161
|
-
r = [v, q, p, p, t, v][mod],
|
|
28162
|
-
g = [t, v, v, q, p, p][mod],
|
|
28163
|
-
b = [p, p, t, v, v, q][mod];
|
|
28164
|
-
return {
|
|
28165
|
-
r: r * 255,
|
|
28166
|
-
g: g * 255,
|
|
28167
|
-
b: b * 255
|
|
28168
|
-
};
|
|
28169
|
-
}
|
|
27832
|
+
if (this._a < 1) {
|
|
27833
|
+
return false;
|
|
27834
|
+
}
|
|
28170
27835
|
|
|
28171
|
-
|
|
28172
|
-
|
|
28173
|
-
|
|
28174
|
-
|
|
28175
|
-
|
|
28176
|
-
|
|
27836
|
+
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
27837
|
+
},
|
|
27838
|
+
toFilter: function(secondColor) {
|
|
27839
|
+
var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
27840
|
+
var secondHex8String = hex8String;
|
|
27841
|
+
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
27842
|
+
|
|
27843
|
+
if (secondColor) {
|
|
27844
|
+
var s = tinycolor(secondColor);
|
|
27845
|
+
secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
27846
|
+
}
|
|
28177
27847
|
|
|
28178
|
-
|
|
28179
|
-
|
|
28180
|
-
|
|
28181
|
-
|
|
28182
|
-
|
|
28183
|
-
|
|
27848
|
+
return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
|
|
27849
|
+
},
|
|
27850
|
+
toString: function(format) {
|
|
27851
|
+
var formatSet = !!format;
|
|
27852
|
+
format = format || this._format;
|
|
27853
|
+
|
|
27854
|
+
var formattedString = false;
|
|
27855
|
+
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
27856
|
+
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
27857
|
+
|
|
27858
|
+
if (needsAlphaFormat) {
|
|
27859
|
+
// Special case for "transparent", all other non-alpha formats
|
|
27860
|
+
// will return rgba when there is transparency.
|
|
27861
|
+
if (format === "name" && this._a === 0) {
|
|
27862
|
+
return this.toName();
|
|
27863
|
+
}
|
|
27864
|
+
return this.toRgbString();
|
|
27865
|
+
}
|
|
27866
|
+
if (format === "rgb") {
|
|
27867
|
+
formattedString = this.toRgbString();
|
|
27868
|
+
}
|
|
27869
|
+
if (format === "prgb") {
|
|
27870
|
+
formattedString = this.toPercentageRgbString();
|
|
27871
|
+
}
|
|
27872
|
+
if (format === "hex" || format === "hex6") {
|
|
27873
|
+
formattedString = this.toHexString();
|
|
27874
|
+
}
|
|
27875
|
+
if (format === "hex3") {
|
|
27876
|
+
formattedString = this.toHexString(true);
|
|
27877
|
+
}
|
|
27878
|
+
if (format === "hex4") {
|
|
27879
|
+
formattedString = this.toHex8String(true);
|
|
27880
|
+
}
|
|
27881
|
+
if (format === "hex8") {
|
|
27882
|
+
formattedString = this.toHex8String();
|
|
27883
|
+
}
|
|
27884
|
+
if (format === "name") {
|
|
27885
|
+
formattedString = this.toName();
|
|
27886
|
+
}
|
|
27887
|
+
if (format === "hsl") {
|
|
27888
|
+
formattedString = this.toHslString();
|
|
27889
|
+
}
|
|
27890
|
+
if (format === "hsv") {
|
|
27891
|
+
formattedString = this.toHsvString();
|
|
27892
|
+
}
|
|
28184
27893
|
|
|
28185
|
-
|
|
28186
|
-
|
|
28187
|
-
|
|
28188
|
-
|
|
28189
|
-
|
|
28190
|
-
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
|
|
27894
|
+
return formattedString || this.toHexString();
|
|
27895
|
+
},
|
|
27896
|
+
clone: function() {
|
|
27897
|
+
return tinycolor(this.toString());
|
|
27898
|
+
},
|
|
28191
27899
|
|
|
28192
|
-
|
|
28193
|
-
|
|
28194
|
-
|
|
28195
|
-
|
|
28196
|
-
|
|
28197
|
-
|
|
27900
|
+
_applyModification: function(fn, args) {
|
|
27901
|
+
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
27902
|
+
this._r = color._r;
|
|
27903
|
+
this._g = color._g;
|
|
27904
|
+
this._b = color._b;
|
|
27905
|
+
this.setAlpha(color._a);
|
|
27906
|
+
return this;
|
|
27907
|
+
},
|
|
27908
|
+
lighten: function() {
|
|
27909
|
+
return this._applyModification(lighten, arguments);
|
|
27910
|
+
},
|
|
27911
|
+
brighten: function() {
|
|
27912
|
+
return this._applyModification(brighten, arguments);
|
|
27913
|
+
},
|
|
27914
|
+
darken: function() {
|
|
27915
|
+
return this._applyModification(darken, arguments);
|
|
27916
|
+
},
|
|
27917
|
+
desaturate: function() {
|
|
27918
|
+
return this._applyModification(desaturate, arguments);
|
|
27919
|
+
},
|
|
27920
|
+
saturate: function() {
|
|
27921
|
+
return this._applyModification(saturate, arguments);
|
|
27922
|
+
},
|
|
27923
|
+
greyscale: function() {
|
|
27924
|
+
return this._applyModification(greyscale, arguments);
|
|
27925
|
+
},
|
|
27926
|
+
spin: function() {
|
|
27927
|
+
return this._applyModification(spin, arguments);
|
|
27928
|
+
},
|
|
28198
27929
|
|
|
28199
|
-
|
|
28200
|
-
|
|
28201
|
-
|
|
28202
|
-
function
|
|
28203
|
-
|
|
28204
|
-
|
|
28205
|
-
|
|
27930
|
+
_applyCombination: function(fn, args) {
|
|
27931
|
+
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
27932
|
+
},
|
|
27933
|
+
analogous: function() {
|
|
27934
|
+
return this._applyCombination(analogous, arguments);
|
|
27935
|
+
},
|
|
27936
|
+
complement: function() {
|
|
27937
|
+
return this._applyCombination(complement, arguments);
|
|
27938
|
+
},
|
|
27939
|
+
monochromatic: function() {
|
|
27940
|
+
return this._applyCombination(monochromatic, arguments);
|
|
27941
|
+
},
|
|
27942
|
+
splitcomplement: function() {
|
|
27943
|
+
return this._applyCombination(splitcomplement, arguments);
|
|
27944
|
+
},
|
|
27945
|
+
triad: function() {
|
|
27946
|
+
return this._applyCombination(triad, arguments);
|
|
27947
|
+
},
|
|
27948
|
+
tetrad: function() {
|
|
27949
|
+
return this._applyCombination(tetrad, arguments);
|
|
27950
|
+
}
|
|
27951
|
+
};
|
|
27952
|
+
|
|
27953
|
+
// If input is an object, force 1 into "1.0" to handle ratios properly
|
|
27954
|
+
// String input requires "1.0" as input, so 1 will be treated as 1
|
|
27955
|
+
tinycolor.fromRatio = function(color, opts) {
|
|
27956
|
+
if (typeof color == "object") {
|
|
27957
|
+
var newColor = {};
|
|
27958
|
+
for (var i in color) {
|
|
27959
|
+
if (color.hasOwnProperty(i)) {
|
|
27960
|
+
if (i === "a") {
|
|
27961
|
+
newColor[i] = color[i];
|
|
27962
|
+
}
|
|
27963
|
+
else {
|
|
27964
|
+
newColor[i] = convertToPercentage(color[i]);
|
|
27965
|
+
}
|
|
27966
|
+
}
|
|
27967
|
+
}
|
|
27968
|
+
color = newColor;
|
|
27969
|
+
}
|
|
28206
27970
|
|
|
28207
|
-
|
|
28208
|
-
|
|
28209
|
-
|
|
28210
|
-
|
|
28211
|
-
|
|
28212
|
-
|
|
28213
|
-
|
|
28214
|
-
|
|
28215
|
-
|
|
28216
|
-
|
|
28217
|
-
|
|
28218
|
-
|
|
28219
|
-
|
|
27971
|
+
return tinycolor(color, opts);
|
|
27972
|
+
};
|
|
27973
|
+
|
|
27974
|
+
// Given a string or object, convert that input to RGB
|
|
27975
|
+
// Possible string inputs:
|
|
27976
|
+
//
|
|
27977
|
+
// "red"
|
|
27978
|
+
// "#f00" or "f00"
|
|
27979
|
+
// "#ff0000" or "ff0000"
|
|
27980
|
+
// "#ff000000" or "ff000000"
|
|
27981
|
+
// "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
27982
|
+
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
27983
|
+
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
27984
|
+
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
27985
|
+
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
27986
|
+
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
27987
|
+
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
27988
|
+
//
|
|
27989
|
+
function inputToRGB(color) {
|
|
27990
|
+
|
|
27991
|
+
var rgb = { r: 0, g: 0, b: 0 };
|
|
27992
|
+
var a = 1;
|
|
27993
|
+
var s = null;
|
|
27994
|
+
var v = null;
|
|
27995
|
+
var l = null;
|
|
27996
|
+
var ok = false;
|
|
27997
|
+
var format = false;
|
|
27998
|
+
|
|
27999
|
+
if (typeof color == "string") {
|
|
28000
|
+
color = stringInputToObject(color);
|
|
28001
|
+
}
|
|
28220
28002
|
|
|
28221
|
-
|
|
28222
|
-
|
|
28223
|
-
|
|
28224
|
-
|
|
28225
|
-
|
|
28226
|
-
|
|
28227
|
-
|
|
28228
|
-
|
|
28229
|
-
|
|
28230
|
-
|
|
28231
|
-
|
|
28232
|
-
|
|
28233
|
-
|
|
28234
|
-
|
|
28235
|
-
|
|
28236
|
-
|
|
28237
|
-
|
|
28238
|
-
|
|
28239
|
-
|
|
28240
|
-
|
|
28241
|
-
|
|
28242
|
-
|
|
28243
|
-
|
|
28244
|
-
|
|
28245
|
-
|
|
28246
|
-
hsl.l += amount / 100;
|
|
28247
|
-
hsl.l = clamp01(hsl.l);
|
|
28248
|
-
return tinycolor(hsl);
|
|
28249
|
-
}
|
|
28250
|
-
function _brighten(color, amount) {
|
|
28251
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
28252
|
-
var rgb = tinycolor(color).toRgb();
|
|
28253
|
-
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
28254
|
-
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
28255
|
-
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
28256
|
-
return tinycolor(rgb);
|
|
28257
|
-
}
|
|
28258
|
-
function _darken(color, amount) {
|
|
28259
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
28260
|
-
var hsl = tinycolor(color).toHsl();
|
|
28261
|
-
hsl.l -= amount / 100;
|
|
28262
|
-
hsl.l = clamp01(hsl.l);
|
|
28263
|
-
return tinycolor(hsl);
|
|
28264
|
-
}
|
|
28265
|
-
|
|
28266
|
-
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
28267
|
-
// Values outside of this range will be wrapped into this range.
|
|
28268
|
-
function _spin(color, amount) {
|
|
28269
|
-
var hsl = tinycolor(color).toHsl();
|
|
28270
|
-
var hue = (hsl.h + amount) % 360;
|
|
28271
|
-
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
28272
|
-
return tinycolor(hsl);
|
|
28273
|
-
}
|
|
28274
|
-
|
|
28275
|
-
// Combination Functions
|
|
28276
|
-
// ---------------------
|
|
28277
|
-
// Thanks to jQuery xColor for some of the ideas behind these
|
|
28278
|
-
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
|
28279
|
-
|
|
28280
|
-
function _complement(color) {
|
|
28281
|
-
var hsl = tinycolor(color).toHsl();
|
|
28282
|
-
hsl.h = (hsl.h + 180) % 360;
|
|
28283
|
-
return tinycolor(hsl);
|
|
28284
|
-
}
|
|
28285
|
-
function polyad(color, number) {
|
|
28286
|
-
if (isNaN(number) || number <= 0) {
|
|
28287
|
-
throw new Error("Argument to polyad must be a positive number");
|
|
28288
|
-
}
|
|
28289
|
-
var hsl = tinycolor(color).toHsl();
|
|
28290
|
-
var result = [tinycolor(color)];
|
|
28291
|
-
var step = 360 / number;
|
|
28292
|
-
for (var i = 1; i < number; i++) {
|
|
28293
|
-
result.push(tinycolor({
|
|
28294
|
-
h: (hsl.h + i * step) % 360,
|
|
28295
|
-
s: hsl.s,
|
|
28296
|
-
l: hsl.l
|
|
28297
|
-
}));
|
|
28298
|
-
}
|
|
28299
|
-
return result;
|
|
28300
|
-
}
|
|
28301
|
-
function _splitcomplement(color) {
|
|
28302
|
-
var hsl = tinycolor(color).toHsl();
|
|
28303
|
-
var h = hsl.h;
|
|
28304
|
-
return [tinycolor(color), tinycolor({
|
|
28305
|
-
h: (h + 72) % 360,
|
|
28306
|
-
s: hsl.s,
|
|
28307
|
-
l: hsl.l
|
|
28308
|
-
}), tinycolor({
|
|
28309
|
-
h: (h + 216) % 360,
|
|
28310
|
-
s: hsl.s,
|
|
28311
|
-
l: hsl.l
|
|
28312
|
-
})];
|
|
28313
|
-
}
|
|
28314
|
-
function _analogous(color, results, slices) {
|
|
28315
|
-
results = results || 6;
|
|
28316
|
-
slices = slices || 30;
|
|
28317
|
-
var hsl = tinycolor(color).toHsl();
|
|
28318
|
-
var part = 360 / slices;
|
|
28319
|
-
var ret = [tinycolor(color)];
|
|
28320
|
-
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
|
|
28321
|
-
hsl.h = (hsl.h + part) % 360;
|
|
28322
|
-
ret.push(tinycolor(hsl));
|
|
28323
|
-
}
|
|
28324
|
-
return ret;
|
|
28325
|
-
}
|
|
28326
|
-
function _monochromatic(color, results) {
|
|
28327
|
-
results = results || 6;
|
|
28328
|
-
var hsv = tinycolor(color).toHsv();
|
|
28329
|
-
var h = hsv.h,
|
|
28330
|
-
s = hsv.s,
|
|
28331
|
-
v = hsv.v;
|
|
28332
|
-
var ret = [];
|
|
28333
|
-
var modification = 1 / results;
|
|
28334
|
-
while (results--) {
|
|
28335
|
-
ret.push(tinycolor({
|
|
28336
|
-
h: h,
|
|
28337
|
-
s: s,
|
|
28338
|
-
v: v
|
|
28339
|
-
}));
|
|
28340
|
-
v = (v + modification) % 1;
|
|
28341
|
-
}
|
|
28342
|
-
return ret;
|
|
28343
|
-
}
|
|
28003
|
+
if (typeof color == "object") {
|
|
28004
|
+
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
28005
|
+
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
28006
|
+
ok = true;
|
|
28007
|
+
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
28008
|
+
}
|
|
28009
|
+
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
28010
|
+
s = convertToPercentage(color.s);
|
|
28011
|
+
v = convertToPercentage(color.v);
|
|
28012
|
+
rgb = hsvToRgb(color.h, s, v);
|
|
28013
|
+
ok = true;
|
|
28014
|
+
format = "hsv";
|
|
28015
|
+
}
|
|
28016
|
+
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
28017
|
+
s = convertToPercentage(color.s);
|
|
28018
|
+
l = convertToPercentage(color.l);
|
|
28019
|
+
rgb = hslToRgb(color.h, s, l);
|
|
28020
|
+
ok = true;
|
|
28021
|
+
format = "hsl";
|
|
28022
|
+
}
|
|
28023
|
+
|
|
28024
|
+
if (color.hasOwnProperty("a")) {
|
|
28025
|
+
a = color.a;
|
|
28026
|
+
}
|
|
28027
|
+
}
|
|
28344
28028
|
|
|
28345
|
-
|
|
28346
|
-
// ---------------------
|
|
28029
|
+
a = boundAlpha(a);
|
|
28347
28030
|
|
|
28348
|
-
|
|
28349
|
-
|
|
28350
|
-
|
|
28351
|
-
|
|
28352
|
-
|
|
28353
|
-
|
|
28354
|
-
|
|
28355
|
-
|
|
28356
|
-
|
|
28357
|
-
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
28358
|
-
};
|
|
28359
|
-
return tinycolor(rgba);
|
|
28360
|
-
};
|
|
28361
|
-
|
|
28362
|
-
// Readability Functions
|
|
28363
|
-
// ---------------------
|
|
28364
|
-
// <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
|
|
28365
|
-
|
|
28366
|
-
// `contrast`
|
|
28367
|
-
// Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
|
|
28368
|
-
tinycolor.readability = function (color1, color2) {
|
|
28369
|
-
var c1 = tinycolor(color1);
|
|
28370
|
-
var c2 = tinycolor(color2);
|
|
28371
|
-
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
|
|
28372
|
-
};
|
|
28373
|
-
|
|
28374
|
-
// `isReadable`
|
|
28375
|
-
// Ensure that foreground and background color combinations meet WCAG2 guidelines.
|
|
28376
|
-
// The third argument is an optional Object.
|
|
28377
|
-
// the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
|
|
28378
|
-
// the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
|
|
28379
|
-
// If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
|
|
28380
|
-
|
|
28381
|
-
// *Example*
|
|
28382
|
-
// tinycolor.isReadable("#000", "#111") => false
|
|
28383
|
-
// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
|
|
28384
|
-
tinycolor.isReadable = function (color1, color2, wcag2) {
|
|
28385
|
-
var readability = tinycolor.readability(color1, color2);
|
|
28386
|
-
var wcag2Parms, out;
|
|
28387
|
-
out = false;
|
|
28388
|
-
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
28389
|
-
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
28390
|
-
case "AAsmall":
|
|
28391
|
-
case "AAAlarge":
|
|
28392
|
-
out = readability >= 4.5;
|
|
28393
|
-
break;
|
|
28394
|
-
case "AAlarge":
|
|
28395
|
-
out = readability >= 3;
|
|
28396
|
-
break;
|
|
28397
|
-
case "AAAsmall":
|
|
28398
|
-
out = readability >= 7;
|
|
28399
|
-
break;
|
|
28400
|
-
}
|
|
28401
|
-
return out;
|
|
28402
|
-
};
|
|
28403
|
-
|
|
28404
|
-
// `mostReadable`
|
|
28405
|
-
// Given a base color and a list of possible foreground or background
|
|
28406
|
-
// colors for that base, returns the most readable color.
|
|
28407
|
-
// Optionally returns Black or White if the most readable color is unreadable.
|
|
28408
|
-
// *Example*
|
|
28409
|
-
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
|
|
28410
|
-
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
|
|
28411
|
-
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
|
|
28412
|
-
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
|
|
28413
|
-
tinycolor.mostReadable = function (baseColor, colorList, args) {
|
|
28414
|
-
var bestColor = null;
|
|
28415
|
-
var bestScore = 0;
|
|
28416
|
-
var readability;
|
|
28417
|
-
var includeFallbackColors, level, size;
|
|
28418
|
-
args = args || {};
|
|
28419
|
-
includeFallbackColors = args.includeFallbackColors;
|
|
28420
|
-
level = args.level;
|
|
28421
|
-
size = args.size;
|
|
28422
|
-
for (var i = 0; i < colorList.length; i++) {
|
|
28423
|
-
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
28424
|
-
if (readability > bestScore) {
|
|
28425
|
-
bestScore = readability;
|
|
28426
|
-
bestColor = tinycolor(colorList[i]);
|
|
28427
|
-
}
|
|
28428
|
-
}
|
|
28429
|
-
if (tinycolor.isReadable(baseColor, bestColor, {
|
|
28430
|
-
level: level,
|
|
28431
|
-
size: size
|
|
28432
|
-
}) || !includeFallbackColors) {
|
|
28433
|
-
return bestColor;
|
|
28434
|
-
} else {
|
|
28435
|
-
args.includeFallbackColors = false;
|
|
28436
|
-
return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
|
|
28437
|
-
}
|
|
28438
|
-
};
|
|
28439
|
-
|
|
28440
|
-
// Big List of Colors
|
|
28441
|
-
// ------------------
|
|
28442
|
-
// <https://www.w3.org/TR/css-color-4/#named-colors>
|
|
28443
|
-
var names = tinycolor.names = {
|
|
28444
|
-
aliceblue: "f0f8ff",
|
|
28445
|
-
antiquewhite: "faebd7",
|
|
28446
|
-
aqua: "0ff",
|
|
28447
|
-
aquamarine: "7fffd4",
|
|
28448
|
-
azure: "f0ffff",
|
|
28449
|
-
beige: "f5f5dc",
|
|
28450
|
-
bisque: "ffe4c4",
|
|
28451
|
-
black: "000",
|
|
28452
|
-
blanchedalmond: "ffebcd",
|
|
28453
|
-
blue: "00f",
|
|
28454
|
-
blueviolet: "8a2be2",
|
|
28455
|
-
brown: "a52a2a",
|
|
28456
|
-
burlywood: "deb887",
|
|
28457
|
-
burntsienna: "ea7e5d",
|
|
28458
|
-
cadetblue: "5f9ea0",
|
|
28459
|
-
chartreuse: "7fff00",
|
|
28460
|
-
chocolate: "d2691e",
|
|
28461
|
-
coral: "ff7f50",
|
|
28462
|
-
cornflowerblue: "6495ed",
|
|
28463
|
-
cornsilk: "fff8dc",
|
|
28464
|
-
crimson: "dc143c",
|
|
28465
|
-
cyan: "0ff",
|
|
28466
|
-
darkblue: "00008b",
|
|
28467
|
-
darkcyan: "008b8b",
|
|
28468
|
-
darkgoldenrod: "b8860b",
|
|
28469
|
-
darkgray: "a9a9a9",
|
|
28470
|
-
darkgreen: "006400",
|
|
28471
|
-
darkgrey: "a9a9a9",
|
|
28472
|
-
darkkhaki: "bdb76b",
|
|
28473
|
-
darkmagenta: "8b008b",
|
|
28474
|
-
darkolivegreen: "556b2f",
|
|
28475
|
-
darkorange: "ff8c00",
|
|
28476
|
-
darkorchid: "9932cc",
|
|
28477
|
-
darkred: "8b0000",
|
|
28478
|
-
darksalmon: "e9967a",
|
|
28479
|
-
darkseagreen: "8fbc8f",
|
|
28480
|
-
darkslateblue: "483d8b",
|
|
28481
|
-
darkslategray: "2f4f4f",
|
|
28482
|
-
darkslategrey: "2f4f4f",
|
|
28483
|
-
darkturquoise: "00ced1",
|
|
28484
|
-
darkviolet: "9400d3",
|
|
28485
|
-
deeppink: "ff1493",
|
|
28486
|
-
deepskyblue: "00bfff",
|
|
28487
|
-
dimgray: "696969",
|
|
28488
|
-
dimgrey: "696969",
|
|
28489
|
-
dodgerblue: "1e90ff",
|
|
28490
|
-
firebrick: "b22222",
|
|
28491
|
-
floralwhite: "fffaf0",
|
|
28492
|
-
forestgreen: "228b22",
|
|
28493
|
-
fuchsia: "f0f",
|
|
28494
|
-
gainsboro: "dcdcdc",
|
|
28495
|
-
ghostwhite: "f8f8ff",
|
|
28496
|
-
gold: "ffd700",
|
|
28497
|
-
goldenrod: "daa520",
|
|
28498
|
-
gray: "808080",
|
|
28499
|
-
green: "008000",
|
|
28500
|
-
greenyellow: "adff2f",
|
|
28501
|
-
grey: "808080",
|
|
28502
|
-
honeydew: "f0fff0",
|
|
28503
|
-
hotpink: "ff69b4",
|
|
28504
|
-
indianred: "cd5c5c",
|
|
28505
|
-
indigo: "4b0082",
|
|
28506
|
-
ivory: "fffff0",
|
|
28507
|
-
khaki: "f0e68c",
|
|
28508
|
-
lavender: "e6e6fa",
|
|
28509
|
-
lavenderblush: "fff0f5",
|
|
28510
|
-
lawngreen: "7cfc00",
|
|
28511
|
-
lemonchiffon: "fffacd",
|
|
28512
|
-
lightblue: "add8e6",
|
|
28513
|
-
lightcoral: "f08080",
|
|
28514
|
-
lightcyan: "e0ffff",
|
|
28515
|
-
lightgoldenrodyellow: "fafad2",
|
|
28516
|
-
lightgray: "d3d3d3",
|
|
28517
|
-
lightgreen: "90ee90",
|
|
28518
|
-
lightgrey: "d3d3d3",
|
|
28519
|
-
lightpink: "ffb6c1",
|
|
28520
|
-
lightsalmon: "ffa07a",
|
|
28521
|
-
lightseagreen: "20b2aa",
|
|
28522
|
-
lightskyblue: "87cefa",
|
|
28523
|
-
lightslategray: "789",
|
|
28524
|
-
lightslategrey: "789",
|
|
28525
|
-
lightsteelblue: "b0c4de",
|
|
28526
|
-
lightyellow: "ffffe0",
|
|
28527
|
-
lime: "0f0",
|
|
28528
|
-
limegreen: "32cd32",
|
|
28529
|
-
linen: "faf0e6",
|
|
28530
|
-
magenta: "f0f",
|
|
28531
|
-
maroon: "800000",
|
|
28532
|
-
mediumaquamarine: "66cdaa",
|
|
28533
|
-
mediumblue: "0000cd",
|
|
28534
|
-
mediumorchid: "ba55d3",
|
|
28535
|
-
mediumpurple: "9370db",
|
|
28536
|
-
mediumseagreen: "3cb371",
|
|
28537
|
-
mediumslateblue: "7b68ee",
|
|
28538
|
-
mediumspringgreen: "00fa9a",
|
|
28539
|
-
mediumturquoise: "48d1cc",
|
|
28540
|
-
mediumvioletred: "c71585",
|
|
28541
|
-
midnightblue: "191970",
|
|
28542
|
-
mintcream: "f5fffa",
|
|
28543
|
-
mistyrose: "ffe4e1",
|
|
28544
|
-
moccasin: "ffe4b5",
|
|
28545
|
-
navajowhite: "ffdead",
|
|
28546
|
-
navy: "000080",
|
|
28547
|
-
oldlace: "fdf5e6",
|
|
28548
|
-
olive: "808000",
|
|
28549
|
-
olivedrab: "6b8e23",
|
|
28550
|
-
orange: "ffa500",
|
|
28551
|
-
orangered: "ff4500",
|
|
28552
|
-
orchid: "da70d6",
|
|
28553
|
-
palegoldenrod: "eee8aa",
|
|
28554
|
-
palegreen: "98fb98",
|
|
28555
|
-
paleturquoise: "afeeee",
|
|
28556
|
-
palevioletred: "db7093",
|
|
28557
|
-
papayawhip: "ffefd5",
|
|
28558
|
-
peachpuff: "ffdab9",
|
|
28559
|
-
peru: "cd853f",
|
|
28560
|
-
pink: "ffc0cb",
|
|
28561
|
-
plum: "dda0dd",
|
|
28562
|
-
powderblue: "b0e0e6",
|
|
28563
|
-
purple: "800080",
|
|
28564
|
-
rebeccapurple: "663399",
|
|
28565
|
-
red: "f00",
|
|
28566
|
-
rosybrown: "bc8f8f",
|
|
28567
|
-
royalblue: "4169e1",
|
|
28568
|
-
saddlebrown: "8b4513",
|
|
28569
|
-
salmon: "fa8072",
|
|
28570
|
-
sandybrown: "f4a460",
|
|
28571
|
-
seagreen: "2e8b57",
|
|
28572
|
-
seashell: "fff5ee",
|
|
28573
|
-
sienna: "a0522d",
|
|
28574
|
-
silver: "c0c0c0",
|
|
28575
|
-
skyblue: "87ceeb",
|
|
28576
|
-
slateblue: "6a5acd",
|
|
28577
|
-
slategray: "708090",
|
|
28578
|
-
slategrey: "708090",
|
|
28579
|
-
snow: "fffafa",
|
|
28580
|
-
springgreen: "00ff7f",
|
|
28581
|
-
steelblue: "4682b4",
|
|
28582
|
-
tan: "d2b48c",
|
|
28583
|
-
teal: "008080",
|
|
28584
|
-
thistle: "d8bfd8",
|
|
28585
|
-
tomato: "ff6347",
|
|
28586
|
-
turquoise: "40e0d0",
|
|
28587
|
-
violet: "ee82ee",
|
|
28588
|
-
wheat: "f5deb3",
|
|
28589
|
-
white: "fff",
|
|
28590
|
-
whitesmoke: "f5f5f5",
|
|
28591
|
-
yellow: "ff0",
|
|
28592
|
-
yellowgreen: "9acd32"
|
|
28593
|
-
};
|
|
28594
|
-
|
|
28595
|
-
// Make it easy to access colors via `hexNames[hex]`
|
|
28596
|
-
var hexNames = tinycolor.hexNames = flip(names);
|
|
28597
|
-
|
|
28598
|
-
// Utilities
|
|
28599
|
-
// ---------
|
|
28600
|
-
|
|
28601
|
-
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
|
|
28602
|
-
function flip(o) {
|
|
28603
|
-
var flipped = {};
|
|
28604
|
-
for (var i in o) {
|
|
28605
|
-
if (o.hasOwnProperty(i)) {
|
|
28606
|
-
flipped[o[i]] = i;
|
|
28607
|
-
}
|
|
28608
|
-
}
|
|
28609
|
-
return flipped;
|
|
28610
|
-
}
|
|
28611
|
-
|
|
28612
|
-
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
28613
|
-
function boundAlpha(a) {
|
|
28614
|
-
a = parseFloat(a);
|
|
28615
|
-
if (isNaN(a) || a < 0 || a > 1) {
|
|
28616
|
-
a = 1;
|
|
28617
|
-
}
|
|
28618
|
-
return a;
|
|
28619
|
-
}
|
|
28620
|
-
|
|
28621
|
-
// Take input from [0, n] and return it as [0, 1]
|
|
28622
|
-
function bound01(n, max) {
|
|
28623
|
-
if (isOnePointZero(n)) n = "100%";
|
|
28624
|
-
var processPercent = isPercentage(n);
|
|
28625
|
-
n = Math.min(max, Math.max(0, parseFloat(n)));
|
|
28626
|
-
|
|
28627
|
-
// Automatically convert percentage into number
|
|
28628
|
-
if (processPercent) {
|
|
28629
|
-
n = parseInt(n * max, 10) / 100;
|
|
28630
|
-
}
|
|
28631
|
-
|
|
28632
|
-
// Handle floating point rounding errors
|
|
28633
|
-
if (Math.abs(n - max) < 0.000001) {
|
|
28634
|
-
return 1;
|
|
28635
|
-
}
|
|
28031
|
+
return {
|
|
28032
|
+
ok: ok,
|
|
28033
|
+
format: color.format || format,
|
|
28034
|
+
r: mathMin(255, mathMax(rgb.r, 0)),
|
|
28035
|
+
g: mathMin(255, mathMax(rgb.g, 0)),
|
|
28036
|
+
b: mathMin(255, mathMax(rgb.b, 0)),
|
|
28037
|
+
a: a
|
|
28038
|
+
};
|
|
28039
|
+
}
|
|
28636
28040
|
|
|
28637
|
-
// Convert into [0, 1] range if it isn't already
|
|
28638
|
-
return n % max / parseFloat(max);
|
|
28639
|
-
}
|
|
28640
28041
|
|
|
28641
|
-
//
|
|
28642
|
-
|
|
28643
|
-
return Math.min(1, Math.max(0, val));
|
|
28644
|
-
}
|
|
28042
|
+
// Conversion Functions
|
|
28043
|
+
// --------------------
|
|
28645
28044
|
|
|
28646
|
-
//
|
|
28647
|
-
|
|
28648
|
-
return parseInt(val, 16);
|
|
28649
|
-
}
|
|
28045
|
+
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
|
28046
|
+
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
28650
28047
|
|
|
28651
|
-
//
|
|
28652
|
-
//
|
|
28653
|
-
|
|
28654
|
-
|
|
28655
|
-
}
|
|
28048
|
+
// `rgbToRgb`
|
|
28049
|
+
// Handle bounds / percentage checking to conform to CSS color spec
|
|
28050
|
+
// <http://www.w3.org/TR/css3-color/>
|
|
28051
|
+
// *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
28052
|
+
// *Returns:* { r, g, b } in [0, 255]
|
|
28053
|
+
function rgbToRgb(r, g, b){
|
|
28054
|
+
return {
|
|
28055
|
+
r: bound01(r, 255) * 255,
|
|
28056
|
+
g: bound01(g, 255) * 255,
|
|
28057
|
+
b: bound01(b, 255) * 255
|
|
28058
|
+
};
|
|
28059
|
+
}
|
|
28656
28060
|
|
|
28657
|
-
//
|
|
28658
|
-
|
|
28659
|
-
|
|
28660
|
-
}
|
|
28061
|
+
// `rgbToHsl`
|
|
28062
|
+
// Converts an RGB color value to HSL.
|
|
28063
|
+
// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
|
|
28064
|
+
// *Returns:* { h, s, l } in [0,1]
|
|
28065
|
+
function rgbToHsl(r, g, b) {
|
|
28661
28066
|
|
|
28662
|
-
|
|
28663
|
-
|
|
28664
|
-
|
|
28665
|
-
}
|
|
28067
|
+
r = bound01(r, 255);
|
|
28068
|
+
g = bound01(g, 255);
|
|
28069
|
+
b = bound01(b, 255);
|
|
28666
28070
|
|
|
28667
|
-
|
|
28668
|
-
|
|
28669
|
-
if (n <= 1) {
|
|
28670
|
-
n = n * 100 + "%";
|
|
28671
|
-
}
|
|
28672
|
-
return n;
|
|
28673
|
-
}
|
|
28071
|
+
var max = mathMax(r, g, b), min = mathMin(r, g, b);
|
|
28072
|
+
var h, s, l = (max + min) / 2;
|
|
28674
28073
|
|
|
28675
|
-
|
|
28676
|
-
|
|
28677
|
-
|
|
28678
|
-
|
|
28679
|
-
|
|
28680
|
-
|
|
28681
|
-
|
|
28682
|
-
|
|
28683
|
-
|
|
28684
|
-
|
|
28685
|
-
|
|
28074
|
+
if(max == min) {
|
|
28075
|
+
h = s = 0; // achromatic
|
|
28076
|
+
}
|
|
28077
|
+
else {
|
|
28078
|
+
var d = max - min;
|
|
28079
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
28080
|
+
switch(max) {
|
|
28081
|
+
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
|
28082
|
+
case g: h = (b - r) / d + 2; break;
|
|
28083
|
+
case b: h = (r - g) / d + 4; break;
|
|
28084
|
+
}
|
|
28686
28085
|
|
|
28687
|
-
|
|
28688
|
-
|
|
28086
|
+
h /= 6;
|
|
28087
|
+
}
|
|
28689
28088
|
|
|
28690
|
-
|
|
28691
|
-
|
|
28089
|
+
return { h: h, s: s, l: l };
|
|
28090
|
+
}
|
|
28692
28091
|
|
|
28693
|
-
|
|
28694
|
-
|
|
28695
|
-
|
|
28696
|
-
|
|
28697
|
-
|
|
28698
|
-
|
|
28699
|
-
|
|
28700
|
-
|
|
28701
|
-
|
|
28702
|
-
|
|
28703
|
-
|
|
28704
|
-
|
|
28705
|
-
|
|
28706
|
-
|
|
28707
|
-
|
|
28708
|
-
|
|
28709
|
-
|
|
28710
|
-
|
|
28711
|
-
}
|
|
28092
|
+
// `hslToRgb`
|
|
28093
|
+
// Converts an HSL color value to RGB.
|
|
28094
|
+
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
|
28095
|
+
// *Returns:* { r, g, b } in the set [0, 255]
|
|
28096
|
+
function hslToRgb(h, s, l) {
|
|
28097
|
+
var r, g, b;
|
|
28098
|
+
|
|
28099
|
+
h = bound01(h, 360);
|
|
28100
|
+
s = bound01(s, 100);
|
|
28101
|
+
l = bound01(l, 100);
|
|
28102
|
+
|
|
28103
|
+
function hue2rgb(p, q, t) {
|
|
28104
|
+
if(t < 0) t += 1;
|
|
28105
|
+
if(t > 1) t -= 1;
|
|
28106
|
+
if(t < 1/6) return p + (q - p) * 6 * t;
|
|
28107
|
+
if(t < 1/2) return q;
|
|
28108
|
+
if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
|
|
28109
|
+
return p;
|
|
28110
|
+
}
|
|
28712
28111
|
|
|
28713
|
-
|
|
28714
|
-
|
|
28715
|
-
|
|
28716
|
-
|
|
28717
|
-
|
|
28718
|
-
|
|
28719
|
-
|
|
28720
|
-
|
|
28721
|
-
|
|
28722
|
-
|
|
28723
|
-
function stringInputToObject(color) {
|
|
28724
|
-
color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
|
|
28725
|
-
var named = false;
|
|
28726
|
-
if (names[color]) {
|
|
28727
|
-
color = names[color];
|
|
28728
|
-
named = true;
|
|
28729
|
-
} else if (color == "transparent") {
|
|
28730
|
-
return {
|
|
28731
|
-
r: 0,
|
|
28732
|
-
g: 0,
|
|
28733
|
-
b: 0,
|
|
28734
|
-
a: 0,
|
|
28735
|
-
format: "name"
|
|
28736
|
-
};
|
|
28737
|
-
}
|
|
28112
|
+
if(s === 0) {
|
|
28113
|
+
r = g = b = l; // achromatic
|
|
28114
|
+
}
|
|
28115
|
+
else {
|
|
28116
|
+
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
28117
|
+
var p = 2 * l - q;
|
|
28118
|
+
r = hue2rgb(p, q, h + 1/3);
|
|
28119
|
+
g = hue2rgb(p, q, h);
|
|
28120
|
+
b = hue2rgb(p, q, h - 1/3);
|
|
28121
|
+
}
|
|
28738
28122
|
|
|
28739
|
-
|
|
28740
|
-
|
|
28741
|
-
|
|
28742
|
-
|
|
28743
|
-
|
|
28744
|
-
|
|
28745
|
-
|
|
28746
|
-
|
|
28747
|
-
|
|
28748
|
-
|
|
28749
|
-
|
|
28750
|
-
|
|
28751
|
-
|
|
28752
|
-
|
|
28753
|
-
|
|
28754
|
-
|
|
28755
|
-
|
|
28756
|
-
|
|
28757
|
-
|
|
28758
|
-
|
|
28759
|
-
|
|
28760
|
-
|
|
28761
|
-
|
|
28762
|
-
|
|
28763
|
-
|
|
28764
|
-
|
|
28765
|
-
|
|
28766
|
-
|
|
28767
|
-
|
|
28768
|
-
|
|
28769
|
-
|
|
28770
|
-
|
|
28771
|
-
|
|
28772
|
-
|
|
28773
|
-
|
|
28774
|
-
|
|
28775
|
-
|
|
28776
|
-
|
|
28777
|
-
|
|
28778
|
-
|
|
28779
|
-
|
|
28780
|
-
|
|
28781
|
-
|
|
28782
|
-
|
|
28783
|
-
|
|
28784
|
-
|
|
28785
|
-
|
|
28786
|
-
|
|
28787
|
-
|
|
28788
|
-
|
|
28789
|
-
|
|
28790
|
-
|
|
28791
|
-
|
|
28792
|
-
|
|
28793
|
-
|
|
28794
|
-
|
|
28795
|
-
|
|
28796
|
-
|
|
28797
|
-
|
|
28798
|
-
|
|
28799
|
-
|
|
28800
|
-
|
|
28801
|
-
|
|
28802
|
-
|
|
28803
|
-
|
|
28804
|
-
|
|
28805
|
-
|
|
28806
|
-
|
|
28807
|
-
|
|
28808
|
-
|
|
28809
|
-
|
|
28810
|
-
|
|
28811
|
-
|
|
28812
|
-
|
|
28813
|
-
|
|
28814
|
-
|
|
28815
|
-
|
|
28816
|
-
|
|
28817
|
-
|
|
28818
|
-
|
|
28819
|
-
|
|
28820
|
-
|
|
28821
|
-
|
|
28822
|
-
|
|
28823
|
-
|
|
28824
|
-
|
|
28825
|
-
|
|
28826
|
-
|
|
28827
|
-
|
|
28828
|
-
|
|
28829
|
-
|
|
28830
|
-
|
|
28831
|
-
|
|
28832
|
-
|
|
28833
|
-
|
|
28834
|
-
|
|
28835
|
-
|
|
28836
|
-
|
|
28837
|
-
|
|
28838
|
-
|
|
28839
|
-
|
|
28840
|
-
|
|
28841
|
-
|
|
28842
|
-
|
|
28843
|
-
|
|
28844
|
-
|
|
28845
|
-
|
|
28123
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
28124
|
+
}
|
|
28125
|
+
|
|
28126
|
+
// `rgbToHsv`
|
|
28127
|
+
// Converts an RGB color value to HSV
|
|
28128
|
+
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
|
28129
|
+
// *Returns:* { h, s, v } in [0,1]
|
|
28130
|
+
function rgbToHsv(r, g, b) {
|
|
28131
|
+
|
|
28132
|
+
r = bound01(r, 255);
|
|
28133
|
+
g = bound01(g, 255);
|
|
28134
|
+
b = bound01(b, 255);
|
|
28135
|
+
|
|
28136
|
+
var max = mathMax(r, g, b), min = mathMin(r, g, b);
|
|
28137
|
+
var h, s, v = max;
|
|
28138
|
+
|
|
28139
|
+
var d = max - min;
|
|
28140
|
+
s = max === 0 ? 0 : d / max;
|
|
28141
|
+
|
|
28142
|
+
if(max == min) {
|
|
28143
|
+
h = 0; // achromatic
|
|
28144
|
+
}
|
|
28145
|
+
else {
|
|
28146
|
+
switch(max) {
|
|
28147
|
+
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
|
28148
|
+
case g: h = (b - r) / d + 2; break;
|
|
28149
|
+
case b: h = (r - g) / d + 4; break;
|
|
28150
|
+
}
|
|
28151
|
+
h /= 6;
|
|
28152
|
+
}
|
|
28153
|
+
return { h: h, s: s, v: v };
|
|
28154
|
+
}
|
|
28155
|
+
|
|
28156
|
+
// `hsvToRgb`
|
|
28157
|
+
// Converts an HSV color value to RGB.
|
|
28158
|
+
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
|
28159
|
+
// *Returns:* { r, g, b } in the set [0, 255]
|
|
28160
|
+
function hsvToRgb(h, s, v) {
|
|
28161
|
+
|
|
28162
|
+
h = bound01(h, 360) * 6;
|
|
28163
|
+
s = bound01(s, 100);
|
|
28164
|
+
v = bound01(v, 100);
|
|
28165
|
+
|
|
28166
|
+
var i = Math.floor(h),
|
|
28167
|
+
f = h - i,
|
|
28168
|
+
p = v * (1 - s),
|
|
28169
|
+
q = v * (1 - f * s),
|
|
28170
|
+
t = v * (1 - (1 - f) * s),
|
|
28171
|
+
mod = i % 6,
|
|
28172
|
+
r = [v, q, p, p, t, v][mod],
|
|
28173
|
+
g = [t, v, v, q, p, p][mod],
|
|
28174
|
+
b = [p, p, t, v, v, q][mod];
|
|
28175
|
+
|
|
28176
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
28177
|
+
}
|
|
28178
|
+
|
|
28179
|
+
// `rgbToHex`
|
|
28180
|
+
// Converts an RGB color to hex
|
|
28181
|
+
// Assumes r, g, and b are contained in the set [0, 255]
|
|
28182
|
+
// Returns a 3 or 6 character hex
|
|
28183
|
+
function rgbToHex(r, g, b, allow3Char) {
|
|
28184
|
+
|
|
28185
|
+
var hex = [
|
|
28186
|
+
pad2(mathRound(r).toString(16)),
|
|
28187
|
+
pad2(mathRound(g).toString(16)),
|
|
28188
|
+
pad2(mathRound(b).toString(16))
|
|
28189
|
+
];
|
|
28190
|
+
|
|
28191
|
+
// Return a 3 character hex if possible
|
|
28192
|
+
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)) {
|
|
28193
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
28194
|
+
}
|
|
28195
|
+
|
|
28196
|
+
return hex.join("");
|
|
28197
|
+
}
|
|
28198
|
+
|
|
28199
|
+
// `rgbaToHex`
|
|
28200
|
+
// Converts an RGBA color plus alpha transparency to hex
|
|
28201
|
+
// Assumes r, g, b are contained in the set [0, 255] and
|
|
28202
|
+
// a in [0, 1]. Returns a 4 or 8 character rgba hex
|
|
28203
|
+
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
28204
|
+
|
|
28205
|
+
var hex = [
|
|
28206
|
+
pad2(mathRound(r).toString(16)),
|
|
28207
|
+
pad2(mathRound(g).toString(16)),
|
|
28208
|
+
pad2(mathRound(b).toString(16)),
|
|
28209
|
+
pad2(convertDecimalToHex(a))
|
|
28210
|
+
];
|
|
28211
|
+
|
|
28212
|
+
// Return a 4 character hex if possible
|
|
28213
|
+
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)) {
|
|
28214
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
28215
|
+
}
|
|
28216
|
+
|
|
28217
|
+
return hex.join("");
|
|
28218
|
+
}
|
|
28219
|
+
|
|
28220
|
+
// `rgbaToArgbHex`
|
|
28221
|
+
// Converts an RGBA color to an ARGB Hex8 string
|
|
28222
|
+
// Rarely used, but required for "toFilter()"
|
|
28223
|
+
function rgbaToArgbHex(r, g, b, a) {
|
|
28224
|
+
|
|
28225
|
+
var hex = [
|
|
28226
|
+
pad2(convertDecimalToHex(a)),
|
|
28227
|
+
pad2(mathRound(r).toString(16)),
|
|
28228
|
+
pad2(mathRound(g).toString(16)),
|
|
28229
|
+
pad2(mathRound(b).toString(16))
|
|
28230
|
+
];
|
|
28231
|
+
|
|
28232
|
+
return hex.join("");
|
|
28233
|
+
}
|
|
28234
|
+
|
|
28235
|
+
// `equals`
|
|
28236
|
+
// Can be called with any tinycolor input
|
|
28237
|
+
tinycolor.equals = function (color1, color2) {
|
|
28238
|
+
if (!color1 || !color2) { return false; }
|
|
28239
|
+
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
28240
|
+
};
|
|
28241
|
+
|
|
28242
|
+
tinycolor.random = function() {
|
|
28243
|
+
return tinycolor.fromRatio({
|
|
28244
|
+
r: mathRandom(),
|
|
28245
|
+
g: mathRandom(),
|
|
28246
|
+
b: mathRandom()
|
|
28247
|
+
});
|
|
28248
|
+
};
|
|
28249
|
+
|
|
28250
|
+
|
|
28251
|
+
// Modification Functions
|
|
28252
|
+
// ----------------------
|
|
28253
|
+
// Thanks to less.js for some of the basics here
|
|
28254
|
+
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
|
|
28255
|
+
|
|
28256
|
+
function desaturate(color, amount) {
|
|
28257
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28258
|
+
var hsl = tinycolor(color).toHsl();
|
|
28259
|
+
hsl.s -= amount / 100;
|
|
28260
|
+
hsl.s = clamp01(hsl.s);
|
|
28261
|
+
return tinycolor(hsl);
|
|
28262
|
+
}
|
|
28263
|
+
|
|
28264
|
+
function saturate(color, amount) {
|
|
28265
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28266
|
+
var hsl = tinycolor(color).toHsl();
|
|
28267
|
+
hsl.s += amount / 100;
|
|
28268
|
+
hsl.s = clamp01(hsl.s);
|
|
28269
|
+
return tinycolor(hsl);
|
|
28270
|
+
}
|
|
28271
|
+
|
|
28272
|
+
function greyscale(color) {
|
|
28273
|
+
return tinycolor(color).desaturate(100);
|
|
28274
|
+
}
|
|
28275
|
+
|
|
28276
|
+
function lighten (color, amount) {
|
|
28277
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28278
|
+
var hsl = tinycolor(color).toHsl();
|
|
28279
|
+
hsl.l += amount / 100;
|
|
28280
|
+
hsl.l = clamp01(hsl.l);
|
|
28281
|
+
return tinycolor(hsl);
|
|
28282
|
+
}
|
|
28283
|
+
|
|
28284
|
+
function brighten(color, amount) {
|
|
28285
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28286
|
+
var rgb = tinycolor(color).toRgb();
|
|
28287
|
+
rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
|
|
28288
|
+
rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
|
|
28289
|
+
rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
|
|
28290
|
+
return tinycolor(rgb);
|
|
28291
|
+
}
|
|
28292
|
+
|
|
28293
|
+
function darken (color, amount) {
|
|
28294
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28295
|
+
var hsl = tinycolor(color).toHsl();
|
|
28296
|
+
hsl.l -= amount / 100;
|
|
28297
|
+
hsl.l = clamp01(hsl.l);
|
|
28298
|
+
return tinycolor(hsl);
|
|
28299
|
+
}
|
|
28300
|
+
|
|
28301
|
+
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
28302
|
+
// Values outside of this range will be wrapped into this range.
|
|
28303
|
+
function spin(color, amount) {
|
|
28304
|
+
var hsl = tinycolor(color).toHsl();
|
|
28305
|
+
var hue = (hsl.h + amount) % 360;
|
|
28306
|
+
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
28307
|
+
return tinycolor(hsl);
|
|
28308
|
+
}
|
|
28309
|
+
|
|
28310
|
+
// Combination Functions
|
|
28311
|
+
// ---------------------
|
|
28312
|
+
// Thanks to jQuery xColor for some of the ideas behind these
|
|
28313
|
+
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
|
28314
|
+
|
|
28315
|
+
function complement(color) {
|
|
28316
|
+
var hsl = tinycolor(color).toHsl();
|
|
28317
|
+
hsl.h = (hsl.h + 180) % 360;
|
|
28318
|
+
return tinycolor(hsl);
|
|
28319
|
+
}
|
|
28320
|
+
|
|
28321
|
+
function triad(color) {
|
|
28322
|
+
var hsl = tinycolor(color).toHsl();
|
|
28323
|
+
var h = hsl.h;
|
|
28324
|
+
return [
|
|
28325
|
+
tinycolor(color),
|
|
28326
|
+
tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
|
|
28327
|
+
tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
|
|
28328
|
+
];
|
|
28329
|
+
}
|
|
28330
|
+
|
|
28331
|
+
function tetrad(color) {
|
|
28332
|
+
var hsl = tinycolor(color).toHsl();
|
|
28333
|
+
var h = hsl.h;
|
|
28334
|
+
return [
|
|
28335
|
+
tinycolor(color),
|
|
28336
|
+
tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
|
|
28337
|
+
tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
|
|
28338
|
+
tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
|
|
28339
|
+
];
|
|
28340
|
+
}
|
|
28341
|
+
|
|
28342
|
+
function splitcomplement(color) {
|
|
28343
|
+
var hsl = tinycolor(color).toHsl();
|
|
28344
|
+
var h = hsl.h;
|
|
28345
|
+
return [
|
|
28346
|
+
tinycolor(color),
|
|
28347
|
+
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
|
|
28348
|
+
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
|
|
28349
|
+
];
|
|
28350
|
+
}
|
|
28351
|
+
|
|
28352
|
+
function analogous(color, results, slices) {
|
|
28353
|
+
results = results || 6;
|
|
28354
|
+
slices = slices || 30;
|
|
28355
|
+
|
|
28356
|
+
var hsl = tinycolor(color).toHsl();
|
|
28357
|
+
var part = 360 / slices;
|
|
28358
|
+
var ret = [tinycolor(color)];
|
|
28359
|
+
|
|
28360
|
+
for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
|
|
28361
|
+
hsl.h = (hsl.h + part) % 360;
|
|
28362
|
+
ret.push(tinycolor(hsl));
|
|
28363
|
+
}
|
|
28364
|
+
return ret;
|
|
28365
|
+
}
|
|
28366
|
+
|
|
28367
|
+
function monochromatic(color, results) {
|
|
28368
|
+
results = results || 6;
|
|
28369
|
+
var hsv = tinycolor(color).toHsv();
|
|
28370
|
+
var h = hsv.h, s = hsv.s, v = hsv.v;
|
|
28371
|
+
var ret = [];
|
|
28372
|
+
var modification = 1 / results;
|
|
28373
|
+
|
|
28374
|
+
while (results--) {
|
|
28375
|
+
ret.push(tinycolor({ h: h, s: s, v: v}));
|
|
28376
|
+
v = (v + modification) % 1;
|
|
28377
|
+
}
|
|
28378
|
+
|
|
28379
|
+
return ret;
|
|
28380
|
+
}
|
|
28381
|
+
|
|
28382
|
+
// Utility Functions
|
|
28383
|
+
// ---------------------
|
|
28384
|
+
|
|
28385
|
+
tinycolor.mix = function(color1, color2, amount) {
|
|
28386
|
+
amount = (amount === 0) ? 0 : (amount || 50);
|
|
28387
|
+
|
|
28388
|
+
var rgb1 = tinycolor(color1).toRgb();
|
|
28389
|
+
var rgb2 = tinycolor(color2).toRgb();
|
|
28390
|
+
|
|
28391
|
+
var p = amount / 100;
|
|
28392
|
+
|
|
28393
|
+
var rgba = {
|
|
28394
|
+
r: ((rgb2.r - rgb1.r) * p) + rgb1.r,
|
|
28395
|
+
g: ((rgb2.g - rgb1.g) * p) + rgb1.g,
|
|
28396
|
+
b: ((rgb2.b - rgb1.b) * p) + rgb1.b,
|
|
28397
|
+
a: ((rgb2.a - rgb1.a) * p) + rgb1.a
|
|
28398
|
+
};
|
|
28399
|
+
|
|
28400
|
+
return tinycolor(rgba);
|
|
28401
|
+
};
|
|
28402
|
+
|
|
28403
|
+
|
|
28404
|
+
// Readability Functions
|
|
28405
|
+
// ---------------------
|
|
28406
|
+
// <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
|
|
28407
|
+
|
|
28408
|
+
// `contrast`
|
|
28409
|
+
// Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
|
|
28410
|
+
tinycolor.readability = function(color1, color2) {
|
|
28411
|
+
var c1 = tinycolor(color1);
|
|
28412
|
+
var c2 = tinycolor(color2);
|
|
28413
|
+
return (Math.max(c1.getLuminance(),c2.getLuminance())+0.05) / (Math.min(c1.getLuminance(),c2.getLuminance())+0.05);
|
|
28414
|
+
};
|
|
28415
|
+
|
|
28416
|
+
// `isReadable`
|
|
28417
|
+
// Ensure that foreground and background color combinations meet WCAG2 guidelines.
|
|
28418
|
+
// The third argument is an optional Object.
|
|
28419
|
+
// the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
|
|
28420
|
+
// the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
|
|
28421
|
+
// If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
|
|
28422
|
+
|
|
28423
|
+
// *Example*
|
|
28424
|
+
// tinycolor.isReadable("#000", "#111") => false
|
|
28425
|
+
// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
|
|
28426
|
+
tinycolor.isReadable = function(color1, color2, wcag2) {
|
|
28427
|
+
var readability = tinycolor.readability(color1, color2);
|
|
28428
|
+
var wcag2Parms, out;
|
|
28429
|
+
|
|
28430
|
+
out = false;
|
|
28431
|
+
|
|
28432
|
+
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
28433
|
+
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
28434
|
+
case "AAsmall":
|
|
28435
|
+
case "AAAlarge":
|
|
28436
|
+
out = readability >= 4.5;
|
|
28437
|
+
break;
|
|
28438
|
+
case "AAlarge":
|
|
28439
|
+
out = readability >= 3;
|
|
28440
|
+
break;
|
|
28441
|
+
case "AAAsmall":
|
|
28442
|
+
out = readability >= 7;
|
|
28443
|
+
break;
|
|
28444
|
+
}
|
|
28445
|
+
return out;
|
|
28446
|
+
|
|
28447
|
+
};
|
|
28448
|
+
|
|
28449
|
+
// `mostReadable`
|
|
28450
|
+
// Given a base color and a list of possible foreground or background
|
|
28451
|
+
// colors for that base, returns the most readable color.
|
|
28452
|
+
// Optionally returns Black or White if the most readable color is unreadable.
|
|
28453
|
+
// *Example*
|
|
28454
|
+
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
|
|
28455
|
+
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
|
|
28456
|
+
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
|
|
28457
|
+
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
|
|
28458
|
+
tinycolor.mostReadable = function(baseColor, colorList, args) {
|
|
28459
|
+
var bestColor = null;
|
|
28460
|
+
var bestScore = 0;
|
|
28461
|
+
var readability;
|
|
28462
|
+
var includeFallbackColors, level, size ;
|
|
28463
|
+
args = args || {};
|
|
28464
|
+
includeFallbackColors = args.includeFallbackColors ;
|
|
28465
|
+
level = args.level;
|
|
28466
|
+
size = args.size;
|
|
28467
|
+
|
|
28468
|
+
for (var i= 0; i < colorList.length ; i++) {
|
|
28469
|
+
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
28470
|
+
if (readability > bestScore) {
|
|
28471
|
+
bestScore = readability;
|
|
28472
|
+
bestColor = tinycolor(colorList[i]);
|
|
28473
|
+
}
|
|
28474
|
+
}
|
|
28475
|
+
|
|
28476
|
+
if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) {
|
|
28477
|
+
return bestColor;
|
|
28478
|
+
}
|
|
28479
|
+
else {
|
|
28480
|
+
args.includeFallbackColors=false;
|
|
28481
|
+
return tinycolor.mostReadable(baseColor,["#fff", "#000"],args);
|
|
28482
|
+
}
|
|
28483
|
+
};
|
|
28484
|
+
|
|
28485
|
+
|
|
28486
|
+
// Big List of Colors
|
|
28487
|
+
// ------------------
|
|
28488
|
+
// <http://www.w3.org/TR/css3-color/#svg-color>
|
|
28489
|
+
var names = tinycolor.names = {
|
|
28490
|
+
aliceblue: "f0f8ff",
|
|
28491
|
+
antiquewhite: "faebd7",
|
|
28492
|
+
aqua: "0ff",
|
|
28493
|
+
aquamarine: "7fffd4",
|
|
28494
|
+
azure: "f0ffff",
|
|
28495
|
+
beige: "f5f5dc",
|
|
28496
|
+
bisque: "ffe4c4",
|
|
28497
|
+
black: "000",
|
|
28498
|
+
blanchedalmond: "ffebcd",
|
|
28499
|
+
blue: "00f",
|
|
28500
|
+
blueviolet: "8a2be2",
|
|
28501
|
+
brown: "a52a2a",
|
|
28502
|
+
burlywood: "deb887",
|
|
28503
|
+
burntsienna: "ea7e5d",
|
|
28504
|
+
cadetblue: "5f9ea0",
|
|
28505
|
+
chartreuse: "7fff00",
|
|
28506
|
+
chocolate: "d2691e",
|
|
28507
|
+
coral: "ff7f50",
|
|
28508
|
+
cornflowerblue: "6495ed",
|
|
28509
|
+
cornsilk: "fff8dc",
|
|
28510
|
+
crimson: "dc143c",
|
|
28511
|
+
cyan: "0ff",
|
|
28512
|
+
darkblue: "00008b",
|
|
28513
|
+
darkcyan: "008b8b",
|
|
28514
|
+
darkgoldenrod: "b8860b",
|
|
28515
|
+
darkgray: "a9a9a9",
|
|
28516
|
+
darkgreen: "006400",
|
|
28517
|
+
darkgrey: "a9a9a9",
|
|
28518
|
+
darkkhaki: "bdb76b",
|
|
28519
|
+
darkmagenta: "8b008b",
|
|
28520
|
+
darkolivegreen: "556b2f",
|
|
28521
|
+
darkorange: "ff8c00",
|
|
28522
|
+
darkorchid: "9932cc",
|
|
28523
|
+
darkred: "8b0000",
|
|
28524
|
+
darksalmon: "e9967a",
|
|
28525
|
+
darkseagreen: "8fbc8f",
|
|
28526
|
+
darkslateblue: "483d8b",
|
|
28527
|
+
darkslategray: "2f4f4f",
|
|
28528
|
+
darkslategrey: "2f4f4f",
|
|
28529
|
+
darkturquoise: "00ced1",
|
|
28530
|
+
darkviolet: "9400d3",
|
|
28531
|
+
deeppink: "ff1493",
|
|
28532
|
+
deepskyblue: "00bfff",
|
|
28533
|
+
dimgray: "696969",
|
|
28534
|
+
dimgrey: "696969",
|
|
28535
|
+
dodgerblue: "1e90ff",
|
|
28536
|
+
firebrick: "b22222",
|
|
28537
|
+
floralwhite: "fffaf0",
|
|
28538
|
+
forestgreen: "228b22",
|
|
28539
|
+
fuchsia: "f0f",
|
|
28540
|
+
gainsboro: "dcdcdc",
|
|
28541
|
+
ghostwhite: "f8f8ff",
|
|
28542
|
+
gold: "ffd700",
|
|
28543
|
+
goldenrod: "daa520",
|
|
28544
|
+
gray: "808080",
|
|
28545
|
+
green: "008000",
|
|
28546
|
+
greenyellow: "adff2f",
|
|
28547
|
+
grey: "808080",
|
|
28548
|
+
honeydew: "f0fff0",
|
|
28549
|
+
hotpink: "ff69b4",
|
|
28550
|
+
indianred: "cd5c5c",
|
|
28551
|
+
indigo: "4b0082",
|
|
28552
|
+
ivory: "fffff0",
|
|
28553
|
+
khaki: "f0e68c",
|
|
28554
|
+
lavender: "e6e6fa",
|
|
28555
|
+
lavenderblush: "fff0f5",
|
|
28556
|
+
lawngreen: "7cfc00",
|
|
28557
|
+
lemonchiffon: "fffacd",
|
|
28558
|
+
lightblue: "add8e6",
|
|
28559
|
+
lightcoral: "f08080",
|
|
28560
|
+
lightcyan: "e0ffff",
|
|
28561
|
+
lightgoldenrodyellow: "fafad2",
|
|
28562
|
+
lightgray: "d3d3d3",
|
|
28563
|
+
lightgreen: "90ee90",
|
|
28564
|
+
lightgrey: "d3d3d3",
|
|
28565
|
+
lightpink: "ffb6c1",
|
|
28566
|
+
lightsalmon: "ffa07a",
|
|
28567
|
+
lightseagreen: "20b2aa",
|
|
28568
|
+
lightskyblue: "87cefa",
|
|
28569
|
+
lightslategray: "789",
|
|
28570
|
+
lightslategrey: "789",
|
|
28571
|
+
lightsteelblue: "b0c4de",
|
|
28572
|
+
lightyellow: "ffffe0",
|
|
28573
|
+
lime: "0f0",
|
|
28574
|
+
limegreen: "32cd32",
|
|
28575
|
+
linen: "faf0e6",
|
|
28576
|
+
magenta: "f0f",
|
|
28577
|
+
maroon: "800000",
|
|
28578
|
+
mediumaquamarine: "66cdaa",
|
|
28579
|
+
mediumblue: "0000cd",
|
|
28580
|
+
mediumorchid: "ba55d3",
|
|
28581
|
+
mediumpurple: "9370db",
|
|
28582
|
+
mediumseagreen: "3cb371",
|
|
28583
|
+
mediumslateblue: "7b68ee",
|
|
28584
|
+
mediumspringgreen: "00fa9a",
|
|
28585
|
+
mediumturquoise: "48d1cc",
|
|
28586
|
+
mediumvioletred: "c71585",
|
|
28587
|
+
midnightblue: "191970",
|
|
28588
|
+
mintcream: "f5fffa",
|
|
28589
|
+
mistyrose: "ffe4e1",
|
|
28590
|
+
moccasin: "ffe4b5",
|
|
28591
|
+
navajowhite: "ffdead",
|
|
28592
|
+
navy: "000080",
|
|
28593
|
+
oldlace: "fdf5e6",
|
|
28594
|
+
olive: "808000",
|
|
28595
|
+
olivedrab: "6b8e23",
|
|
28596
|
+
orange: "ffa500",
|
|
28597
|
+
orangered: "ff4500",
|
|
28598
|
+
orchid: "da70d6",
|
|
28599
|
+
palegoldenrod: "eee8aa",
|
|
28600
|
+
palegreen: "98fb98",
|
|
28601
|
+
paleturquoise: "afeeee",
|
|
28602
|
+
palevioletred: "db7093",
|
|
28603
|
+
papayawhip: "ffefd5",
|
|
28604
|
+
peachpuff: "ffdab9",
|
|
28605
|
+
peru: "cd853f",
|
|
28606
|
+
pink: "ffc0cb",
|
|
28607
|
+
plum: "dda0dd",
|
|
28608
|
+
powderblue: "b0e0e6",
|
|
28609
|
+
purple: "800080",
|
|
28610
|
+
rebeccapurple: "663399",
|
|
28611
|
+
red: "f00",
|
|
28612
|
+
rosybrown: "bc8f8f",
|
|
28613
|
+
royalblue: "4169e1",
|
|
28614
|
+
saddlebrown: "8b4513",
|
|
28615
|
+
salmon: "fa8072",
|
|
28616
|
+
sandybrown: "f4a460",
|
|
28617
|
+
seagreen: "2e8b57",
|
|
28618
|
+
seashell: "fff5ee",
|
|
28619
|
+
sienna: "a0522d",
|
|
28620
|
+
silver: "c0c0c0",
|
|
28621
|
+
skyblue: "87ceeb",
|
|
28622
|
+
slateblue: "6a5acd",
|
|
28623
|
+
slategray: "708090",
|
|
28624
|
+
slategrey: "708090",
|
|
28625
|
+
snow: "fffafa",
|
|
28626
|
+
springgreen: "00ff7f",
|
|
28627
|
+
steelblue: "4682b4",
|
|
28628
|
+
tan: "d2b48c",
|
|
28629
|
+
teal: "008080",
|
|
28630
|
+
thistle: "d8bfd8",
|
|
28631
|
+
tomato: "ff6347",
|
|
28632
|
+
turquoise: "40e0d0",
|
|
28633
|
+
violet: "ee82ee",
|
|
28634
|
+
wheat: "f5deb3",
|
|
28635
|
+
white: "fff",
|
|
28636
|
+
whitesmoke: "f5f5f5",
|
|
28637
|
+
yellow: "ff0",
|
|
28638
|
+
yellowgreen: "9acd32"
|
|
28639
|
+
};
|
|
28640
|
+
|
|
28641
|
+
// Make it easy to access colors via `hexNames[hex]`
|
|
28642
|
+
var hexNames = tinycolor.hexNames = flip(names);
|
|
28643
|
+
|
|
28644
|
+
|
|
28645
|
+
// Utilities
|
|
28646
|
+
// ---------
|
|
28647
|
+
|
|
28648
|
+
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
|
|
28649
|
+
function flip(o) {
|
|
28650
|
+
var flipped = { };
|
|
28651
|
+
for (var i in o) {
|
|
28652
|
+
if (o.hasOwnProperty(i)) {
|
|
28653
|
+
flipped[o[i]] = i;
|
|
28654
|
+
}
|
|
28655
|
+
}
|
|
28656
|
+
return flipped;
|
|
28657
|
+
}
|
|
28658
|
+
|
|
28659
|
+
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
28660
|
+
function boundAlpha(a) {
|
|
28661
|
+
a = parseFloat(a);
|
|
28662
|
+
|
|
28663
|
+
if (isNaN(a) || a < 0 || a > 1) {
|
|
28664
|
+
a = 1;
|
|
28665
|
+
}
|
|
28666
|
+
|
|
28667
|
+
return a;
|
|
28668
|
+
}
|
|
28669
|
+
|
|
28670
|
+
// Take input from [0, n] and return it as [0, 1]
|
|
28671
|
+
function bound01(n, max) {
|
|
28672
|
+
if (isOnePointZero(n)) { n = "100%"; }
|
|
28673
|
+
|
|
28674
|
+
var processPercent = isPercentage(n);
|
|
28675
|
+
n = mathMin(max, mathMax(0, parseFloat(n)));
|
|
28676
|
+
|
|
28677
|
+
// Automatically convert percentage into number
|
|
28678
|
+
if (processPercent) {
|
|
28679
|
+
n = parseInt(n * max, 10) / 100;
|
|
28680
|
+
}
|
|
28681
|
+
|
|
28682
|
+
// Handle floating point rounding errors
|
|
28683
|
+
if ((Math.abs(n - max) < 0.000001)) {
|
|
28684
|
+
return 1;
|
|
28685
|
+
}
|
|
28686
|
+
|
|
28687
|
+
// Convert into [0, 1] range if it isn't already
|
|
28688
|
+
return (n % max) / parseFloat(max);
|
|
28689
|
+
}
|
|
28690
|
+
|
|
28691
|
+
// Force a number between 0 and 1
|
|
28692
|
+
function clamp01(val) {
|
|
28693
|
+
return mathMin(1, mathMax(0, val));
|
|
28694
|
+
}
|
|
28695
|
+
|
|
28696
|
+
// Parse a base-16 hex value into a base-10 integer
|
|
28697
|
+
function parseIntFromHex(val) {
|
|
28698
|
+
return parseInt(val, 16);
|
|
28699
|
+
}
|
|
28700
|
+
|
|
28701
|
+
// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
|
28702
|
+
// <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
|
28703
|
+
function isOnePointZero(n) {
|
|
28704
|
+
return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
|
|
28705
|
+
}
|
|
28706
|
+
|
|
28707
|
+
// Check to see if string passed in is a percentage
|
|
28708
|
+
function isPercentage(n) {
|
|
28709
|
+
return typeof n === "string" && n.indexOf('%') != -1;
|
|
28710
|
+
}
|
|
28711
|
+
|
|
28712
|
+
// Force a hex value to have 2 characters
|
|
28713
|
+
function pad2(c) {
|
|
28714
|
+
return c.length == 1 ? '0' + c : '' + c;
|
|
28715
|
+
}
|
|
28716
|
+
|
|
28717
|
+
// Replace a decimal with it's percentage value
|
|
28718
|
+
function convertToPercentage(n) {
|
|
28719
|
+
if (n <= 1) {
|
|
28720
|
+
n = (n * 100) + "%";
|
|
28721
|
+
}
|
|
28722
|
+
|
|
28723
|
+
return n;
|
|
28724
|
+
}
|
|
28725
|
+
|
|
28726
|
+
// Converts a decimal to a hex value
|
|
28727
|
+
function convertDecimalToHex(d) {
|
|
28728
|
+
return Math.round(parseFloat(d) * 255).toString(16);
|
|
28729
|
+
}
|
|
28730
|
+
// Converts a hex value to a decimal
|
|
28731
|
+
function convertHexToDecimal(h) {
|
|
28732
|
+
return (parseIntFromHex(h) / 255);
|
|
28733
|
+
}
|
|
28734
|
+
|
|
28735
|
+
var matchers = (function() {
|
|
28736
|
+
|
|
28737
|
+
// <http://www.w3.org/TR/css3-values/#integers>
|
|
28738
|
+
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
28739
|
+
|
|
28740
|
+
// <http://www.w3.org/TR/css3-values/#number-value>
|
|
28741
|
+
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
28742
|
+
|
|
28743
|
+
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
|
28744
|
+
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
28745
|
+
|
|
28746
|
+
// Actual matching.
|
|
28747
|
+
// Parentheses and commas are optional, but not required.
|
|
28748
|
+
// Whitespace can take the place of commas or opening paren
|
|
28749
|
+
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
28750
|
+
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
28751
|
+
|
|
28752
|
+
return {
|
|
28753
|
+
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
28754
|
+
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
28755
|
+
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
28756
|
+
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
28757
|
+
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
28758
|
+
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
28759
|
+
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
28760
|
+
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
28761
|
+
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
28762
|
+
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
28763
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
28764
|
+
};
|
|
28765
|
+
})();
|
|
28766
|
+
|
|
28767
|
+
// `isValidCSSUnit`
|
|
28768
|
+
// Take in a single string / number and check to see if it looks like a CSS unit
|
|
28769
|
+
// (see `matchers` above for definition).
|
|
28770
|
+
function isValidCSSUnit(color) {
|
|
28771
|
+
return !!matchers.CSS_UNIT.exec(color);
|
|
28772
|
+
}
|
|
28773
|
+
|
|
28774
|
+
// `stringInputToObject`
|
|
28775
|
+
// Permissive string parsing. Take in a number of formats, and output an object
|
|
28776
|
+
// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
|
28777
|
+
function stringInputToObject(color) {
|
|
28778
|
+
|
|
28779
|
+
color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
|
|
28780
|
+
var named = false;
|
|
28781
|
+
if (names[color]) {
|
|
28782
|
+
color = names[color];
|
|
28783
|
+
named = true;
|
|
28784
|
+
}
|
|
28785
|
+
else if (color == 'transparent') {
|
|
28786
|
+
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
|
28787
|
+
}
|
|
28788
|
+
|
|
28789
|
+
// Try to match string input using regular expressions.
|
|
28790
|
+
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
|
28791
|
+
// Just return an object and let the conversion functions handle that.
|
|
28792
|
+
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
28793
|
+
var match;
|
|
28794
|
+
if ((match = matchers.rgb.exec(color))) {
|
|
28795
|
+
return { r: match[1], g: match[2], b: match[3] };
|
|
28796
|
+
}
|
|
28797
|
+
if ((match = matchers.rgba.exec(color))) {
|
|
28798
|
+
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
28799
|
+
}
|
|
28800
|
+
if ((match = matchers.hsl.exec(color))) {
|
|
28801
|
+
return { h: match[1], s: match[2], l: match[3] };
|
|
28802
|
+
}
|
|
28803
|
+
if ((match = matchers.hsla.exec(color))) {
|
|
28804
|
+
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
28805
|
+
}
|
|
28806
|
+
if ((match = matchers.hsv.exec(color))) {
|
|
28807
|
+
return { h: match[1], s: match[2], v: match[3] };
|
|
28808
|
+
}
|
|
28809
|
+
if ((match = matchers.hsva.exec(color))) {
|
|
28810
|
+
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
28811
|
+
}
|
|
28812
|
+
if ((match = matchers.hex8.exec(color))) {
|
|
28813
|
+
return {
|
|
28814
|
+
r: parseIntFromHex(match[1]),
|
|
28815
|
+
g: parseIntFromHex(match[2]),
|
|
28816
|
+
b: parseIntFromHex(match[3]),
|
|
28817
|
+
a: convertHexToDecimal(match[4]),
|
|
28818
|
+
format: named ? "name" : "hex8"
|
|
28819
|
+
};
|
|
28820
|
+
}
|
|
28821
|
+
if ((match = matchers.hex6.exec(color))) {
|
|
28822
|
+
return {
|
|
28823
|
+
r: parseIntFromHex(match[1]),
|
|
28824
|
+
g: parseIntFromHex(match[2]),
|
|
28825
|
+
b: parseIntFromHex(match[3]),
|
|
28826
|
+
format: named ? "name" : "hex"
|
|
28827
|
+
};
|
|
28828
|
+
}
|
|
28829
|
+
if ((match = matchers.hex4.exec(color))) {
|
|
28830
|
+
return {
|
|
28831
|
+
r: parseIntFromHex(match[1] + '' + match[1]),
|
|
28832
|
+
g: parseIntFromHex(match[2] + '' + match[2]),
|
|
28833
|
+
b: parseIntFromHex(match[3] + '' + match[3]),
|
|
28834
|
+
a: convertHexToDecimal(match[4] + '' + match[4]),
|
|
28835
|
+
format: named ? "name" : "hex8"
|
|
28836
|
+
};
|
|
28837
|
+
}
|
|
28838
|
+
if ((match = matchers.hex3.exec(color))) {
|
|
28839
|
+
return {
|
|
28840
|
+
r: parseIntFromHex(match[1] + '' + match[1]),
|
|
28841
|
+
g: parseIntFromHex(match[2] + '' + match[2]),
|
|
28842
|
+
b: parseIntFromHex(match[3] + '' + match[3]),
|
|
28843
|
+
format: named ? "name" : "hex"
|
|
28844
|
+
};
|
|
28845
|
+
}
|
|
28846
|
+
|
|
28847
|
+
return false;
|
|
28848
|
+
}
|
|
28849
|
+
|
|
28850
|
+
function validateWCAG2Parms(parms) {
|
|
28851
|
+
// return valid WCAG2 parms for isReadable.
|
|
28852
|
+
// If input parms are invalid, return {"level":"AA", "size":"small"}
|
|
28853
|
+
var level, size;
|
|
28854
|
+
parms = parms || {"level":"AA", "size":"small"};
|
|
28855
|
+
level = (parms.level || "AA").toUpperCase();
|
|
28856
|
+
size = (parms.size || "small").toLowerCase();
|
|
28857
|
+
if (level !== "AA" && level !== "AAA") {
|
|
28858
|
+
level = "AA";
|
|
28859
|
+
}
|
|
28860
|
+
if (size !== "small" && size !== "large") {
|
|
28861
|
+
size = "small";
|
|
28862
|
+
}
|
|
28863
|
+
return {"level":level, "size":size};
|
|
28864
|
+
}
|
|
28865
|
+
|
|
28866
|
+
// Node: Export function
|
|
28867
|
+
if (module.exports) {
|
|
28868
|
+
module.exports = tinycolor;
|
|
28869
|
+
}
|
|
28870
|
+
// AMD/requirejs: Define the module
|
|
28871
|
+
else {
|
|
28872
|
+
window.tinycolor = tinycolor;
|
|
28873
|
+
}
|
|
28874
|
+
|
|
28875
|
+
})(Math);
|
|
28876
|
+
} (tinycolor$1));
|
|
28877
|
+
|
|
28878
|
+
var tinycolorExports = tinycolor$1.exports;
|
|
28879
|
+
var tinycolor = /*@__PURE__*/getDefaultExportFromCjs(tinycolorExports);
|
|
28846
28880
|
|
|
28847
28881
|
const baseLabelClasses = 'tw:left-1 tw:text-xs tw:text-sq-text-color tw:dark:text-sq-dark-text tw:items-center tw:h-4.5';
|
|
28848
28882
|
const ProgressIndicator = (props) => {
|