Improve contrast of status popup text on Mac.

Also works around an issue where GetBackgroundColor() returns black
(with a 40% alpha) on Mac.
This commit is contained in:
Jeff Young 2022-09-04 21:00:44 +01:00
parent 92edee5a08
commit 9405817a4d
1 changed files with 7 additions and 4 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2015 CERN
* Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
@ -23,6 +23,7 @@
#include "pns_tune_status_popup.h"
#include "pns_router.h"
#include "pns_meander_placer.h"
#include <wx/settings.h>
void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS::ROUTER* aRouter )
{
@ -36,7 +37,7 @@ void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS::ROUTER* aRouter )
SetText( placer->TuningInfo( frame->GetUserUnits() ) );
// Determine the background color first and choose a contrasting value
COLOR4D bg( m_panel->GetBackgroundColour() );
COLOR4D bg( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
double h, s, l;
bg.ToHSL( h, s, l );
@ -46,16 +47,18 @@ void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS::ROUTER* aRouter )
if( l < 0.5 )
SetTextColor( wxColor( 127, 200, 127 ) );
else
SetTextColor( wxColor( 0, 128, 0 ) );
SetTextColor( wxColor( 0, 92, 0 ) );
break;
case PNS::MEANDER_PLACER::TOO_SHORT:
if( l < 0.5 )
SetTextColor( wxColor( 242, 100, 126 ) );
else
SetTextColor( wxColor( 128, 64, 64 ) );
SetTextColor( wxColor( 122, 0, 0 ) );
break;
case PNS::MEANDER_PLACER::TOO_LONG:
if( l < 0.5 )
SetTextColor( wxColor( 66, 184, 235 ) );