diff --git a/src/qml/Theme.qml b/src/qml/Theme.qml index c0e24ae8..3fbbbf71 100644 --- a/src/qml/Theme.qml +++ b/src/qml/Theme.qml @@ -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 { diff --git a/src/qml/utils.js b/src/qml/utils.js index 62c01207..0e88376c 100644 --- a/src/qml/utils.js +++ b/src/qml/utils.js @@ -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}]