Upload files to "ui"

This commit is contained in:
admin
2026-05-23 20:23:12 +00:00
parent bc8061d708
commit 84af675514
2 changed files with 137 additions and 0 deletions

77
ui/styles.py Normal file
View File

@@ -0,0 +1,77 @@
# 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: 16px;
}}
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;
}}
"""