dash-to-dock icon indicating copy to clipboard operation
dash-to-dock copied to clipboard

Dominant color CSS doesn't work for some apps

Open Misery7100 opened this issue 3 years ago • 3 comments

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

image

Misery7100 avatar Jul 29 '21 20:07 Misery7100

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 avatar Jul 29 '21 21:07 Misery7100

@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];
   }
}

cjkr avatar Aug 23 '21 12:08 cjkr

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];
    }
 }

jrom99 avatar Mar 21 '22 02:03 jrom99