mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
* transparent + reactive background colors * refactor header to not set its own background color * make terms not set background color * dramatically improve tab borders * remove background color from electron windows * Revert "remove background color from electron windows" This reverts commit ca4de3c5dc28095f1a598f7ac79d4dff4b66ccd5. * put alpha first for electron * remove initial bg color setting, but maintain reactive one * fix
14 lines
478 B
JavaScript
14 lines
478 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 (1 !== color.alpha()) {
|
|
// (╯°□°)╯︵ ┻━┻
|
|
return '#' + Math.floor(color.alpha() * 100) + color.hexString().substr(1);
|
|
} else {
|
|
return color.hexString();
|
|
}
|
|
};
|