HAM Documentation

Home · Downloads · Your Account · Submit News

Documentation Homepage HAMLib reference Back to HAM Homepage |

# Color Palette Manipulation Functions

## Functions

void | ham_SetBgPalCol (u8 color_number, u16 rgb_value)
| Set a specific BG palette color to a 15 bit BGR value
void | ham_SetBgPalColRGB (u8 color_number, u8 r, u8 g, u8 b)
| Set a specific BG palette color to a RGB value of your choice
void | ham_SetObjPalCol (u8 color_number, u16 rgb_value)
| Set a specific OBJ Palette color to a 15 bit BGR value
void | ham_SetObjPalColRGB (u8 color_number, u8 r, u8 g, u8 b)
| Set a specific OBJ palette color to a RGB value of your choice
void | ham_LoadBGPal (void *src, u16 size_u16s)
| Load new colors into the 256 color BG palette
void | ham_LoadBGPal256 (void *src)
| Load full 256 color palette into BG palette
void | ham_LoadObjPal (void *src, u16 size_u16s)
| Load new colors into the 256 color OBJ (Sprite) palette
void | ham_LoadObjPal256 (void *src)
| Load full 256 color palette into OBJ (Sprite) palette
void | ham_LoadBGPal16 (void *src, u8 pal_no)
| Load new colors into one 16 color BG palette
void | ham_LoadObjPal16 (void *src, u8 pal_no)
| Load new colors into one 16 color OBJ (Sprite) palette
void | ham_FadePal (u8 palno, s8 delta_per_call)
| Fade a 256 color palette to all white or black
u8 | ham_FadePalCol (u16 colno, s8 delta_per_call)
| Fade a specific color in a color palette to all white or black

## Function Documentation

void ham_FadePal | ( | u8 | palno,
|  | s8 | delta_per_call
| ) |

Fade a 256 color palette to all white or black

Parameters:

  palno | 0 = Fade the BG Palette 1 = Fade the OBJ Palette
  delta_per_call | A Signed Integer number that specifies how many levels should be added/subtracted per call

See also: ham_LoadObjPal() ham_LoadBgPal()

u8 ham_FadePalCol | ( | u16 | colno,
|  | s8 | delta_per_call
| ) |

Fade a specific color in a color palette to all white or black

Parameters:

  colno | BG color number to fade in/out (0..255)
  delta_per_call | A Signed Integer number that specifies how many levels should be added/subtracted per call

See also: ham_LoadObjPal() ham_LoadBgPal()

void ham_LoadBGPal | ( | void * | src,
|  | u16 | size_u16s
| ) |

Load new colors into the 256 color BG palette

Parameters:

  src | The pointer to the palette color data (colors need to be defined in 15bit 5:5:5 BGR format and span 16bit each)
  size_u16s | The number of colors to load from color 0 on (to load a complete palette, put 256)

See also: ham_InitBg() ham_LoadObjPal() ham_SetBgMode()

void ham_LoadBGPal16 | ( | void * | src,
|  | u8 | pal_no
| ) |

Load new colors into one 16 color BG palette

Parameters:

  src | The pointer to the palette color data (colors need to be defined in 15bit 5:5:5 BGR format and span 16bit each)
  pal_no | The 16 color palette number you want to modify (0..15)

This will load 32 bytes (16 color entries of 16bits each) into the BG palette number specified.

See also: ham_LoadBgPal() ham_InitBg() ham_InitTileSet() ham_SetBgMode()

void ham_LoadBGPal256 | ( | void * | src | ) |

Load full 256 color palette into BG palette

Parameters:

  src | The pointer to the palette color data (colors need to be defined in 15bit 5:5:5 BGR format and span 16bit each)

See also: ham_InitBg() ham_LoadBGPal() ham_LoadObjPal() ham_SetBgMode()

void ham_LoadObjPal | ( | void * | src,
|  | u16 | size_u16s
| ) |

Load new colors into the 256 color OBJ (Sprite) palette

Parameters:

  src | The pointer to the palette color data (colors need to be defined in 15bit 5:5:5 BGR format and span 16bit each)
  size_u16s | The number of colors to load from color 0 on (to load a complete palette, put 256)

See also: ham_InitBg() ham_LoadBGPal() ham_CreateObj() ham_SetBgMode()

void ham_LoadObjPal16 | ( | void * | src,
|  | u8 | pal_no
| ) |

Load new colors into one 16 color OBJ (Sprite) palette

Parameters:

  src | The pointer to the palette color data (colors need to be defined in 15bit 5:5:5 BGR format and span 16bit each)
  pal_no | The 16 color palette number you want to modify (0..15)

This will load 32 bytes (16 color entries of 16bits each) into the OBJ palette number specified.

See also: ham_LoadObjPal() ham_CreateObj()

void ham_LoadObjPal256 | ( | void * | src | ) |

Load full 256 color palette into OBJ (Sprite) palette

Parameters:

  src | The pointer to the palette color data (colors need to be defined in 15bit 5:5:5 BGR format and span 16bit each)

See also: ham_InitBg() ham_LoadBGPal() ham_CreateObj() ham_SetBgMode()

void ham_SetBgPalCol | ( | u8 | color_number,
|  | u16 | rgb_value
| ) |

Set a specific BG palette color to a 15 bit BGR value

Parameters:

  color_number | The color you want to modify
  rgb_value | The BGR color value in GBA color format ( 5 bit blue, 5 bit green, 5 bit red)

Either feed the function the 15bit BGR value, or use some predefined colors:

- COLOR_BLACK
- COLOR_MAROON
- COLOR_GREEN
- COLOR_OLIVE
- COLOR_NAVY
- COLOR_PURPLE
- COLOR_TEAL
- COLOR_GRAY
- COLOR_SILVER
- COLOR_RED
- COLOR_LIME
- COLOR_YELLOW
- COLOR_BLUE
- COLOR_FUCHSIA
- COLOR_WHITE
- COLOR_MONEYGREEN
- COLOR_SKYBLUE
- COLOR_CREAM
- COLOR_MEDGRAY

See also: ham_InitBg()

void ham_SetBgPalColRGB | ( | u8 | color_number,
|  | u8 | r,
|  | u8 | g,
|  | u8 | b
| ) |

Set a specific BG palette color to a RGB value of your choice

Parameters:

  color_number | The color you want to modify
  r | The desired Red intensity (0-255)
  g | The desired Green intensity (0-255)
  b | The desired Blue intensity (0-255)

See also: ham_InitBg()

void ham_SetObjPalCol | ( | u8 | color_number,
|  | u16 | rgb_value
| ) |

Set a specific OBJ Palette color to a 15 bit BGR value

Parameters:

  color_number | The color you want to modify
  rgb_value | The BGR color value in GBA color format ( 5 bit blue, 5 bit green, 5 bit red)

Either feed the function the 15bit BGR value, or use some predefined colors:

- COLOR_BLACK
- COLOR_MAROON
- COLOR_GREEN
- COLOR_OLIVE
- COLOR_NAVY
- COLOR_PURPLE
- COLOR_TEAL
- COLOR_GRAY
- COLOR_SILVER
- COLOR_RED
- COLOR_LIME
- COLOR_YELLOW
- COLOR_BLUE
- COLOR_FUCHSIA
- COLOR_WHITE
- COLOR_MONEYGREEN
- COLOR_SKYBLUE
- COLOR_CREAM
- COLOR_MEDGRAY

See also: ham_CreateObj()

void ham_SetObjPalColRGB | ( | u8 | color_number,
|  | u8 | r,
|  | u8 | g,
|  | u8 | b
| ) |

Set a specific OBJ palette color to a RGB value of your choice

Parameters:

  color_number | The color you want to modify
  r | The desired Red intensity (0-255)
  g | The desired Green intensity (0-255)
  b | The desired Blue intensity (0-255)

See also: ham_CreateObj()

Documentation Homepage | HAMLib reference | Back to HAM Homepage
documentation created with Doxygen