Skip to content

Instantly share code, notes, and snippets.

@ChillyBwoy
Created November 24, 2017 23:36
Show Gist options
  • Save ChillyBwoy/ead83870f244e69a0106d391bddb1635 to your computer and use it in GitHub Desktop.
Save ChillyBwoy/ead83870f244e69a0106d391bddb1635 to your computer and use it in GitHub Desktop.
Invert RGB color
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