Changing Palettes in FemtoIDE
In your code …
The Pokitto library contains a number of colour palettes that cover a range of common platforms. By default, the Pokitto uses the CGA palette which is adequate but not inspiring. To change to a different palette, say Pico8, follow these instructions.
Navigate to the main.cpp
file. You may see the loadRGBPalette()
command as shown below or not depending on whether the program uses the default CGA palette or not.
using PC = Pokitto::Core;
using PD = Pokitto::Display;
int main() {
PC::begin();
PD::loadRGBPalette(paletteCGA);
…
}
To use the Pico8 palette, simply change or add this line :
PD::loadRGBPalette(palettePico);
In Piskel …
But this is only half of it! The FemtoIDE compiles contains an embedded Piskel editor. To ensure that Piskel knows about your new palette, download a .PAL file from the internet (try here > https://lospec.com/palette-list/pico-8) and import it for use.
- Step 1 In the Piskel editor, you see there is a palette selector and by default it is set to color-graphics-adaptor and that you can scroll through other loaded palettes. Unfortunately, there are no others, so you need to load one.
-
Step 2. Click the plus symbol to add a new palette. This will reveal the Create Palette dialogue.
-
Step 3 . Click on Import from file and load the .PAL file you downloaded from the internet. You will now see the colours in the Pico8 palette – much nicer than CGA – and you can give the palette a meaningful name. Click Save to complete the action.
-
Step 4 . Select the newly created palette from the palette selector. From now on, anything you draw in Piskel will be in the Pico8 palette.
In the FemtoIDE’s Automatic Image Compilation …
Finally, the FemtoIDE has a powerful feature that compiles graphics automatically into data files that can then be directly incorporated into your game. This feature uses a setting in the My_settings.h file and the default values are shown below.
{
"lastBuffer": "main.cpp",
"PNGFlags": {
"ALL": [ "palette=${appPath}/PokittoLib/Pokitto/POKITTO_CORE/PALETTES/palCGA.cpp"
]
},
…
To use the Pico8 palette, change the palette name as shown below.
{
"lastBuffer": "main.cpp",
"PNGFlags": {
"ALL": [
"palette=${appPath}/PokittoLib/Pokitto/POKITTO_CORE/PALETTES/palPico.cpp"
]
},
…
Details of the standard Pokitto palettes can be found here .