Skip to content

Commit 496c87c

Browse files
committed
ui: tweak build_tag and tag styles
1 parent 7c89975 commit 496c87c

File tree

2 files changed

+33
-18
lines changed

2 files changed

+33
-18
lines changed

tagstudio/src/core/palette.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class UiColor(IntEnum):
3131

3232
TAG_COLORS: dict[TagColorEnum, dict[ColorType, Any]] = {
3333
TagColorEnum.DEFAULT: {
34-
ColorType.PRIMARY: "#111111",
34+
ColorType.PRIMARY: "#1e1e1e",
3535
ColorType.TEXT: ColorType.LIGHT_ACCENT,
3636
ColorType.BORDER: "#333333",
3737
ColorType.LIGHT_ACCENT: "#FFFFFF",

tagstudio/src/qt/modals/build_tag.py

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
QWidget,
2626
)
2727
from src.core.library import Library, Tag
28+
from src.core.library.alchemy.enums import TagColorEnum
2829
from src.core.library.alchemy.models import TagColorGroup
29-
from src.core.palette import ColorType, UiColor, get_ui_color
30+
from src.core.palette import ColorType, UiColor, get_tag_color, get_ui_color
3031
from src.qt.modals.tag_color_selection import TagColorSelection
3132
from src.qt.modals.tag_search import TagSearchPanel
3233
from src.qt.translations import Translations
@@ -73,7 +74,7 @@ def __init__(self, library: Library, tag: Tag | None = None):
7374
self.tag_color_slug: str | None
7475
self.disambiguation_id: int | None
7576

76-
self.setMinimumSize(300, 400)
77+
self.setMinimumSize(300, 460)
7778
self.root_layout = QVBoxLayout(self)
7879
self.root_layout.setContentsMargins(6, 0, 6, 0)
7980
self.root_layout.setAlignment(Qt.AlignmentFlag.AlignTop)
@@ -134,6 +135,7 @@ def __init__(self, library: Library, tag: Tag | None = None):
134135

135136
# Parent Tags ----------------------------------------------------------
136137
self.parent_tags_widget = QWidget()
138+
self.parent_tags_widget.setMinimumHeight(128)
137139
self.parent_tags_layout = QVBoxLayout(self.parent_tags_widget)
138140
self.parent_tags_layout.setStretch(1, 1)
139141
self.parent_tags_layout.setContentsMargins(0, 0, 0, 0)
@@ -210,26 +212,39 @@ def __init__(self, library: Library, tag: Tag | None = None):
210212
self.cat_layout = QHBoxLayout(self.cat_widget)
211213
self.cat_layout.setStretch(1, 1)
212214
self.cat_layout.setContentsMargins(0, 0, 0, 0)
213-
self.cat_layout.setSpacing(0)
215+
self.cat_layout.setSpacing(6)
214216
self.cat_layout.setAlignment(Qt.AlignmentFlag.AlignLeft)
215217
self.cat_title = QLabel()
216218
self.cat_title.setText("Is Category")
217219
self.cat_checkbox = QCheckBox()
218-
# TODO: Style checkbox
220+
self.cat_checkbox.setFixedSize(22, 22)
221+
222+
primary_color = QColor(get_tag_color(ColorType.PRIMARY, TagColorEnum.DEFAULT))
223+
border_color = get_border_color(primary_color)
224+
highlight_color = get_highlight_color(primary_color)
225+
text_color: QColor = get_text_color(primary_color, highlight_color)
226+
219227
self.cat_checkbox.setStyleSheet(
220-
"QCheckBox::indicator{"
221-
"width: 19px; height: 19px;"
222-
# f"background: #1e1e1e;"
223-
# f"border-color: #333333;"
224-
# f"border-radius: 6px;"
225-
# f"border-style:solid;"
226-
# f"border-width:{math.ceil(self.devicePixelRatio())}px;"
227-
"}"
228-
# f"QCheckBox::indicator::hover"
229-
# f"{{"
230-
# f"border-color: #CCCCCC;"
231-
# f"background: #555555;"
232-
# f"}}"
228+
f"QCheckBox{{"
229+
f"background: rgba{primary_color.toTuple()};"
230+
f"color: rgba{text_color.toTuple()};"
231+
f"border-color: rgba{border_color.toTuple()};"
232+
f"border-radius: 6px;"
233+
f"border-style:solid;"
234+
f"border-width: 2px;"
235+
f"}}"
236+
f"QCheckBox::indicator{{"
237+
f"width: 10px;"
238+
f"height: 10px;"
239+
f"border-radius: 2px;"
240+
f"margin: 4px;"
241+
f"}}"
242+
f"QCheckBox::indicator:checked{{"
243+
f"background: rgba{text_color.toTuple()};"
244+
f"}}"
245+
f"QCheckBox::hover{{"
246+
f"border-color: rgba{highlight_color.toTuple()};"
247+
f"}}"
233248
)
234249
self.cat_layout.addWidget(self.cat_checkbox)
235250
self.cat_layout.addWidget(self.cat_title)

0 commit comments

Comments
 (0)