animation: Use appropriate spinner asset in light variant
Ideally we would replace the sliced-image based animation with a themed `process-working-symbolic` icon and rotate it, so the spinner simply picks up the current foreground color. Unfortunately the `repeat-count` property does not work for rotations, so to fix the broken spinner in the light variant in the meantime, include assets for both variants and swap them out at runtime. Not everything in the light variant is actually light (overview, OSDs, ...), so use a simple heuristic on the text color to decide which asset to use. Close https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6783 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3080>
This commit is contained in:

committed by
Marge Bot

parent
74445249db
commit
1dda339395
@ -138,8 +138,24 @@ class Spinner extends AnimatedIcon {
|
||||
animate: false,
|
||||
hideOnStop: false,
|
||||
});
|
||||
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
|
||||
super._init(file, size);
|
||||
this._fileDark = Gio.File.new_for_uri(
|
||||
'resource:///org/gnome/shell/theme/process-working-dark.svg');
|
||||
this._fileLight = Gio.File.new_for_uri(
|
||||
'resource:///org/gnome/shell/theme/process-working-light.svg');
|
||||
super._init(this._fileDark, size);
|
||||
|
||||
this.connect('style-changed', () => {
|
||||
const themeNode = this.get_theme_node();
|
||||
const textColor = themeNode.get_foreground_color();
|
||||
const [, luminance] = textColor.to_hls();
|
||||
const file = luminance > 0.5
|
||||
? this._fileDark
|
||||
: this._fileLight;
|
||||
if (file !== this._file) {
|
||||
this._file = file;
|
||||
this._loadFile();
|
||||
}
|
||||
});
|
||||
|
||||
this.opacity = 0;
|
||||
this._animate = params.animate;
|
||||
|
Reference in New Issue
Block a user