desktop color depth

when I’m altering the screen resolution i would like to leave the current color depth intact and this works fine but how would i find out what depth i’m at?

In Windows, simply use GetDeviceCaps with the display context and get COLORRES.