Calculadora: configurando o PyQt Dark Theme (qdarktheme) no PySide6
This commit is contained in:
38
aula202-calculadora/styles.py
Normal file
38
aula202-calculadora/styles.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# QSS - Estilos do QT for Python
|
||||
# https://doc.qt.io/qtforpython/tutorials/basictutorial/widgetstyling.html
|
||||
# Dark Theme
|
||||
# https://pyqtdarktheme.readthedocs.io/en/latest/how_to_use.html
|
||||
import qdarktheme
|
||||
from variables import (DARKER_PRIMARY_COLOR, DARKEST_PRIMARY_COLOR,
|
||||
PRIMARY_COLOR)
|
||||
|
||||
qss = f"""
|
||||
PushButton[cssClass="specialButton"] {{
|
||||
color: #fff;
|
||||
background: {PRIMARY_COLOR};
|
||||
}}
|
||||
PushButton[cssClass="specialButton"]:hover {{
|
||||
color: #fff;
|
||||
background: {DARKER_PRIMARY_COLOR};
|
||||
}}
|
||||
PushButton[cssClass="specialButton"]:pressed {{
|
||||
color: #fff;
|
||||
background: {DARKEST_PRIMARY_COLOR};
|
||||
}}
|
||||
"""
|
||||
|
||||
|
||||
def setupTheme():
|
||||
qdarktheme.setup_theme(
|
||||
theme='dark',
|
||||
corner_shape='rounded',
|
||||
custom_colors={
|
||||
"[dark]": {
|
||||
"primary": f"{PRIMARY_COLOR}",
|
||||
},
|
||||
"[light]": {
|
||||
"primary": f"{PRIMARY_COLOR}",
|
||||
},
|
||||
},
|
||||
additional_qss=qss
|
||||
)
|
||||
Reference in New Issue
Block a user