Skip to content

GraphicsPalette

Narta Xaymar Dirks edited this page Oct 29, 2026 · 1 revision

GraphicsPalette

GraphicsPalette:Void imagefile:String
Parameter Mode Type Default Description
imagefile In String required A picture file of exactly 16 by 16 pixels (any format that LoadImage reads), or an empty string for the default palette. Any other size stops the program with an error message.

Description

Sets the 256 colors that a Graphics or Graphics3D window with a depth of 8 shows. The picture is a lookup table of 16 by 16 pixels, and the pixel at x,y is the color with the number y * 16 + x. 3D drawing is lit, fogged and then made into the color of the palette that is nearest (the smallest distance in red, green and blue) by the fragment shader, so lighting and fog happen in full color and what is stored are palette colors; with Dither 2, blended things are blended with what the buffer holds, in palette colors. 2D drawing, and blends that Dither 2 does not do, are made into palette colors when the picture is shown, and what ReadPixel and the other commands read from the front and back buffer has palette colors as well. With Dither on, the noise that is added before the nearest color is picked is one step of the palette for each channel, so that gradients become a pattern instead of bands. The default palette has all colors of 3 bits of red, 3 of green and 2 of blue, from 0,0,0 to 255,255,255, in the order of the bits RRRGGGBB. GraphicsPalette can be called before or after Graphics and changes what is shown with the next picture. This is a BlitzLLVM extension: the original has no such command, and its palette modes are not supported. See Color depth.

Related Commands

EndGraphics, Graphics, GraphicsDepth, GraphicsFormat, GraphicsHeight, GraphicsLost, GraphicsWidth

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally