Created
November 24, 2017 23:36
-
-
Save ChillyBwoy/ead83870f244e69a0106d391bddb1635 to your computer and use it in GitHub Desktop.
Invert RGB color
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 invertColor = (hex: string) => [ | |
(x: string) => parseInt(x.substring(1), 16), | |
(x: number) => 0xFFFFFF ^ x, | |
(x: number) => `000000${x.toString(16)}`.slice(-6), | |
(x: string) => `#${x}`, | |
].reduce((acc, f: (...args: any[]) => any) => f(acc), hex); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment