VGA mode 13h palette export option

I’d like option to export (and edit) palettes in format suitable for DOS VGA Mode 13h where each color is 6 bit (0-63) per channel instead of 8 bit (0-255).

Converting from 8bit palette to 6 bit palette is easy (just do an integer division by 4), but here where ability to edit such palettes comes into play:

The fact is, that there is information loss involved in it which makes possible for several indexes next to each other (especially in gradients) to hold the same color (a.k.a. waste of space if you didn’t intend for it to be the case), so stuff like gradient generator should be aware if the user wants to use 6bit colors (or any other bitage) so it won’t generate colors as part of a gradient that would be the same.

Ditto for the RGB/HSV sliders, you don’t want to accidentally go over 63. Also it should still display colors correctly so to for display palette values should be multiplied by 4.

This is a typical RGB 555 mode. You can set this up easily with an existing project (menu Color->Modify Channel Bit Depth…) or you can create a project preset that includes this settings using the project preset management that is available via the “new project” dialog.

All color functions will respect this setting the way you mentioned it.

Doesn’t 555 refer to bits per channel? If so, it’s one bit short (VGA 13h is 6 bits per channel, 0…63, not 5 bit, 0…31).

Uhm, yes, I meant 666. With the settings mentioned you can scale any channel to 2-8 Bits.

Yeah, but I don’t know how to do it for the palette itself, when I export the palette as a .pal file and then inspect it with a hex editor, I still get values outside 0…63 range.

Yes, that’s normal. The file formats all use 8Bit per channel by definition. Reducing the values would lead to a darkened image.
You now need to divide the values by 4 when using the image and palette data in your special environment. The channel settings only ensure that you don’t have more then x different values per channel so that dividing the value does not result in a color change. Of course this is not 100% sure, especially not if you use different values per channel.