mirror of
https://github.com/fwbuilder/fwbuilder
synced 2025-01-18 12:27:16 +01:00
Merge pull request #79 from karora/dark_theme_is_usable
Dark theme is usable
This commit is contained in:
commit
234035b706
@ -957,13 +957,25 @@ void ProjectPanel::loadStandardObjects()
|
||||
objdb->load( Constants::getStandardObjectsFilePath(),
|
||||
&upgrade_predicate, Constants::getDTDDirectory());
|
||||
objdb->setFileName("");
|
||||
if ( qGray(palette().color(QPalette::Window).rgba()) < 100) {
|
||||
FWObject *stdLib = objdb->findObjectByName(Library::TYPENAME, "Standard");
|
||||
stdLib->setReadOnly(false);
|
||||
stdLib->setStr("color", "#0a0f1f");
|
||||
objdb->setDirty(false);
|
||||
}
|
||||
|
||||
if (fwbdebug) qDebug("ProjectPanel::load(): create User library");
|
||||
|
||||
FWObject *userLib = FWBTree().createNewLibrary(objdb);
|
||||
|
||||
userLib->setName("User");
|
||||
userLib->setStr("color","#d2ffd0");
|
||||
if ( qGray(palette().color(QPalette::Window).rgba()) < 100) {
|
||||
// Window is using a dark palette, so we default to a very dark green for background
|
||||
userLib->setStr("color","#0a1f08");
|
||||
} else {
|
||||
// Window is using a light palette, so we default to a light green background
|
||||
userLib->setStr("color","#d2ffd0");
|
||||
}
|
||||
|
||||
objdb->setDirty(false);
|
||||
objdb->setFileName("");
|
||||
@ -1036,6 +1048,12 @@ bool ProjectPanel::loadFromRCS(RCS *_rcs)
|
||||
objdb->load( Constants::getStandardObjectsFilePath(),
|
||||
&upgrade_predicate, Constants::getDTDDirectory());
|
||||
objdb->setFileName("");
|
||||
if ( qGray(palette().color(QPalette::Window).rgba()) < 100) {
|
||||
FWObject *stdLib = objdb->findObjectByName(Library::TYPENAME, "Standard");
|
||||
stdLib->setReadOnly(false);
|
||||
stdLib->setStr("color", "#0a0f1f");
|
||||
objdb->setDirty(false);
|
||||
}
|
||||
|
||||
// objects from a data file are in database ndb
|
||||
|
||||
|
@ -167,7 +167,12 @@ void RuleSetView::init()
|
||||
* RuleSetViewDelegate when I paint individual cells.
|
||||
*/
|
||||
QPalette updated_palette = palette();
|
||||
updated_palette.setColor(QPalette::Highlight, QColor("silver"));
|
||||
if ( qGray(updated_palette.color(QPalette::Window).rgba()) < 100) {
|
||||
// Window is using a dark palette, so we just lighten a little for the highlight
|
||||
updated_palette.setColor(QPalette::Highlight, updated_palette.color(QPalette::Window).lighter(150));
|
||||
} else {
|
||||
updated_palette.setColor(QPalette::Highlight, QColor("silver"));
|
||||
}
|
||||
setPalette(updated_palette);
|
||||
|
||||
|
||||
|
@ -308,14 +308,21 @@ void setDisabledPalette(QWidget *w)
|
||||
{
|
||||
QPalette pal=w->palette();
|
||||
|
||||
pal.setCurrentColorGroup( QPalette::Normal );
|
||||
|
||||
QColor textColor = Qt::black;
|
||||
if ( qGray(pal.color(QPalette::Window).rgba()) < 100) {
|
||||
textColor = Qt::white;
|
||||
}
|
||||
|
||||
pal.setCurrentColorGroup( QPalette::Active );
|
||||
pal.setColor( QPalette::Text, Qt::black );
|
||||
pal.setColor( QPalette::Text, textColor );
|
||||
|
||||
pal.setCurrentColorGroup( QPalette::Inactive );
|
||||
pal.setColor( QPalette::Text, Qt::black );
|
||||
pal.setColor( QPalette::Text, textColor );
|
||||
|
||||
pal.setCurrentColorGroup( QPalette::Disabled );
|
||||
pal.setColor( QPalette::Text, Qt::black );
|
||||
pal.setColor( QPalette::Text, textColor );
|
||||
|
||||
w->setPalette( pal );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user