func (r *resourceUser) GenerateAvatar(userId string) error { args := map[string]string{} gp := geopattern.Generate(args) //Create svg file f, err := os.Create(config.AvatarPath + userId + ".svg") if err != nil { return err } defer f.Close() _, err = f.WriteString(gp) return err }
// Prints pattern's SVG string with a specific background color func main() { args := map[string]string{"color": "#f9b"} gp := geopattern.Generate(args) fmt.Println(gp) }
// Prints pattern's SVG string for a specific pattern func main() { args := map[string]string{"generator": "squares"} gp := geopattern.Generate(args) fmt.Println(gp) }
// Prints pattern's SVG string without any argument func main() { args := map[string]string{} gp := geopattern.Generate(args) fmt.Println(gp) }