forked from Shinonome/dots-hyprland
hefty: bar: workspace widget
This commit is contained in:
@@ -109,7 +109,8 @@ Singleton {
|
||||
*/
|
||||
function transparentize(color, percentage = 1) {
|
||||
var c = Qt.color(color);
|
||||
return Qt.rgba(c.r, c.g, c.b, c.a * (1 - percentage));
|
||||
var a = c.a * (1 - clamp01(percentage));
|
||||
return Qt.rgba(c.r, c.g, c.b, a);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,7 +122,7 @@ Singleton {
|
||||
*/
|
||||
function applyAlpha(color, alpha) {
|
||||
var c = Qt.color(color);
|
||||
var a = Math.max(0, Math.min(1, alpha));
|
||||
var a = clamp01(alpha);
|
||||
return Qt.rgba(c.r, c.g, c.b, a);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
pragma Singleton
|
||||
import Quickshell
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
/**
|
||||
* Rounds the given number to the nearest even integer.
|
||||
*
|
||||
* @param {number} num - The number to round.
|
||||
* @returns {number} The nearest even integer.
|
||||
*/
|
||||
function roundToEven(num) {
|
||||
return Math.round(num / 2) * 2;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user