Thread: Vapoursynth
View Single Post
Old 14th June 2018, 21:26   #3132  |  Link
hBIkOa7m
Registered User
 
Join Date: Feb 2016
Posts: 6
Quote:
Originally Posted by lansing View Post
After some searches I've found a 2 liner function for this in stackflow
You do realise hexadecimal colours are already 0xRRGGBB? It's just stacked in base16 instead of split into a list of base10. You can just shift the input value to access the colour without any fancy stuff. Dumb example Python code.

Code:
input_hex = 0x53aadf
r = (input_hex >> 16) & 0xFF # 83
g = (input_hex >> 8) & 0xFF # 170
b = (input_hex >> 0) & 0xFF # 223

Last edited by hBIkOa7m; 15th June 2018 at 20:11. Reason: Fixed comments at EOL to use # rather than //. Wrote sample code in the forum and didn't run it.
hBIkOa7m is offline   Reply With Quote