diff --git a/internal/slideshow/palette.go b/internal/slideshow/palette.go index f3a3d86..cd499af 100644 --- a/internal/slideshow/palette.go +++ b/internal/slideshow/palette.go @@ -13,14 +13,15 @@ import ( ) // write the base16 color palette to a file -func exportPalette(image string) error { +func exportPalette(image string) { if !config.IsPaletteSet() { - return nil + return } var palette string colors, error := getColorPalette(image, 16) if error != nil { - return error + loggo.Error("encountered an error getting the color palette for image", "image: "+image, error.Error()) + return } for index, color := range colors { if index > 0 { @@ -33,7 +34,10 @@ func exportPalette(image string) error { tmp = "SLIDESHOW_COLOR" + tmp palette += tmp + "=\"" + rgbToHex(color) + "\"" } - return os.WriteFile(config.Palette, []byte(palette), 0775) + error = os.WriteFile(config.Palette, []byte(palette), 0775) + if error != nil { + loggo.Error("encountered an error exporting the color palette for image", "image: "+image, error.Error()) + } } // get the base16 color palette from an image diff --git a/internal/slideshow/slideshow.go b/internal/slideshow/slideshow.go index f5495af..5c4a453 100644 --- a/internal/slideshow/slideshow.go +++ b/internal/slideshow/slideshow.go @@ -45,10 +45,7 @@ func Start() { loggo.Debug("sleeping for " + strconv.FormatInt(sleepTime.Milliseconds(), 10) + "ms") time.Sleep(sleepTime) } - error := exportPalette(image) - if error != nil { - loggo.Error("encountered an error exporting the color palette for image", "image: "+image, error.Error()) - } + go exportPalette(image) if scaleImages { error := setBackgroundPiped(data) if error != nil {