Add normal hsl and hsla functions
This commit is contained in:
parent
fa61e8f0e3
commit
cf13315d4f
|
@ -2,6 +2,7 @@
|
|||
// This file is part of harmonyqml, licensed under LGPLv3.
|
||||
|
||||
import QtQuick 2.12
|
||||
import "utils.js" as Ut
|
||||
|
||||
QtObject {
|
||||
id: theme
|
||||
|
@ -44,6 +45,7 @@ QtObject {
|
|||
property color foregroundDim2: Qt.hsla(0, 0, 0.3, 1)
|
||||
property color foregroundError: Qt.hsla(0.95, 0.64, 0.32, 1)
|
||||
property color textBorder: Qt.hsla(0, 0, 0, 0.07)
|
||||
property color accent: Ut.hsl(160, 62, 55)
|
||||
}
|
||||
|
||||
property QtObject controls: QtObject {
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
// Copyright 2019 miruka
|
||||
// This file is part of harmonyqml, licensed under LGPLv3.
|
||||
|
||||
|
||||
function hsl(hue, saturation, lightness) {
|
||||
return hsla(hue, saturation, lightness, 1.0)
|
||||
}
|
||||
|
||||
|
||||
function hsla(hue, saturation, lightness, alpha) {
|
||||
// Convert standard hsla(0-360, 1-100, 1-100, 0-1) to Qt format
|
||||
return Qt.hsla(hue / 360, saturation / 100, lightness / 100, alpha)
|
||||
}
|
||||
|
||||
|
||||
function arrayToModelItem(keys_name, array) {
|
||||
// Convert an array to an object suitable to be in a model, example:
|
||||
// [1, 2, 3] → [{keys_name: 1}, {keys_name: 2}, {keys_name: 3}]
|
||||
|
|
Loading…
Reference in New Issue
Block a user