Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/change app bg colors #1377

Merged
merged 5 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/python/plotlyst/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from timeit import default_timer as timer
from typing import Any, NoReturn, Dict

from plotlyst.view.style.theme import BG_SECONDARY_COLOR

WIP_COLOR: str = '#f6cd61'

ACT_ONE_COLOR: str = '#02bcd4'
Expand Down Expand Up @@ -80,7 +82,7 @@

ALT_BACKGROUND_COLOR: str = '#F0E6F4'

RELAXED_WHITE_COLOR: str = '#f8f9fa'
RELAXED_WHITE_COLOR: str = BG_SECONDARY_COLOR
WHITE_COLOR: str = '#FcFcFc'
BLACK_COLOR: str = '#040406'
RED_COLOR: str = '#ED6868'
Expand Down
3 changes: 2 additions & 1 deletion src/main/python/plotlyst/view/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
from plotlyst.view.novel_view import NovelView
from plotlyst.view.reports_view import ReportsView
from plotlyst.view.scenes_view import ScenesOutlineView
from plotlyst.view.style.theme import BG_PRIMARY_COLOR
from plotlyst.view.widget.button import ToolbarButton, NovelSyncButton
from plotlyst.view.widget.confirm import asked
from plotlyst.view.widget.input import CapitalizationEventFilter
Expand Down Expand Up @@ -99,7 +100,7 @@ def __init__(self, *args, **kwargs):
palette.setColor(QPalette.ColorGroup.Active, QPalette.ColorRole.Text, QColor('#040406'))
palette.setColor(QPalette.ColorRole.ToolTipText, QColor(PLOTLYST_MAIN_COLOR))
palette.setColor(QPalette.ColorRole.PlaceholderText, QColor('#5E6C84'))
palette.setColor(QPalette.ColorRole.Window, QColor('#EFEFF4'))
palette.setColor(QPalette.ColorRole.Window, QColor(BG_PRIMARY_COLOR))
QApplication.setPalette(palette)

if app_env.is_mac():
Expand Down
151 changes: 76 additions & 75 deletions src/main/python/plotlyst/view/style/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,163 +24,164 @@
from PyQt6.QtWidgets import QWidget
from qtmenu import MenuWidget

from plotlyst.common import RELAXED_WHITE_COLOR
from plotlyst.view.style.theme import BG_PRIMARY_COLOR, BG_SECONDARY_COLOR, BG_MUTED_COLOR

style = '''
* {
style = f'''
* {{
icon-size: 20px;
}
}}

QToolTip {
QToolTip {{
border: 0px;
font-size: 14pt;
padding: 5px;
background-color: #EFEFF4;
}
background-color: {BG_PRIMARY_COLOR};
}}

QMenuBar {
background-color: #EFEFF4;
}
QMenuBar {{
background-color: {BG_PRIMARY_COLOR};
}}

QToolBar {
QToolBar {{
spacing: 1px;
}
}}

QWidget[bg=true] {
background-color: #EFEFF4;
}
QWidget[bg=true] {{
background-color: {BG_PRIMARY_COLOR};
}}

QWidget[darker-bg=true] {
background-color: #E5E5EE;
}
QWidget[darker-bg=true] {{
background-color: {BG_MUTED_COLOR};
}}

QWidget[white-bg=true] {
background-color: #FcFcFc;
}

QWidget[relaxed-white-bg=true] {
QWidget[white-bg=true] {{
background-color: #f8f9fa;
}
}}

QWidget[relaxed-white-bg=true] {{
background-color: {BG_SECONDARY_COLOR};
}}

QWidget[banner-bg=true] {
QWidget[banner-bg=true] {{
background-color: #2B0548;
}
}}

QWidget[transparent=true] {
QWidget[transparent=true] {{
border: 0px;
background-color: rgba(0, 0, 0, 0);
}
}}

QWidget[navbar=true] {
QWidget[navbar=true] {{
background-color: #622675;
}
}}

QFrame[bottom-bar=true] {
background-color: #EFEFF4;
}
QFrame[bottom-bar=true] {{
background-color: {BG_PRIMARY_COLOR};
}}

QFrame[relaxed-white-bg=true] {
background-color: #f8f9fa;
}
QFrame[relaxed-white-bg=true] {{
background-color: {BG_SECONDARY_COLOR};
}}

QFrame[white-bg=true] {
background-color: #FcFcFc;
}
QFrame[white-bg=true] {{
background-color: #f8f9fa;
}}

QFrame[rounded=true] {
QFrame[rounded=true] {{
border: 1px solid lightgrey;
border-radius: 6px;
}
}}

QFrame[revision-badge=true] {
QFrame[revision-badge=true] {{
border: 3px solid #622675;
background: #f8f9fa;
background: {BG_SECONDARY_COLOR};
padding: 6px;
border-radius: 12px;
}
}}

QFrame[large-rounded=true] {
QFrame[large-rounded=true] {{
border: 1px solid lightgrey;
border-radius: 15px;
}
}}

QDialog[relaxed-white-bg] {
background-color: #f8f9fa;
}
QDialog[relaxed-white-bg] {{
background-color: {BG_SECONDARY_COLOR};
}}

QToolBox::tab[conflict-selector=true] {
QToolBox::tab[conflict-selector=true] {{
background: #f3a712;
border-radius: 5px;
color: black;
font: italic;
}
}}

QToolBox::tab:selected[conflict-selector=true] {
QToolBox::tab:selected[conflict-selector=true] {{
font: bold;
color: black;
}
}}

QToolBox[conflict-selector=true] {
QToolBox[conflict-selector=true] {{
background-color: white;
}
}}

QScrollArea[transparent=true] {
QScrollArea[transparent=true] {{
border: 0px;
background-color: rgba(0, 0, 0, 0);
}
}}

QScrollArea[relaxed-white-bg=true] {
background-color: #f8f9fa;
}
QScrollArea[relaxed-white-bg=true] {{
background-color: {BG_SECONDARY_COLOR};
}}

TaskWidget {
background-color: #f8f9fa;
TaskWidget {{
background-color: {BG_SECONDARY_COLOR};
border: 1px solid lightGrey;
border-radius: 6px;
}
}}

QSplitter::handle:horizontal {
QSplitter::handle:horizontal {{
width: 20px;
border: 0px;
background-color: rgba(0, 0, 0, 0);
}
}}

QSplitter[framed=true]::handle:horizontal {
QSplitter[framed=true]::handle:horizontal {{
border-left: 1px solid grey;
}
}}

QSplitter::handle:horizontal:hover {
QSplitter::handle:horizontal:hover {{
border-left: 2px dashed #4B0763;
}
}}

QSplitter::handle:horizontal:pressed {
QSplitter::handle:horizontal:pressed {{
border-left: 2px solid #4B0763;
}
}}

'''


def apply_color(wdg: QWidget, color: Union[str, QColor, Qt.GlobalColor]):
if isinstance(color, QColor):
color = color.name()
wdg.setStyleSheet(f'color: {color}')
wdg.setStyleSheet(f'color: {{color}}')


def apply_bg_image(wdg: QWidget, resource_url: str):
wdg.setStyleSheet(f'.QWidget[bg-image=true] {{background-image: url({resource_url});}}')


def apply_border_image(wdg: QWidget, resource_url: str):
wdg.setStyleSheet(f'.QWidget[border-image=true] {{border-image: url({resource_url}) 0 0 0 0 stretch stretch;}}')
wdg.setStyleSheet(
f'.QWidget[border-image=true] {{border-image: url({resource_url}) 0 0 0 0 stretch stretch;}}')


def apply_white_menu(menu: MenuWidget):
menu.setStyleSheet(f'''
MenuWidget {{
background-color: {RELAXED_WHITE_COLOR};
background-color: {{RELAXED_WHITE_COLOR}};
}}
.QFrame {{
background-color: {RELAXED_WHITE_COLOR};
background-color: {{RELAXED_WHITE_COLOR}};
padding-left: 2px;
padding-right: 2px;
border-radius: 5px;
Expand Down
62 changes: 32 additions & 30 deletions src/main/python/plotlyst/view/style/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
from PyQt6.QtGui import QColor, QPalette
from PyQt6.QtWidgets import QAbstractButton

from plotlyst.view.style.theme import TEXT_COLOR_ON_DARK_BG, BG_SECONDARY_COLOR

btn_style_no_menu = """
QPushButton::menu-indicator[no-menu] {
width:0px;
Expand Down Expand Up @@ -97,25 +99,25 @@
}
"""

btn_style_deconstructive = """
QPushButton[deconstructive=true]:!disabled {
btn_style_deconstructive = f"""
QPushButton[deconstructive=true]:!disabled {{
background: #E11D48;
color: #f8f9fa;
color: {TEXT_COLOR_ON_DARK_BG};
font: bold;
}
}}

QPushButton[deconstructive=true]:hover {
QPushButton[deconstructive=true]:hover {{
background: #E84E6F;
}
}}
"""

btn_style_cancel = """
QPushButton[cancel=true]:!disabled {
btn_style_cancel = f"""
QPushButton[cancel=true]:!disabled {{
background: #FcFcFc;
}
QPushButton[cancel=true]:!disabled:hover {
background: #f8f9fa;
}
}}
QPushButton[cancel=true]:!disabled:hover {{
background: {BG_SECONDARY_COLOR};
}}
"""

btn_style_transparent = """
Expand Down Expand Up @@ -180,15 +182,15 @@
}
"""

btn_style_lang_spellcheck_suggestion = """
QPushButton[lang-spellcheck-suggestion=true] {
btn_style_lang_spellcheck_suggestion = f"""
QPushButton[lang-spellcheck-suggestion=true] {{
background: #4B0763;
border: 1px solid #4B0763;
border-radius: 5px;
padding: 3px;
color: #f8f9fa;
color: {TEXT_COLOR_ON_DARK_BG};
margin: 2px;
}
}}
"""

btn_style_return = """
Expand All @@ -200,36 +202,36 @@
}
"""

btn_style_find = """
QPushButton[find=true] {
btn_style_find = f"""
QPushButton[find=true] {{
margin: 2px;
padding: 2px;
border-radius: 2px;
border: 1px solid lightgrey;
background: #f8f9fa;
}
QPushButton[find=true]:pressed {
background: {BG_SECONDARY_COLOR};
}}
QPushButton[find=true]:pressed {{
padding: 2px;
margin: 1px;
}
QPushButton[find=true]:disabled {
}}
QPushButton[find=true]:disabled {{
opacity: 0.65;
}
}}
"""

btn_style_importer_sync = """
QPushButton[importer-sync=true] {
btn_style_importer_sync = f"""
QPushButton[importer-sync=true] {{
padding: 2px;
border-radius: 6px;
border: 1px hidden #410253;
background-color: rgba(0, 0, 0, 0);
color: #410253;
}
}}

QPushButton:hover[importer-sync=true] {
QPushButton:hover[importer-sync=true] {{
border: 1px outset #410253;
background-color: #f8f9fa;
}
background-color: {BG_SECONDARY_COLOR};
}}
"""

btn_style_structure_customization = """
Expand Down
Loading
Loading