add color to svg

This commit is contained in:
2024-10-19 16:36:47 -05:00
parent 9c33a61570
commit aebd25dc16
16 changed files with 318 additions and 142 deletions

View File

@@ -63,6 +63,7 @@ func (n *NKodeAPI) GenerateSignupResetInterface(userEmail UserEmail, customerId
UserIdxInterface: signupSession.SetIdxInterface,
SvgInterface: svgInterface,
SessionId: uuid.UUID(signupSession.Id).String(),
Colors: signupSession.Colors,
}
return &resp, nil
}
@@ -143,6 +144,7 @@ func (n *NKodeAPI) GetLoginInterface(userEmail UserEmail, customerId CustomerId)
SvgInterface: svgInterface,
NumbOfKeys: user.Kp.NumbOfKeys,
AttrsPerKey: user.Kp.AttrsPerKey,
Colors: SetColors,
}
return &resp, nil
}
@@ -190,10 +192,6 @@ func (n *NKodeAPI) RandomSvgInterface() ([]string, error) {
return n.Db.RandomSvgInterface(KeypadMax)
}
func (n *NKodeAPI) GetSvgStringInterface(svgId SvgIdInterface) ([]string, error) {
return n.Db.GetSvgStringInterface(svgId)
}
func (n *NKodeAPI) RefreshToken(userEmail UserEmail, customerId CustomerId, refreshToken string) (string, error) {
user, err := n.Db.GetUser(userEmail, customerId)
if err != nil {
@@ -244,3 +242,11 @@ func (n *NKodeAPI) ResetNKode(userEmail UserEmail, customerId CustomerId) error
n.EmailQueue.AddEmail(email)
return nil
}
func getColors(colorIds []int) []RGBColor {
colors := make([]RGBColor, len(colorIds))
for idx, colorIdx := range colorIds {
colors[idx] = SetColors[colorIdx]
}
return colors
}