How to change the color depth to 256 colors?

I guess DirectX shud be used?