This is because KSvg.Svg {} uses of KColorScheme's global color palette instead of the locally inherited colors. We can change the "colorSet" but we can't use the palette
// SidebarViewButton.qml
SidebarItem {
...
// From FlatButton.qml, modifed so icon is also 16px
property int iconSize: Kirigami.Units.iconSizes.roundedIconSize(config.flatButtonIconSize)
default property alias shapePathChildren: shapePath.pathElements
property int viewBoxSize: 16
readonly property real viewBoxScale: control.iconSize / control.viewBoxSize
Shape {
ShapePath {
id: shapePath
scale: Qt.size(control.viewBoxScale, control.viewBoxScale)
fillColor: control.checked ? Kirigami.Theme.highlightColor : Kirigami.Theme.textColor
fillRule: ShapePath.WindingFill
strokeWidth: -1
PathSvg { path: "m 1,3 v 4 h 9 V 3 Z M 2,4 H 9 V 6 H 2 Z" }
PathSvg { path: "m 11,3 v 4 h 4 V 3 Z m 1,1 h 2 v 2 h -2 z" }
PathSvg { path: "M 1,8 1,12 H 5 l 0,-4 z m 1,1 h 2 l 0,2 H 2 Z" }
PathSvg { path: "M 6,8 V 12 h 9 V 8 Z m 1,1 h 7 V 11 H 7 Z" }
}
preferredRendererType: Shape.CurveRenderer // Aliasing
width: control.iconSize
height: control.iconSize
anchors.centerIn: parent
// From FlatButton.qml
scale: control.zoomOnPush && control.pressed ? (control.height-5) / control.height : 1
Behavior on scale { NumberAnimation { duration: 200 } }
}
...
}
Eg:
This is because
KSvg.Svg {}
uses of KColorScheme's global color palette instead of the locally inherited colors. We can change the "colorSet" but we can't use the paletteHowever the KIconTheme uses the current palette for the icon colors.
My solution is to embed the svg paths with a QML Shape ShapePath PathSvg.