Fail gracefully if there's an error detecting high contrast mode, fixes #16541.