Last active
July 5, 2018 22:39
-
-
Save leobetosouza/23f24b89531c6701d84d8255c1ec9268 to your computer and use it in GitHub Desktop.
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
const transparentize = (r, g, b, alpha) => { | |
const a = (1 - alpha) * 255; | |
const calc = x => Math.round((x - a)/alpha); | |
return `rgba(${calc(r)}, ${calc(g)}, ${calc(b)}, ${alpha})`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment