51 lines
1.3 KiB
QML
51 lines
1.3 KiB
QML
// A freedesktop symbolic icon, recoloured to a Theme token.
|
|
//
|
|
// Adwaita's symbolic SVGs carry a hardcoded near-black fill (#2e3436) and Qt
|
|
// does not do GTK's runtime recolouring, so drawn as-is they are invisible on
|
|
// a Tokyo Night background — verified on this machine. The fix is to paint a
|
|
// themed rectangle through the icon's alpha channel.
|
|
|
|
import QtQuick
|
|
import QtQuick.Effects
|
|
import Quickshell
|
|
import Quickshell.Widgets
|
|
import qs.config
|
|
|
|
Item {
|
|
id: root
|
|
|
|
property string icon: ""
|
|
property string iconFallback: "dialog-information-symbolic"
|
|
property color tint: Theme.fg
|
|
property int size: 18
|
|
|
|
implicitWidth: root.size
|
|
implicitHeight: root.size
|
|
|
|
// Both inputs are invisible but layered, so they render into textures
|
|
// without ever being composited onto the panel themselves.
|
|
IconImage {
|
|
id: glyph
|
|
anchors.fill: parent
|
|
asynchronous: true
|
|
source: Quickshell.iconPath(root.icon, root.iconFallback)
|
|
visible: false
|
|
layer.enabled: true
|
|
}
|
|
|
|
Rectangle {
|
|
id: fill
|
|
anchors.fill: parent
|
|
color: root.tint
|
|
visible: false
|
|
layer.enabled: true
|
|
}
|
|
|
|
MultiEffect {
|
|
anchors.fill: parent
|
|
source: fill
|
|
maskEnabled: true
|
|
maskSource: glyph
|
|
}
|
|
}
|