summaryrefslogtreecommitdiff
path: root/components/effects/ColouredIcon.qml
blob: a858c2500904cc08dab75992130125dfea7b8804 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
pragma ComponentBehavior: Bound

import Caelestia
import Quickshell.Widgets
import QtQuick

IconImage {
    id: root

    required property color colour
    property color dominantColour

    asynchronous: true

    layer.enabled: true
    layer.effect: Colouriser {
        sourceColor: root.dominantColour
        colorizationColor: root.colour
    }

    layer.onEnabledChanged: {
        if (layer.enabled)
            CUtils.getDominantColour(this);
    }

    onStatusChanged: {
        if (layer.enabled && status === Image.Ready)
            CUtils.getDominantColour(this);
    }
}