aboutsummaryrefslogtreecommitdiffstats
path: root/config/quickshell/overview/common/functions
diff options
context:
space:
mode:
authorDonald Williams <129223418+dwilliam62@users.noreply.github.com>2025-12-11 12:32:33 -0500
committerGitHub <noreply@github.com>2025-12-11 12:32:33 -0500
commit1d67791220aacb211a84d90ef030a352e402bd80 (patch)
treefc87b1a5e413e906bcc47cf8abf389c2bbd51b71 /config/quickshell/overview/common/functions
parentbcfd5e7c2b67f0a62b1ceeb62d20b0a80ca55a70 (diff)
parentbd5ca3f57c5c2b4a9c8602025cc38e4140b1d5a3 (diff)
Merge pull request #881 from JaKooLit/development
Development to main Major update v2.3.18
Diffstat (limited to 'config/quickshell/overview/common/functions')
-rw-r--r--config/quickshell/overview/common/functions/ColorUtils.qml68
-rw-r--r--config/quickshell/overview/common/functions/qmldir1
2 files changed, 69 insertions, 0 deletions
diff --git a/config/quickshell/overview/common/functions/ColorUtils.qml b/config/quickshell/overview/common/functions/ColorUtils.qml
new file mode 100644
index 00000000..6162df18
--- /dev/null
+++ b/config/quickshell/overview/common/functions/ColorUtils.qml
@@ -0,0 +1,68 @@
+pragma Singleton
+import Quickshell
+
+Singleton {
+ id: root
+
+ function colorWithHueOf(color1, color2) {
+ var c1 = Qt.color(color1);
+ var c2 = Qt.color(color2);
+ var hue = c2.hsvHue;
+ var sat = c1.hsvSaturation;
+ var val = c1.hsvValue;
+ var alpha = c1.a;
+ return Qt.hsva(hue, sat, val, alpha);
+ }
+
+ function colorWithSaturationOf(color1, color2) {
+ var c1 = Qt.color(color1);
+ var c2 = Qt.color(color2);
+ var hue = c1.hsvHue;
+ var sat = c2.hsvSaturation;
+ var val = c1.hsvValue;
+ var alpha = c1.a;
+ return Qt.hsva(hue, sat, val, alpha);
+ }
+
+ function colorWithLightness(color, lightness) {
+ var c = Qt.color(color);
+ return Qt.hsla(c.hslHue, c.hslSaturation, lightness, c.a);
+ }
+
+ function colorWithLightnessOf(color1, color2) {
+ var c2 = Qt.color(color2);
+ return colorWithLightness(color1, c2.hslLightness);
+ }
+
+ function adaptToAccent(color1, color2) {
+ var c1 = Qt.color(color1);
+ var c2 = Qt.color(color2);
+ var hue = c2.hslHue;
+ var sat = c2.hslSaturation;
+ var light = c1.hslLightness;
+ var alpha = c1.a;
+ return Qt.hsla(hue, sat, light, alpha);
+ }
+
+ function mix(color1, color2, percentage = 0.5) {
+ var c1 = Qt.color(color1);
+ var c2 = Qt.color(color2);
+ return Qt.rgba(
+ percentage * c1.r + (1 - percentage) * c2.r,
+ percentage * c1.g + (1 - percentage) * c2.g,
+ percentage * c1.b + (1 - percentage) * c2.b,
+ percentage * c1.a + (1 - percentage) * c2.a
+ );
+ }
+
+ function transparentize(color, percentage = 1) {
+ var c = Qt.color(color);
+ return Qt.rgba(c.r, c.g, c.b, c.a * (1 - percentage));
+ }
+
+ function applyAlpha(color, alpha) {
+ var c = Qt.color(color);
+ var a = Math.max(0, Math.min(1, alpha));
+ return Qt.rgba(c.r, c.g, c.b, a);
+ }
+}
diff --git a/config/quickshell/overview/common/functions/qmldir b/config/quickshell/overview/common/functions/qmldir
new file mode 100644
index 00000000..4c648e7e
--- /dev/null
+++ b/config/quickshell/overview/common/functions/qmldir
@@ -0,0 +1 @@
+singleton ColorUtils 1.0 ColorUtils.qml
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage