LoginLogin

Text colors: What the actual crap is going on?

Root / Programming Questions / [.]

MZ952Created:
I'm pretty sure that at one point I knew how to do this, but I guess I forgot it, because I'm in trouble. So, FONTDEF, you can specify the color of a pixel with a hexadecimal string in the RGBA format, ex., F801, where—and I quote the help guide here—there are "5 bits for each RGB color (0-31) + alpha channel 1 bit (0: Transparent, 1: Opaque)" Okay, this is where my understanding breaks down. &HFF01 produces yellow pixels (15 in the red channel, 15 in the green channel, hoorah), yet, &H8801 produces dark red pixels (???) where I expected a slightly dimmer shade of yellow. It also seems that changing the alpha bit to something other than it's specified 1 bit state, say, F, changes the color in some way too (it literally states in the manual that the alpha is handled as a single bit). To make matters more degenerate in understanding, the manual also states that each RGB channel is handled as 5 bits, while F, "15," does not need 5 bits to define—it needs four. An extra straggler in the 2^4's place? Is it appending the alpha bit onto each RGB channel? What's going on here? All I'm trying to do is make a grey color lol How the actual crap does this work?


A picture's worth a thousand lines of code. The method just seems odd to me, but when I step back it doesn't look like there's a better way. Yeah, this all makes a lot more sense now, thanks