gamecreature / QtAwesome

QtAwesome - Font Awesome for Qt Applications
Other
787 stars 149 forks source link

macOS darkmode #33

Closed ra1nb0w closed 1 year ago

ra1nb0w commented 5 years ago

first of all thanks for your work! I am using another software openhantek that use your library. Unfortunately in macOS with darkmode the icons are nearly indistinguishable with the background (see the image at the end). Before patching openhantek I would like to ask you if that change could be fit on this library? Just for test I did

iconFont->setDefaultOption( "color", QColor(255,100,100) );
iconFont->setDefaultOption( "color-disabled", QColor(155,60,10));
iconFont->setDefaultOption( "color-active", QColor(100,100,100));
iconFont->setDefaultOption( "color-selected", QColor(12,240,100));

iconFont->setDefaultOption( "color-off", QColor(255,100,100) );
iconFont->setDefaultOption( "color-disabled-off", QColor(155,60,10));
iconFont->setDefaultOption( "color-active-off", QColor(100,100,100));
iconFont->setDefaultOption( "color-selected-off", QColor(12,240,100));

and it works.

Default behaviour of QtAwesome in openhantek. The red icon that is visible is an svg file.

04dfe172-bec4-43c2-93d8-6492a0f4e7b2

gamecreature commented 5 years ago

Good question. I think the default colors for QtAwesome should be retrieved from the system.

 QApplication::palette()

At the moment they are hardcoded!

ra1nb0w commented 5 years ago

something like

    QPalette palette;                  
    setDefaultOption("color", palette.color(QPalette::Dark));   
    setDefaultOption("color-off", palette.color(QPalette::Dark));
    setDefaultOption("color-disabled", palette.color(QPalette::Midlight));
    setDefaultOption("color-active", palette.color(QPalette::Light));
    setDefaultOption("color-selected", palette.color(QPalette::Light));  
gamecreature commented 1 year ago

The new release should improve the dark/light mode situation. The default options now are based on the palette:

setDefaultOption("color", QApplication::palette().color(QPalette::Normal, QPalette::Text));
setDefaultOption("color-disabled", QApplication::palette().color(QPalette::Disabled, QPalette::Text));
setDefaultOption("color-active", QApplication::palette().color(QPalette::Active, QPalette::Text));
setDefaultOption("color-selected", QApplication::palette().color(QPalette::Active, QPalette::Text));
gamecreature commented 1 year ago

I guess this issue can be marked as done (see previous comment)