diff --git a/components/mobileshell/qml/components/StartupFeedback.qml b/components/mobileshell/qml/components/StartupFeedback.qml index 36f45a9a..9e4c3099 100644 --- a/components/mobileshell/qml/components/StartupFeedback.qml +++ b/components/mobileshell/qml/components/StartupFeedback.qml @@ -29,8 +29,7 @@ MouseArea { // use mousearea to ensure clicks don't go behind background.scale = 0; backgroundParent.x = -root.width/2 + x backgroundParent.y = -root.height/2 + y - colorGenerator.resetColor(); - icon.source = splashIcon; + updateIconSource(splashIcon); if (ShellSettings.Settings.animationsEnabled) { openAnimComplex.restart(); @@ -66,13 +65,24 @@ MouseArea { // use mousearea to ensure clicks don't go behind background.scale = 0.5; backgroundParent.x = 0 backgroundParent.y = 0 - colorGenerator.resetColor(); - icon.source = iconName + root.updateIconSource(iconName); openAnimComplex.restart(); } } } + function updateIconSource(source) { + if (icon.source !== source) { + // the colors are generated async from the icon, so we need to ensure we don't display an old color + // for a moment when an app opens + colorGenerator.resetColor(); + } else { + // case where we set the same icon, ensure the color is set + colorGenerator.updateColor(); + } + icon.source = source; + } + Kirigami.ImageColors { id: colorGenerator source: icon.source @@ -84,9 +94,13 @@ MouseArea { // use mousearea to ensure clicks don't go behind function resetColor() { colorToUse = 'transparent'; } - onPaletteChanged: { + function updateColor() { colorToUse = colorGenerator.dominant; } + onPaletteChanged: { + // update color once palette has loaded + updateColor(); + } } // animation that moves the icon