dash-to-dock
dash-to-dock copied to clipboard
Dominant color CSS doesn't work for some apps
Ubuntu 20.04.2 LTS GNOME Shell 3.36.9
I've seen similar issue, but don't know why now it like that. All is fine without dominant color, naturally
At least adding fallback with default white
color makes it better
https://github.com/micheleg/dash-to-dock/blob/302c6932617fc12b8f9382db71906e7ec32fff3b/appIconIndicators.js#L385-L391
// Apply dominant color if requested
if (settings.get_boolean('running-indicator-dominant-color')) {
let colorPalette = this._dominantColorExtractor._getColorPalette();
if (colorPalette !== null) {
this._bodyColor = Clutter.color_from_string(colorPalette.original)[1];
} else {
this._bodyColor = Clutter.color_from_string('white')[1];
}
}
@Misery7100, the solution you offered worked for me if I add a try-catch block as so:
// Apply dominant color if requested
if (settings.get_boolean('running-indicator-dominant-color')) {
try {
let colorPalette = this._dominantColorExtractor._getColorPalette();
if (colorPalette !== null) {
this._bodyColor = Clutter.color_from_string(colorPalette.original)[1];
}
} catch {
this._bodyColor = Clutter.color_from_string('white')[1];
}
}
I don't know if this is any better, but I found it easier to just reuse the other setting for this, since they are mutually exclusive at this point.
// Apply dominant color if requested
if (settings.get_boolean('running-indicator-dominant-color')) {
try {
let colorPalette = this._dominantColorExtractor._getColorPalette();
if (colorPalette !== null) {
this._bodyColor = Clutter.color_from_string(colorPalette.original)[1];
} else {
this._bodyColor = Clutter.color_from_string(settings.get_string('custom-theme-running-dots-color'))[1];
}
} catch {
this._bodyColor = Clutter.color_from_string(settings.get_string('custom-theme-running-dots-color'))[1];
}
}