role color stuff

This commit is contained in:
41666 2025-04-05 23:38:02 -07:00
parent 41d48bf60a
commit f72c7a357b
9 changed files with 165 additions and 14 deletions

View file

@ -1,8 +1,6 @@
package presentation
import (
"fmt"
"git.sapphic.engineer/roleypoly/v4/types"
"git.sapphic.engineer/roleypoly/v4/utils"
)
@ -43,6 +41,7 @@ func Role(category *types.Category, role *types.Role, selected bool) Presentable
type PresentableRoleColors struct {
Main string
Alt string
IsDark bool
}
@ -50,9 +49,11 @@ func GetColors(roleColor uint32) PresentableRoleColors {
// TODO: no color
r, g, b := utils.IntToRgb(roleColor)
altR, altG, altB := utils.AltColor(r, g, b)
return PresentableRoleColors{
Main: fmt.Sprintf("#%x", roleColor),
Main: utils.RgbToString(r, g, b),
Alt: utils.RgbToString(altR, altG, altB),
IsDark: utils.IsDarkColor(r, g, b),
}
}