Skip to content

Modify Makefile - remove transparent color from rgbgfx palette - #203

Merged
avivace merged 3 commits into
gbdev:masterfrom
Simon-Hed:master
Nov 3, 2026
Merged

avivace merged 3 commits into
gbdev:masterfrom
Simon-Hed:master

Conversation

@Simon-Hed

Copy link
Copy Markdown
Contributor

In Tutorial part III the makefile generates an rgbgfx instruction with four colors for sprites with transparent pixels.

Up until recently: specifying a four-color palette in rgbgfx -c with images containing transparent pixels would somehow work in this tutorial.
After updating to RGBDS_v1.0.4: it would result in an error.

Example:
rgbgfx -c "#FFFFFF,#cfcfcf,#686868,#000000;" --columns -o .\src\generated\sprites\player-ship.2bpp .\src\resources\sprites\player-ship.png error: Each palette spec can only contain up to 3 colors plus the implict transparent color Conversion aborted after 1 error

The fix: rgbgfx -c forces color 0 of every palette to be transparent in the case of images with transparent pixels. Only the three non-transparent colors should be specified. This means removing the first color #FFFFFF when makefile generates sprites.

In sprite generation command: removed the index 0 color use for transparency (here #FFFFF) from the palette.
@avivace
avivace requested review from Rangi42 and avivace November 2, 2026 09:15

@Rangi42 Rangi42 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using an explicit #none as the first color is the most reliable solution here.

RGBGFX 1.0.4 "fixed omitting a transparent color from explicitly-specified palettes if the image has transparency". So 3-color -c palettes for an image with transparent pixels will work in 1.0.4, but not 1.0.3 and below. Likewise, a 4-color -c palette for an image with transparent pixels (i.e. a fifth color) will not work work in 1.0.4 (and it ever working was a bug).

Here's what happens with a 4-color palette:
image

And a 3-color palette:
image

And a 4-entry palette with #none:
image

#none has been supported ever since RGBDS 0.8.0 in 2024.

Comment thread galactic-armada/Makefile Resolved
Use #none as the first color instead of removing it. This  maintains compatiblity with previous rgbgfx versions.

Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com>

@avivace avivace left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Rangi42 and @Simon-Hed !

@avivace
avivace merged commit 444ae57 into gbdev:master Nov 3, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants