Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

Super Nintendo/Color: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
m (RGB, not RBG)
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Colors in SNES games are stored in two-byte words using the RGB color model. Relative contents of red, green, and blue are determined by five bits each. This allows for 32 shades of each primary color and 32768 colors total. The most significant bit of the high byte is not used to determine a color, but could be used for other purposes at the will of game programmers. This bit is followed by the five blue bits, the five green bits (spanning across the bytes), then the five red bits.
{{subpage}}


===Examples===
Colors in [[Super Nintendo Entertainment System|SNES]] games (as well as [[Game Boy Color]], [[Nintendo Game Boy Advance|Game Boy Advance]], and [[Super Game Boy]] games) are stored in two-byte [[Binary#Word|words]] using the [[Wikipedia:RGB color model|RGB color model]]. The brightness of the red, green, and blue components are determined by five bits each. This allows for 32 shades of each primary color and 32 768 colors total. The most significant bit of the high byte is not used to determine a color, but could be used for other purposes at the will of game programmers. This bit is followed by the five blue bits, the five green bits (spanning across the bytes), then the five red bits.
The color word $5588 is written in binary as 01010101 10001000, resulting in the values 10101, 01100, and 01000 for blue, green, and red respectively. Noting that the maximum value for a primary color is 11111, we have relative values of 8/32 red, 12/32 green, and 21/32 blue. To see what this color would look like, convert this to standard 24-bit RGB color by multiplying each value by eight (256/32). This yields the 24-bit RGB color 64, 96, 168, which is <span style="color: #4060A8">a metallic shade of blue</span>. Remember that the color word $5588 would appear in an SNES ROM as 88 55 since the SNES is little-[[Endianness|endian]].
 
==Examples==
The color word 0x5588 is written in [[binary]] as 01010101 10001000, resulting in the values 10101, 01100, and 01000 for blue, green, and red respectively. Noting that the maximum value for a primary color is 11111, we have relative values of 8/32 red, 12/32 green, and 21/32 blue. To see what this color would look like, convert this to standard 24-bit RGB color by multiplying each value by eight (256/32). This yields the 24-bit RGB color 64, 96, 168, which is <span style="color: #4060A8">a metallic shade of blue</span>. Remember that the color word 0x5588 would appear in an SNES ROM as 88 55 because the SNES is little-[[Endianness|endian]].
 
[[Category:Super Nintendo|Color]]

Latest revision as of 15:00, 24 January 2024

This is a sub-page of Super Nintendo.

Colors in SNES games (as well as Game Boy Color, Game Boy Advance, and Super Game Boy games) are stored in two-byte words using the RGB color model. The brightness of the red, green, and blue components are determined by five bits each. This allows for 32 shades of each primary color and 32 768 colors total. The most significant bit of the high byte is not used to determine a color, but could be used for other purposes at the will of game programmers. This bit is followed by the five blue bits, the five green bits (spanning across the bytes), then the five red bits.

Examples

The color word 0x5588 is written in binary as 01010101 10001000, resulting in the values 10101, 01100, and 01000 for blue, green, and red respectively. Noting that the maximum value for a primary color is 11111, we have relative values of 8/32 red, 12/32 green, and 21/32 blue. To see what this color would look like, convert this to standard 24-bit RGB color by multiplying each value by eight (256/32). This yields the 24-bit RGB color 64, 96, 168, which is a metallic shade of blue. Remember that the color word 0x5588 would appear in an SNES ROM as 88 55 because the SNES is little-endian.