Skip to content

Commit 55ba059

Browse files
committed
feat: frames and outlines contrast
1 parent 2515814 commit 55ba059

6 files changed

Lines changed: 82 additions & 8 deletions

File tree

src/kde_material_you_colors/apply_themes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def apply(config: Configs, wallpaper: WallpaperReader, dark_light):
3535
config.read("toolbar_opacity"),
3636
config.read("toolbar_opacity_dark"),
3737
config.read("custom_colors_list"),
38+
config.read("frame_contrast"),
3839
)
3940

4041
# Export generated schemes to output file

src/kde_material_you_colors/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ def defaults(self):
177177
"scheme_variant": [args.scheme_variant, 5, 1],
178178
"chroma_multiplier": [args.chroma_multiplier, 1, 2],
179179
"tone_multiplier": [args.tone_multiplier, 1, 2],
180+
"frame_contrast": [args.frame_contrast, 1, 2],
180181
"qdbus_executable": [args.qdbus_executable, None, 3],
181182
"manual_fetch": [args.manual_fetch, False, 0],
182183
"fetch_colors": [None, False, 0],

src/kde_material_you_colors/data/sample_config.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ chroma_multiplier = 1
206206
# Default is 1
207207
tone_multiplier = 1
208208

209+
# Frames and outlines contrast
210+
# A float between 0 and 1
211+
# Default is 0.2
212+
frame_contrast = 1
213+
209214
# QDbus executable
210215
# Name or location of the QDbus executable e.g qdbus6, qdbus-qt6...
211216
# Default is qdbus6

src/kde_material_you_colors/main.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,14 @@ def main():
362362
default=None,
363363
)
364364

365+
parser.add_argument(
366+
"--frame-contrast",
367+
type=float,
368+
help="Frames and outlines contrast, (value from 0 to 1, default is 0.2)",
369+
default=None,
370+
metavar="<float>",
371+
)
372+
365373
# Get commandline arguments
366374
args = parser.parse_args()
367375
# Check for one shot arguments

src/kde_material_you_colors/schemeconfigs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def __init__(
2121
toolbar_opacity=None,
2222
toolbar_opacity_dark=None,
2323
custom_colors_list=None,
24+
frame_contrast=None,
2425
):
2526
if custom_colors_list is not None:
2627
colors_best = custom_colors_list
@@ -368,6 +369,7 @@ def __init__(
368369
369370
[KDE]
370371
contrast=4
372+
frameContrast={frame_contrast if frame_contrast is not None else 0.2}
371373
372374
[WM]
373375
activeBackground={hex2alpha(colors_light["surfaceContainerHighest"],toolbar_opacity)}
@@ -519,6 +521,7 @@ def __init__(
519521
520522
[KDE]
521523
contrast=4
524+
frameContrast={frame_contrast if frame_contrast is not None else 0.2}
522525
523526
[WM]
524527
activeBackground={hex2alpha(colors_dark['surfaceContainerHighest'],toolbar_opacity_dark)}

src/plasmoid/package/contents/ui/FullRepresentation.qml

Lines changed: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ ColumnLayout {
551551
property int scheme_variant: 5; \
552552
property real chroma_multiplier: 1.0; \
553553
property real tone_multiplier: 1.0; \
554+
property real frame_contrast: 1.0; \
554555
}';
555556

556557
settings = Qt.createQmlObject(settingsString, mainLayout, "settingsObject");
@@ -1354,7 +1355,6 @@ ColumnLayout {
13541355
}
13551356
}
13561357

1357-
13581358
PlasmaComponents3.ToolButton {
13591359
Layout.alignment: Qt.AlignHCenter
13601360
text: fullRepresentation.showAdvanced?"Hide advanced settings":"Show advanced settings"
@@ -1869,13 +1869,6 @@ ColumnLayout {
18691869
opacity: dividerOpacity
18701870
}
18711871

1872-
Rectangle {
1873-
Layout.preferredWidth: mainLayout.width
1874-
height: 1
1875-
color: dividerColor
1876-
opacity: dividerOpacity
1877-
}
1878-
18791872
PlasmaExtras.Heading {
18801873
level: 1
18811874
text: "Delay & screenshot options"
@@ -2082,6 +2075,69 @@ ColumnLayout {
20822075
}
20832076
}
20842077

2078+
Rectangle {
2079+
Layout.topMargin: Kirigami.Units.mediumSpacing
2080+
Layout.preferredWidth: mainLayout.width
2081+
height: 1
2082+
color: dividerColor
2083+
opacity: dividerOpacity
2084+
visible: fullRepresentation.showAdvanced
2085+
}
2086+
2087+
PlasmaExtras.Heading {
2088+
level: 1
2089+
text: "Frames and outlines"
2090+
Layout.alignment: Qt.AlignHCenter
2091+
visible: fullRepresentation.showAdvanced
2092+
}
2093+
2094+
// Outline contrast
2095+
RowLayout {
2096+
visible: fullRepresentation.showAdvanced
2097+
PlasmaComponents3.Label {
2098+
text: "Contrast"
2099+
Layout.alignment: Qt.AlignLeft
2100+
}
2101+
2102+
PlasmaComponents3.Slider {
2103+
value: settings.frame_contrast
2104+
from: 0.0
2105+
to: 1
2106+
Layout.fillWidth: true
2107+
onValueChanged: {
2108+
settings.frame_contrast = value.toFixed(2)
2109+
}
2110+
}
2111+
2112+
PlasmaComponents3.TextField {
2113+
Layout.preferredWidth: controlWidth
2114+
placeholderText: "0-4"
2115+
horizontalAlignment: TextInput.AlignHCenter
2116+
text: parseFloat(settings.frame_contrast)
2117+
2118+
validator: DoubleValidator {
2119+
bottom: 0
2120+
top: 1
2121+
decimals: 2
2122+
notation: DoubleValidator.StandardNotation
2123+
}
2124+
2125+
onAccepted: {
2126+
settings.frame_contrast = parseFloat(text)
2127+
}
2128+
}
2129+
}
2130+
2131+
PlasmaComponents3.Label {
2132+
text: "Values below 15% may produce visually awkward effects with some applications and color schemes."
2133+
Layout.fillWidth: true
2134+
color: Kirigami.Theme.neutralTextColor
2135+
wrapMode: PlasmaComponents3.Label.WordWrap
2136+
font: Kirigami.Theme.smallFont
2137+
visible: fullRepresentation.showAdvanced && settings.frame_contrast < 0.15
2138+
}
2139+
2140+
20852141
Rectangle {
20862142
Layout.topMargin: Kirigami.Units.mediumSpacing
20872143
Layout.preferredWidth: mainLayout.width

0 commit comments

Comments
 (0)