1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-26 16:24:41 +01:00

Make the default tabbbar background color lighter

Fixes #711
This commit is contained in:
jonas@jkvinge.net 2021-05-11 20:10:31 +02:00
parent 1803705749
commit dee1905e16
3 changed files with 19 additions and 3 deletions

View File

@ -42,6 +42,7 @@
#include <QSettings>
#include "appearancesettingspage.h"
#include "core/utilities.h"
#include "core/appearance.h"
#include "core/iconloader.h"
#include "core/stylehelper.h"
@ -176,7 +177,7 @@ void AppearanceSettingsPage::Load() {
ui_->tabbar_system_color->setChecked(tabbar_system_color);
ui_->tabbar_custom_color->setChecked(!tabbar_system_color);
current_tabbar_bg_color_ = s.value(kTabBarColor, StyleHelper::highlightColor()).value<QColor>();
current_tabbar_bg_color_ = s.value(kTabBarColor, DefaultTabbarBgColor()).value<QColor>();
UpdateColorSelectorColor(ui_->select_tabbar_color, current_tabbar_bg_color_);
TabBarSystemColor(ui_->tabbar_system_color->isChecked());
@ -415,7 +416,7 @@ void AppearanceSettingsPage::OpacityLevelChanged(int percent) {
void AppearanceSettingsPage::TabBarSystemColor(bool checked) {
if (checked) {
current_tabbar_bg_color_ = StyleHelper::highlightColor();
current_tabbar_bg_color_ = DefaultTabbarBgColor();
UpdateColorSelectorColor(ui_->select_tabbar_color, current_tabbar_bg_color_);
}
ui_->layout_tabbar_color->setEnabled(!checked);
@ -463,3 +464,13 @@ void AppearanceSettingsPage::PlaylistPlayingSongSelectColor() {
set_changed();
}
QColor AppearanceSettingsPage::DefaultTabbarBgColor() {
QColor color = StyleHelper::highlightColor();
if (Utilities::IsColorDark(color)) {
color = color.lighter(130);
}
return color;
}

View File

@ -99,6 +99,8 @@ class AppearanceSettingsPage : public SettingsPage {
void Save() override;
void Cancel() override;
static QColor DefaultTabbarBgColor();
private slots:
void SelectForegroundColor();
void SelectBackgroundColor();

View File

@ -522,7 +522,10 @@ void FancyTabWidget::ReloadSettings() {
s.beginGroup(AppearanceSettingsPage::kSettingsGroup);
bg_color_system_ = s.value(AppearanceSettingsPage::kTabBarSystemColor, false).toBool();
bg_gradient_ = s.value(AppearanceSettingsPage::kTabBarGradient, true).toBool();
bg_color_ = s.value(AppearanceSettingsPage::kTabBarColor, StyleHelper::highlightColor()).value<QColor>();
bg_color_ = AppearanceSettingsPage::DefaultTabbarBgColor();
if (!bg_color_system_) {
bg_color_ = s.value(AppearanceSettingsPage::kTabBarColor, bg_color_).value<QColor>();
}
iconsize_smallsidebar_ = s.value(AppearanceSettingsPage::kIconSizeTabbarSmallMode, FancyTabWidget::IconSize_SmallSidebar).toInt();
iconsize_largesidebar_ = s.value(AppearanceSettingsPage::kIconSizeTabbarLargeMode, FancyTabWidget::IconSize_LargeSidebar).toInt();
s.endGroup();