From deac1b0f55e335ee07a978b559ec9e8c3f4e6134 Mon Sep 17 00:00:00 2001 From: Zsolt Kovari Date: Thu, 3 Oct 2024 14:11:17 +0200 Subject: [PATCH] Add muted bg color --- src/main/python/plotlyst/view/style/base.py | 4 ++-- src/main/python/plotlyst/view/style/theme.py | 1 + .../plotlyst/view/widget/character/profile.py | 22 ++++++++++++------- .../plotlyst/view/widget/plot/progression.py | 5 +++-- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/main/python/plotlyst/view/style/base.py b/src/main/python/plotlyst/view/style/base.py index 2d97100a0..253bf65b4 100644 --- a/src/main/python/plotlyst/view/style/base.py +++ b/src/main/python/plotlyst/view/style/base.py @@ -24,7 +24,7 @@ from PyQt6.QtWidgets import QWidget from qtmenu import MenuWidget -from plotlyst.view.style.theme import BG_PRIMARY_COLOR, BG_SECONDARY_COLOR +from plotlyst.view.style.theme import BG_PRIMARY_COLOR, BG_SECONDARY_COLOR, BG_MUTED_COLOR style = f''' * {{ @@ -51,7 +51,7 @@ }} QWidget[darker-bg=true] {{ - background-color: #E5E5EE; + background-color: {BG_MUTED_COLOR}; }} QWidget[white-bg=true] {{ diff --git a/src/main/python/plotlyst/view/style/theme.py b/src/main/python/plotlyst/view/style/theme.py index 49f44f203..ef6c880bb 100644 --- a/src/main/python/plotlyst/view/style/theme.py +++ b/src/main/python/plotlyst/view/style/theme.py @@ -20,5 +20,6 @@ BG_PRIMARY_COLOR: str = '#EFEFF4' BG_SECONDARY_COLOR: str = '#F5F6F8' +BG_MUTED_COLOR: str = '#E5E5EE' TEXT_COLOR_ON_DARK_BG: str = BG_SECONDARY_COLOR diff --git a/src/main/python/plotlyst/view/widget/character/profile.py b/src/main/python/plotlyst/view/widget/character/profile.py index 6da2b058c..9b55d9558 100644 --- a/src/main/python/plotlyst/view/widget/character/profile.py +++ b/src/main/python/plotlyst/view/widget/character/profile.py @@ -119,6 +119,12 @@ class SectionContext: def has_white_bg(self) -> bool: return False + def has_muted_bg(self) -> bool: + return False + + def has_bg(self) -> bool: + return self.has_white_bg() or self.has_muted_bg() + def has_addition(self) -> bool: return False @@ -310,12 +316,12 @@ def __init__(self, section: CharacterProfileSectionReference, context: SectionCo self.wdgContainer = QFrame() vbox(self.wdgContainer, 5) - if self.context.has_white_bg(): - if app_env.is_mac(): - self.wdgContainer.setProperty('relaxed-white-bg', True) - else: - self.wdgContainer.setProperty('white-bg', True) + if self.context.has_bg(): self.wdgContainer.setProperty('rounded', True) + if self.context.has_white_bg(): + self.wdgContainer.setProperty('relaxed-white-bg', True) + elif self.context.has_muted_bg(): + self.wdgContainer.setProperty('darker-bg', True) else: margins(self.wdgContainer, left=20) @@ -324,7 +330,7 @@ def __init__(self, section: CharacterProfileSectionReference, context: SectionCo margins(self.wdgBottom, left=20) self.layout().addWidget(self.wdgHeader) - if self.context.has_white_bg(): + if self.context.has_bg(): self.layout().addWidget(wrap(self.wdgContainer, margin_left=20)) else: self.layout().addWidget(self.wdgContainer) @@ -987,7 +993,7 @@ def _valueChanged(self): class StrengthsSectionContext(SectionContext): @overrides - def has_white_bg(self) -> bool: + def has_muted_bg(self) -> bool: return True @@ -1001,7 +1007,7 @@ def has_white_bg(self) -> bool: class MultiAttributeSectionContext(SectionContext): @overrides - def has_white_bg(self) -> bool: + def has_muted_bg(self) -> bool: return True @overrides diff --git a/src/main/python/plotlyst/view/widget/plot/progression.py b/src/main/python/plotlyst/view/widget/plot/progression.py index 20d64511b..486917237 100644 --- a/src/main/python/plotlyst/view/widget/plot/progression.py +++ b/src/main/python/plotlyst/view/widget/plot/progression.py @@ -28,7 +28,7 @@ from qthandy.filter import VisibilityToggleEventFilter from qtmenu import MenuWidget, ActionTooltipDisplayMode -from plotlyst.common import WHITE_COLOR, RELAXED_WHITE_COLOR +from plotlyst.common import RELAXED_WHITE_COLOR from plotlyst.core.domain import Novel, PlotType, PlotProgressionItem, \ PlotProgressionItemType, DynamicPlotPrincipleGroupType, DynamicPlotPrinciple, DynamicPlotPrincipleType, Plot, \ DynamicPlotPrincipleGroup, LayoutType, Character @@ -39,6 +39,7 @@ from plotlyst.view.icons import IconRegistry from plotlyst.view.layout import group from plotlyst.view.style.button import apply_button_palette_color +from plotlyst.view.style.theme import BG_MUTED_COLOR from plotlyst.view.widget.characters import CharacterSelectorButton from plotlyst.view.widget.confirm import confirmed from plotlyst.view.widget.display import IconText @@ -426,7 +427,7 @@ def __init__(self, novel: Novel, principleGroup: DynamicPlotPrincipleGroup, pare #frame {{ border: 1px solid lightgrey; border-radius: 8px; - background: {WHITE_COLOR}; + background: {BG_MUTED_COLOR}; }} ''')