added windows support for automatic colour restoration instead of depending on a statically defined value