The 5 or 6-bpp 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 0s.
With displays that use 5 or 6 bpp, you can choose either to palettize the colors or to use the bits in the pixel to represent the colors directly. For example, you can make 6 bpp a 64-entry palettized display, or you can use the 6 bits in each pixel to represent four levels each of red, green, and blue directly. The following illustration shows the arrangement of memory for the format.