diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index 032cdbb21e..de39ab8afe 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -3619,8 +3619,7 @@ void wxWidgetCocoaImpl::SetForegroundColour(const wxColour& col) if ([targetView respondsToSelector:@selector(setTextColor:)]) { - wxColor col = GetWXPeer()->GetForegroundColour(); - [targetView setTextColor: col.OSXGetNSColor()]; + [targetView setTextColor: col.IsOk() ? col.OSXGetNSColor() : nil]; } } diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index d7e1b04040..bca9a12ddb 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -527,7 +527,12 @@ bool wxWindowMac::SetForegroundColour(const wxColour& col ) return false; if ( GetPeer() ) - GetPeer()->SetForegroundColour(col); + { + // Note that we use GetForegroundColour() and not "col" itself here in + // case we're now inheriting our parent foreground rather than passing + // the (null) colour argument. + GetPeer()->SetForegroundColour(GetForegroundColour()); + } return true; }