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:
parent
954a9e9cbc
commit
1cd92ed32e
1 changed files with 13 additions and 0 deletions
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue