- Core library with SVG and PNG generation - CLI tool with generate and batch commands - Cross-platform path handling for Windows compatibility - Comprehensive test suite with integration tests
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
// Package jdenticon provides a Go library for generating highly recognizable identicons -
|
|
// geometric avatar images generated deterministically from any input string.
|
|
//
|
|
// This package wraps the internal/engine functionality to provide a clean, thread-safe
|
|
// public API that follows Go idioms and conventions.
|
|
//
|
|
// Basic usage:
|
|
//
|
|
// // Generate with default configuration
|
|
// icon, err := jdenticon.Generate("user@example.com", 200)
|
|
// if err != nil {
|
|
// log.Fatal(err)
|
|
// }
|
|
//
|
|
// // Render as SVG
|
|
// svgData, err := icon.ToSVG()
|
|
// if err != nil {
|
|
// log.Fatal(err)
|
|
// }
|
|
//
|
|
// // Render as PNG
|
|
// pngData, err := icon.ToPNG()
|
|
// if err != nil {
|
|
// log.Fatal(err)
|
|
// }
|
|
//
|
|
// Advanced usage with custom configuration:
|
|
//
|
|
// // Create custom configuration
|
|
// config := jdenticon.DefaultConfig()
|
|
// config.ColorSaturation = 0.7
|
|
// config.Padding = 0.1
|
|
// config.BackgroundColor = "#ffffff"
|
|
//
|
|
// // Create generator with caching
|
|
// generator, err := jdenticon.NewGeneratorWithConfig(config, 100)
|
|
// if err != nil {
|
|
// log.Fatal(err)
|
|
// }
|
|
//
|
|
// // Generate multiple icons efficiently
|
|
// icon1, err := generator.Generate("user1@example.com", 64)
|
|
// icon2, err := generator.Generate("user2@example.com", 64)
|
|
//
|
|
// The library is designed to be thread-safe and performant, with LRU caching
|
|
// and singleflight to prevent duplicate work.
|
|
package jdenticon
|