Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/hcarriz/go-boring-avatars

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/hcarriz/go-boring-avatars

  • v0.0.0-20241030051722-758cb300b139
  • Source
  • Go
  • Socket score

Version published
Created
Source

Go Boring Avatars

Go Report Card Go Reference

Go Boring Avatars is a tiny, zero-dependency go package that generates custom, SVG-based avatars from any username and color palette.

Install

go get github.com/hcarriz/go-boring-avatars

Usage

package main

import (
	"io"
	"log/slog"
	"net/http"
	"os"
	"time"

	goboringavatars "github.com/hcarriz/go-boring-avatars"
)

func main() {

	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {

		// Generate a random avatar for every request.
		avatar, _ := goboringavatars.New(time.Now().String())

		// Serve the image.
		w.Header().Set("Content-Type", "image/svg+xml; charset=utf-8")
		io.WriteString(w, avatar)

	})

	if err := http.ListenAndServe(":8000", nil); err != nil {
		slog.Error("closing server", slog.String("error", err.Error()))
		os.Exit(1)
	}

}

Config

See the docs for configuration options.

FAQs

Package last updated on 30 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc