Skip to content

Commit e3b6d4b

Browse files
committed
chore: show hex value in colors preview
1 parent f9ff715 commit e3b6d4b

2 files changed

Lines changed: 47 additions & 19 deletions

File tree

src/plasmoid/package/contents/ui/components/ColorRolePreview.qml

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,49 @@ Rectangle {
1414
color: scheme[root.role]
1515
ColumnLayout {
1616
id: col
17-
spacing: 2
17+
spacing: 0
1818
anchors.fill: parent
1919

20-
Text {
21-
text: root.customName !== "" ? `${root.customName}` : `${root.role}`
22-
color: root.scheme[root.onRole]
23-
font.bold: true
24-
font.pixelSize: Kirigami.Theme.defaultFont.pixelSize
25-
elide: Text.ElideRight
26-
Layout.fillWidth: true
20+
RowLayout{
21+
Layout.leftMargin: Kirigami.Units.smallSpacing
22+
Layout.rightMargin: Kirigami.Units.smallSpacing
23+
Text {
24+
text: root.customName !== "" ? `${root.customName}` : `${root.role}`
25+
color: root.scheme[root.onRole]
26+
font.bold: true
27+
font.pixelSize: Kirigami.Theme.defaultFont.pixelSize
28+
elide: Text.ElideRight
29+
Layout.fillWidth: true
30+
}
31+
Text {
32+
text: `${root.scheme[root.role]}`
33+
color: root.scheme[root.onRole]
34+
font.pixelSize: Kirigami.Theme.smallFont.pixelSize
35+
Layout.alignment: Qt.AlignRight
36+
opacity: 0.7
37+
font.family: "monospace"
38+
}
2739
}
2840

29-
Text {
30-
text: `${root.onRole}`
31-
color: root.scheme[root.onRole]
32-
font.pixelSize: Kirigami.Theme.smallFont.pixelSize
33-
visible: root.customName === ""
34-
elide: Text.ElideRight
35-
Layout.fillWidth: true
41+
RowLayout {
42+
Layout.leftMargin: Kirigami.Units.smallSpacing
43+
Layout.rightMargin: Kirigami.Units.smallSpacing
44+
Text {
45+
text: `${root.onRole}`
46+
color: root.scheme[root.onRole]
47+
font.pixelSize: Kirigami.Theme.smallFont.pixelSize
48+
opacity: root.customName === ""
49+
Layout.fillWidth: true
50+
elide: Text.ElideRight
51+
}
52+
Text {
53+
text: `${root.scheme[root.onRole]}`
54+
color: root.scheme[root.onRole]
55+
font.pixelSize: Kirigami.Theme.smallFont.pixelSize
56+
Layout.alignment: Qt.AlignRight
57+
opacity: 0.7
58+
font.family: "monospace"
59+
}
3660
}
3761
}
3862
}

src/plasmoid/package/contents/ui/components/ColorsPreview.qml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,27 +59,30 @@ ColumnLayout {
5959

6060
GridLayout {
6161
columns: 2
62-
rows: 10
62+
rows: 12
6363
columnSpacing: 0
6464
rowSpacing: 0
6565
flow: GridLayout.TopToBottom
6666
Repeater {
6767
model: [
6868
{ role: "primary", onRole: "onPrimary" },
69-
{ role: "primaryContainer", onRole: "onPrimaryContainer" },
69+
{ role: "primaryDim", onRole: "onPrimary" },
7070
{ role: "primaryFixed", onRole: "onPrimaryFixed" },
7171
{ role: "primaryFixed", onRole: "onPrimaryFixedVariant" },
7272
{ role: "primaryFixedDim", onRole: "onPrimaryFixed" },
73+
{ role: "primaryContainer", onRole: "onPrimaryContainer" },
7374
{ role: "tertiary", onRole: "onTertiary" },
74-
{ role: "tertiaryContainer", onRole: "onTertiaryContainer" },
75+
{ role: "tertiaryDim", onRole: "onTertiary" },
7576
{ role: "tertiaryFixed", onRole: "onTertiaryFixed" },
7677
{ role: "tertiaryFixed", onRole: "onTertiaryFixedVariant" },
7778
{ role: "tertiaryFixedDim", onRole: "onTertiaryFixed" },
79+
{ role: "tertiaryContainer", onRole: "onTertiaryContainer" },
7880
{ role: "secondary", onRole: "onSecondary" },
79-
{ role: "secondaryContainer", onRole: "onSecondaryContainer" },
81+
{ role: "secondaryDim", onRole: "onSecondary" },
8082
{ role: "secondaryFixed", onRole: "onSecondaryFixed" },
8183
{ role: "secondaryFixed", onRole: "onSecondaryFixedVariant" },
8284
{ role: "secondaryFixedDim", onRole: "onSecondaryFixed" },
85+
{ role: "secondaryContainer", onRole: "onSecondaryContainer" },
8386
]
8487
delegate: ColorRolePreview {
8588
required property var modelData
@@ -131,6 +134,7 @@ ColumnLayout {
131134
Repeater {
132135
model: [
133136
{ role: "error", onRole: "onError" },
137+
{ role: "errorDim", onRole: "onError" },
134138
{ role: "errorContainer", onRole: "onErrorContainer" },
135139
{ role: "outline", onRole: "onSurface" },
136140
{ role: "outlineVariant", onRole: "onSurface" },

0 commit comments

Comments
 (0)