-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
client: Do not use spectrum for colorpicker
It is unmaintained, depends on jQuery and Parcel no longer wants to parse its CSS (asterisk hack before display property for IE 7 support). We need to use popper/floating-ui to correctly position the popup since the sidebar it is in has `position: fixed` and `overflow: hidden`.
- Loading branch information
Showing
14 changed files
with
276 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Get dark OR bright color depending the color contrast. | ||
* | ||
* @param string hexColor color (hex) value | ||
* @param string darkColor dark color value | ||
* @param string brightColor bright color value | ||
* | ||
* @return string dark OR bright color value | ||
* | ||
* @see https://24ways.org/2010/calculating-color-contrast/ | ||
*/ | ||
export function colorByBrightness(hexColor, darkColor = '#555', brightColor = '#EEE') { | ||
// Strip hash sign. | ||
const color = hexColor.substr(1); | ||
const r = parseInt(color.substr(0, 2), 16); | ||
const g = parseInt(color.substr(2, 2), 16); | ||
const b = parseInt(color.substr(4, 2), 16); | ||
const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; | ||
return yiq >= 128 ? darkColor : brightColor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.