Skip to content

Commit 5f72ab1

Browse files
author
Marko Petzold
committed
fix: handle additional color formats in background color processing
1 parent 553f2d3 commit 5f72ab1

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/widget-form.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,10 @@ export class WidgetForm extends LitElement {
478478
const bgColorOpaque = bgColor?.startsWith('rgba')
479479
? bgColor.replace(/rgba\(([^)]+),\s*[\d.]+\)/, 'rgb($1)')
480480
: bgColor?.startsWith('#') && bgColor.length === 9
481-
? bgColor.substring(0, 7)
482-
: bgColor
481+
? bgColor.substring(0, 7) // #RRGGBBAA -> #RRGGBB
482+
: bgColor?.startsWith('#') && bgColor.length === 5
483+
? bgColor.substring(0, 4) // #RGBA -> #RGB
484+
: bgColor
483485
return html`
484486
<style>
485487
:host {

0 commit comments

Comments
 (0)