I have an 8 bit color code in binary like so (RRRGGGBB):
I need to be able to convert it into a hex code (e.g FFFFFF). What is the best way to convert an 8 bit color code into hex?
Nobody here can decide from things presented in the question how to conversion should be made, because you gave zero info of the used coding. The bits can be for ex. indexes in a color table.
Your bits are truncated from 8 bit rgb numbers. R and G have both 3 most significant bits left and B has only 2:
I inserted zeros but as well the colored bits could be selected with some other rule assuming they were truncated.
As said, this was a guess and it can be totally wrong.If you make artistic designs for a game system a programmer who works in the engine room side surely can help.
If it happens that you cannot see any connection between bits 1100 and hex number C you should start by learning binary number system and the presentation of binary numbers with hex numbers.
A little more probable guess. It maps RRRGGGBB=00000000 to hex 000000 and RRRGGGBB=11111111 to hex FFFFFF and rounds the intermediate values.
Two bit BB can be 00, 01, 10 or 11. Use for them decimal blue values 0, 85, 170 and 255 or as well hex values 00, 55, AA and FF.
RRR and GGG can have values 0...7 in decimal. Multiply that decimal value by 255 and divide the result by 7. Round to the nearest integer and convert to hexadecimal.