Skip to content

Instantly share code, notes, and snippets.

@OrderAndCh4oS
Created March 9, 2020 09:05
Show Gist options
  • Save OrderAndCh4oS/2307a397f34ebdfb1cbc65860a12c055 to your computer and use it in GitHub Desktop.
Save OrderAndCh4oS/2307a397f34ebdfb1cbc65860a12c055 to your computer and use it in GitHub Desktop.
r = 0xff;
g = 0xff;
b = 0xff;
rgb = (r << 16) | (g << 8) | b;
console.log(rgb);
red = (rgb >> 16) & 0x0ff;
green = (rgb >> 8) & 0x0ff;
blue = (rgb) & 0x0ff;
console.log(red);
console.log(green);
console.log(blue);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment