From f0ecf6eee6d6c9270f2e21f4f57af3f91044bd6c Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sat, 25 Nov 2017 18:19:58 +0200 Subject: Add dark theme --- src/main.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/main.cc') diff --git a/src/main.cc b/src/main.cc index 9ca1d5de..7338e578 100644 --- a/src/main.cc +++ b/src/main.cc @@ -75,15 +75,25 @@ main(int argc, char *argv[]) QFile stylefile; - if (!settings.contains("user/theme")) { - settings.setValue("user/theme", "default"); - } + if (!settings.contains("user/theme")) + settings.setValue("user/theme", "light"); + + const auto theme = settings.value("user/theme", "light").toString(); + + QPalette pal; - if (settings.value("user/theme").toString() == "default") { + if (theme == "light") { stylefile.setFileName(":/styles/styles/nheko.qss"); + pal.setColor(QPalette::Link, QColor("#333")); + } else if (theme == "dark") { + stylefile.setFileName(":/styles/styles/nheko-dark.qss"); + pal.setColor(QPalette::Link, QColor("#d7d9dc")); } else { stylefile.setFileName(":/styles/styles/system.qss"); } + + app.setPalette(pal); + stylefile.open(QFile::ReadOnly); QString stylesheet = QString(stylefile.readAll()); -- cgit 1.4.1