Skip to content

Commit

Permalink
feat(SQ/Theme): Extended getColor allowing random colors
Browse files Browse the repository at this point in the history
- It extends `getColor` method to be used also to get random colors with alpha param.
  • Loading branch information
noeliaSD authored and endulab committed Nov 8, 2023
1 parent f1d4462 commit 1600b5f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ui/StatusQ/src/StatusQ/Core/Theme/ThemePalette.qml
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,13 @@ QtObject {
}

function getColor(name, alpha) {
return !!alpha ? alphaColor(StatusColors.colors[name], alpha)
: StatusColors.colors[name]
if(StatusColors.colors[name])
// It means name is just the key to find inside the specific `StatusColors` object
return !!alpha ? alphaColor(StatusColors.colors[name], alpha)
: StatusColors.colors[name]
else
// It means name is directly the color itself
return !!alpha ? alphaColor(name, alpha)
: name
}
}

0 comments on commit 1600b5f

Please sign in to comment.