mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Fix a bug related to the alpha hex calculation (#1048)
This commit is contained in:
parent
c7f195ba01
commit
f2ffafbd10
1 changed files with 4 additions and 2 deletions
|
|
@ -8,6 +8,8 @@ module.exports = bgColor => {
|
|||
if (color.alpha() === 1) {
|
||||
return color.hexString();
|
||||
}
|
||||
// (╯°□°)╯︵ ┻━┻
|
||||
return '#' + Math.floor(color.alpha() * 100) + color.hexString().substr(1);
|
||||
|
||||
// http://stackoverflow.com/a/11019879/1202488
|
||||
const alphaHex = Math.round(color.alpha() * 255).toString(16);
|
||||
return '#' + alphaHex + color.hexString().substr(1);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue