1
0
Fork 0
mirror of https://github.com/Luzifer/streamdeck.git synced 2024-12-20 17:51:21 +00:00

Add background_color attribute to exec display elements

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-08-14 16:11:44 +02:00
parent 954a9e9cbc
commit 1cd92ed32e
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -62,6 +62,19 @@ func (d displayElementExec) Display(ctx context.Context, idx int, attributes att
}
// Initialize background
if attributes.BackgroundColor != nil {
if len(attributes.BackgroundColor) != 4 {
return errors.New("Background color definition needs 4 hex values")
}
if err := ctx.Err(); err != nil {
// Page context was cancelled, do not draw
return err
}
imgRenderer.DrawBackgroundColor(attributes.BackgroundToColor())
}
if attributes.Image != "" {
if err = imgRenderer.DrawBackgroundFromFile(attributes.Image); err != nil {
return errors.Wrap(err, "Unable to draw background from disk")