Created
February 4, 2020 09:15
-
-
Save danhollick/dec1034d80def763c7d94ba9bc4e0e30 to your computer and use it in GitHub Desktop.
Calculation with side effects
This file contains hidden or 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
function calculateAndSendContrast(foreground, alpha, backgound) { | |
// ... | |
let contrast = foregroundLuminance / backgroundLuminance | |
if (backgroundLuminance > foregroundLuminance) { | |
contrast = 1 / contrast | |
} | |
contrast = Math.floor(contrast * 100) / 100 | |
return sendContrastInfo(contrast, foreground, backgound) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment