Created
February 16, 2023 17:07
-
-
Save samk-dev/412e590b8058408d7b3f102a6bd82572 to your computer and use it in GitHub Desktop.
get current background contrast && set font color accordingly
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
const contrast: string = r * 0.299 + g * 0.587 + b * 0.114 > 186 ? 'black' : 'white' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment