Five or Six bits-per-pixel format should always use a whole byte for each pixel. The relevant bits must be the low-order bits in the pixel, with unused high-order bits containing zeros.
Displays which use five or six bits per pixel can either be palettized or can use the bits in the pixel to directly represent colors. For example, six bits per pixel could either be a 64 entry palettized display or could use the six bits in each pixel to directly represent four levels each of red, green, and blue. Memory for this format can be arranged like this: