77 lines
1.4 KiB
Python
77 lines
1.4 KiB
Python
# v3.1.0 styles.py
|
|
from config.profiles import ThemePalette
|
|
|
|
|
|
def build_stylesheet(
|
|
theme: ThemePalette,
|
|
border: str,
|
|
background: str,
|
|
font_size: int,
|
|
font_family: list[str],
|
|
layout_margin: int,
|
|
) -> str:
|
|
fonts = ",".join(
|
|
[f'"{item}"' for item in font_family]
|
|
)
|
|
|
|
padding = max(
|
|
4,
|
|
layout_margin * 2,
|
|
)
|
|
|
|
radius = max(
|
|
12,
|
|
layout_margin * 4,
|
|
)
|
|
|
|
return f"""
|
|
QWidget#container {{
|
|
background: {background};
|
|
border: 1px solid {border};
|
|
border-radius: 7px;
|
|
}}
|
|
|
|
QWidget#container:hover {{
|
|
border: 1px solid {theme.border_active};
|
|
}}
|
|
|
|
QFrame {{
|
|
background: transparent;
|
|
border: none;
|
|
}}
|
|
|
|
QTextEdit#editor,
|
|
QTextBrowser#preview {{
|
|
background: transparent;
|
|
color: {theme.foreground};
|
|
border: none;
|
|
border-radius: {radius}px;
|
|
padding: {padding}px;
|
|
selection-background-color:
|
|
{theme.selection};
|
|
font-size: {font_size}px;
|
|
font-family: {fonts};
|
|
}}
|
|
|
|
QTextEdit#editor {{
|
|
outline: none;
|
|
}}
|
|
|
|
QTextBrowser#preview code {{
|
|
background:
|
|
{theme.code_background};
|
|
border-radius: 6px;
|
|
padding: 2px 6px;
|
|
}}
|
|
|
|
QSizeGrip {{
|
|
background: transparent;
|
|
width: 16px;
|
|
height: 16px;
|
|
}}
|
|
|
|
QScrollBar {{
|
|
width: 0px;
|
|
height: 0px;
|
|
}}
|
|
""" |