Fix dialog colours on OS X (and minor fixes other platforms)

These changes fix the many issues with dialog colours on OS X, and a few minor issues on other platforms.

The main visible changes here are:
- the system default colours are correctly used in DAY and RGB modes
- recursion does not cause incorrect colouring of nested boxes
- inputs are correctly coloured white instead of pale blue