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