Skip to content

Commit

Permalink
Dark mode with both CSS and colours
Browse files Browse the repository at this point in the history
  • Loading branch information
Mercury13 committed Oct 27, 2024
1 parent a709b39 commit 9b49a06
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Libs/SelfMade/i_DarkMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <QApplication>
#include <QPalette>

QString dark::fileName = ":/dark.qss";
QString dark::fileName;
std::optional<QPalette> dark::palette;

namespace {
Expand Down Expand Up @@ -104,16 +104,19 @@ void dark::forceOn()
{
if (palette) {
QApplication::setPalette(*palette);
isDarkOn = true;
}
if (!fileName.isEmpty()) {
QFile f(fileName);
if ( !f.exists() ) {
forceOff();
return;
}
f.open( QFile::ReadOnly | QFile::Text );
QTextStream ts( &f );
getApp()->setStyleSheet( ts.readAll() );
isDarkOn = true;
}
// QFile f(fileName);
// if ( !f.exists() ) {
// forceOff();
// return;
// }
// f.open( QFile::ReadOnly | QFile::Text );
// QTextStream ts( &f );
// getApp()->setStyleSheet( ts.readAll() );
isDarkOn = true;
}


Expand Down

0 comments on commit 9b49a06

Please sign in to comment.