Eye of the Beholder Palette Format
| Format type | Palette | 
|---|---|
| Hardware | VGA | 
| Colour depth | 18-bit | 
| Number of colours | 256 | 
| Games | 
Eye of the Beholder uses a 6-bit RGB 256-colour palette.
PC version of Eye of the Beholder I
The .PAL and .COL files used in the PC version of EOB I differ slightly from the standard format in that all bytes in the files must be bit-shifted two bits to the left.
Example:
The 4th byte in the file BRICK.PAL, which holds the red channel for the second colour in the palette, reads EA in hexadecimal or 11101010 in binary.
Bit-shifted, it becomes 10101000 or A8 in hex, which is the correct value.
Bit-shifting vs. mathematical scaling
While the above shifting gives visually acceptable results, it is not strictly mathematically correct.
For example, full white in 6-bit RGB (00111111) becomes 11111100 when bit-shifted, which is no longer full white in 8-bit RGB.
For accurate colour intensities, the following formula should be used:
8bitRGB = (6bitRGB & 0x3F) * 255 / 63
Java code to read .PAL files (EOB I PC version)
 
import java.io.*;
public class PAL {
    private byte[] m_rawData;
    public byte[][] m_palette;
    public PAL(String filename) throws IOException {
        File f = new File(filename);
        long fileSize = f.length();
        m_rawData = new byte[(int) fileSize];
        FileInputStream fis = new FileInputStream(filename);
        int tr = fis.read(m_rawData);
        fis.close();
        m_palette = new byte[(int) (fileSize / 3)][3];
        for (int i = 0; i < m_palette.length; i++) {
            m_palette[i][0] = (byte) Math.round(((m_rawData[i * 3] & 0x3F) * 255.0f / 63));
            m_palette[i][1] = (byte) Math.round(((m_rawData[1 + i * 3] & 0x3F) * 255.0f / 63));
            m_palette[i][2] = (byte) Math.round(((m_rawData[2 + i * 3] & 0x3F) * 255.0f / 63));
        }
    }
}
Sources
https://web.archive.org/web/20180516034756/http://eob.wikispaces.com/eob.pal