Add the ability to select custom themes in the settings dialog (#4570)

Themes are loaded from the Themes directory (under the Chatterino directory, so %APPDATA%/Chatterino2/Themes).

Themes are json files (see the built in themes as an example).

After importing a theme, you must restart Chatterino for it to show up in the settings
This commit is contained in:
pajlada
2023-05-19 14:26:51 +02:00
committed by GitHub
parent 82dff89f3b
commit 5d0bdc195e
7 changed files with 277 additions and 29 deletions
+12 -2
View File
@@ -114,8 +114,18 @@ void GeneralPage::initLayout(GeneralPageView &layout)
auto &s = *getSettings();
layout.addTitle("Interface");
layout.addDropdown("Theme", {"White", "Light", "Dark", "Black"},
getApp()->themes->themeName);
layout.addDropdown<QString>(
"Theme", getApp()->themes->availableThemes(),
getApp()->themes->themeName,
[](const auto *combo, const auto &themeKey) {
return combo->findData(themeKey, Qt::UserRole);
},
[](const auto &args) {
return args.combobox->itemData(args.index, Qt::UserRole).toString();
},
{}, Theme::fallbackTheme.name);
layout.addDropdown<QString>(
"Font", {"Segoe UI", "Arial", "Choose..."},
getApp()->fonts->chatFontFamily,