feat(SQ/Theme): Extended `getColor` allowing random colors

- It extends `getColor` method to be used also to get random colors with alpha param.
This commit is contained in:
Noelia 2023-10-23 15:40:00 +02:00 committed by Michał Iskierko
parent f1d4462f69
commit 1600b5fc11
1 changed files with 8 additions and 2 deletions

View File

@ -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
}
}