#Caluclating leather armor color

1 messages · Page 1 of 1 (latest)

mystic viper
#

How do i convert RGB values to the decimal format used to define the color of armor?
There are tons of converters online but none of them describes the math behind it lol
I'm currently using (r * 256 * 256) + (g * 256) + b which i found somewhere on stackoverflow but that doesn't seem to work correctly

vapid grotto
#
def to_armor(r, g, b):
  return (r << 16) | (g << 8) | b
ornate oak
#

Formula for that is r << 16 + g << 8 + b

rapid pilot
#

I've never seen a bitwise operator in action before.

#

I always wondered when they would be useful.

vapid grotto
#

they're quite useful

#

sometimes

mystic viper
#

yea that works thank youu

foggy mulch
foggy mulch
#

Ok thanks !