Python RGB to Hex number (not a string!)

-5

I need to convert R, G, B colour values into 0xrrggbb format. Yes, there are a lot of solutions out there, but they all return "0xrrggbb" (a string) rather than 0xrrggbb (a hex number).

What are the options to achieve this, please?

Edit: to clarify what I'm trying to achieve: I'm reading RGB values from a GIF (using PIL), converting them to hex and storing in a list.

Neopixels require data in the following format: ledNumber[i] = 0xdeadbeef The hex value cannot be a string, so I need a way to convert the RGB values to hex whilst keeping it as a number.

I hope this clarifies.

python
hex
rgb
neopixel
asked on Stack Overflow Feb 11, 2020 by wibbleface • edited Feb 11, 2020 by wibbleface

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0