mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
* Bump `eslint-plugin-react`
* Add `eslint-config-xo-react`
* Add XO
* Remove eslint-related dependencies, add XO config and use XO as the linter
* Code style: Standard => XO ✨
* Use xo property to ignore files
* Fix remaining errors
13 lines
462 B
JavaScript
13 lines
462 B
JavaScript
const Color = require('color');
|
|
|
|
// returns a background color that's in hex
|
|
// format including the alpha channel (e.g.: `#00000050`)
|
|
// input can be any css value (rgb, hsl, string…)
|
|
module.exports = function toElectronBackgroundColor(bgColor) {
|
|
const color = Color(bgColor);
|
|
if (color.alpha() === 1) {
|
|
return color.hexString();
|
|
}
|
|
// (╯°□°)╯︵ ┻━┻
|
|
return '#' + Math.floor(color.alpha() * 100) + color.hexString().substr(1);
|
|
};
|