diff --git a/presentation/role.go b/presentation/role.go index c320b99..9769d5c 100644 --- a/presentation/role.go +++ b/presentation/role.go @@ -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), } } diff --git a/static/main.css b/static/main.css index 409d3de..b3ace6b 100644 --- a/static/main.css +++ b/static/main.css @@ -43,8 +43,11 @@ body { user-select: none; padding: 0.217rem; /* this is silly number pls ignore :3 (^noe) */ gap: 0.215rem; + cursor: pointer; + transition: all 0.35s ease-in-out; input { + cursor: pointer; appearance: none; position: relative; width: 1.216rem; @@ -52,9 +55,17 @@ body { margin: 0; padding: 0; border: 2px solid var(--role-color); - transition: all 0.35s ease-in-out; + transition: all 0.25s ease-in-out; border-radius: 1.216rem; + &:hover { + background-color: var(--role-color); + &::before { + opacity: 1; + background-color: var(--contrast-color); + } + } + &::before { transition: all 0.35s ease-in-out; content: ""; @@ -72,6 +83,7 @@ body { } label { + cursor: pointer; } &:has(input:checked) { diff --git a/templates/components/role.html b/templates/components/role.html index 40f0963..f65b1db 100644 --- a/templates/components/role.html +++ b/templates/components/role.html @@ -1,7 +1,7 @@ {{ $for := printf "category-%s_role-%s" .CategoryID .ID }}
= 0; i-- { + e := utils.GetRandomEmoji() + assert.Containsf(t, e.Name, "roleypolynext", "not valid on iteration %d", i) + } +} diff --git a/utils/template_fns.go b/utils/template_fns.go new file mode 100644 index 0000000..fbe7cc8 --- /dev/null +++ b/utils/template_fns.go @@ -0,0 +1,15 @@ +package utils + +import ( + "fmt" + + "git.sapphic.engineer/roleypoly/v4/types" +) + +func RoleInputID(c *types.Category, r *types.Role) string { + return fmt.Sprintf("category-%s_role-%s", c.ID, r.ID) +} + +func RoleInputName(c *types.Category) string { + return fmt.Sprintf("category_group_%s", c.ID) +} diff --git a/utils/template_fns_test.go b/utils/template_fns_test.go new file mode 100644 index 0000000..00d7131 --- /dev/null +++ b/utils/template_fns_test.go @@ -0,0 +1,17 @@ +package utils_test + +import ( + "testing" + + "git.sapphic.engineer/roleypoly/v4/types" + "git.sapphic.engineer/roleypoly/v4/utils" + "github.com/stretchr/testify/assert" +) + +func TestRoleInputID(t *testing.T) { + assert.Equal(t, "category-123_role-456", utils.RoleInputID(&types.Category{ID: "123"}, &types.Role{ID: "456"})) +} + +func TestRoleInputName(t *testing.T) { + assert.Equal(t, "category_group_123", utils.RoleInputName(&types.Category{ID: "123"})) +}