0

Fun challenge, harder than you think. Given the integer 16744448 as a "color" end up with the color blue.

If you google the color, it shows right as #0080FF, but if you then go to a Decimal to hex converter, you get #FF8000.

I am not sure if one is counted as a "subtractive" color pallette, and the other is "additive", but somehow the number '16744448' which is stored in a database I am accessing relates to the color blue.

Alan
  • 2,046
  • 2
  • 20
  • 43
  • looks to me like it's the same bytes in reverse order. – Barmar Aug 30 '18 at 21:20
  • True, but does that mean the renderer is reading it in reverse, or is it maybe showing it as an additive. We all know yellow and blue makes green, but that is only true in subtractive colors, using a yellow spotlight, and a blue spotlight gets you close to white in additive. – Alan Aug 30 '18 at 21:23
  • Blue should just be `#0000FF`. – Barmar Aug 30 '18 at 21:23
  • But the color I posted is the right shade of blue :) – Alan Aug 30 '18 at 21:23
  • What renderer are you giving the decimal value to? – Barmar Aug 30 '18 at 21:25
  • What do you mean by subtractive color pallette. You don't get `0080FF` if you subtract `FF8000` from `FFFFFF`, you get `007FFF` – Barmar Aug 30 '18 at 21:27
  • This looks like an endianness issue. Your database has the number in little-endian format. – Barmar Aug 30 '18 at 21:29
  • You are right, I had no idea of these other numbering systems. I found the right one here https://www.scadacore.com/tools/programming-calculators/online-hex-converter/ (UINT32 - Little Endian (DCBA)) – Alan Aug 30 '18 at 21:34

1 Answers1

0

The number was stored in a database, to convert it automatically during select I used this:

select  REVERSE(RIGHT(INTTOHEX(16744448),6))
Alan
  • 2,046
  • 2
  • 20
  • 43