graph

package
v0.0.0-...-ddb0ef1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package graph allows rendering an isometric projection of a GitHub user's contribution history.

Index

Constants

View Source
const (
	Color0 = "#ebedf0"
	Color1 = "#9be9a8"
	Color2 = "#40c463"
	Color3 = "#30a14e"
	Color4 = "#216e39"

	ColorDark0 = "#2d333b"
	ColorDark1 = "#0e4429"
	ColorDark2 = "#006d32"
	ColorDark3 = "#26a641"
	ColorDark4 = "#39d353"

	HalloweenColor0 = "#ebedf0"
	HalloweenColor1 = "#ffee4a"
	HalloweenColor2 = "#ffc501"
	HalloweenColor3 = "#fe9600"
	HalloweenColor4 = "#03001c"

	HalloweenDarkColor0 = "#161b22"
	HalloweenDarkColor1 = "#631c03"
	HalloweenDarkColor2 = "#bd561d"
	HalloweenDarkColor3 = "#fa7a18"
	HalloweenDarkColor4 = "#fddf68"
)

Variables

View Source
var DarkTheme = func(color string) string {
	switch color {
	case Color0:
		return ColorDark0
	case Color1:
		return ColorDark1
	case Color2:
		return ColorDark2
	case Color3:
		return ColorDark3
	case Color4:
		return ColorDark4
	default:
		return "#2d333b"
	}
}
View Source
var HalloweenDarkTheme = func(color string) string {
	switch color {
	case Color0:
		return HalloweenDarkColor0
	case Color1:
		return HalloweenDarkColor1
	case Color2:
		return HalloweenDarkColor2
	case Color3:
		return HalloweenDarkColor3
	case Color4:
		return HalloweenDarkColor4
	}
	return "#2d333b"
}
View Source
var HalloweenLightTheme = func(color string) string {
	switch color {
	case Color0:
		return HalloweenColor0
	case Color1:
		return HalloweenColor1
	case Color2:
		return HalloweenColor2
	case Color3:
		return HalloweenColor3
	case Color4:
		return HalloweenColor4
	}
	return "#ebedf0"
}
View Source
var LightTheme = func(color string) string {
	switch color {
	case Color0:
		return Color0
	case Color1:
		return Color1
	case Color2:
		return Color2
	case Color3:
		return Color3
	case Color4:
		return Color4
	}
	return "#ebedf0"
}

Functions

This section is empty.

Types

type ContributionDay

type ContributionDay struct {
	Count int
	Color string
}

type Graph

type Graph struct {
	// contains filtered or unexported fields
}

Graph is a graph instance that is used to render a contributions graph.

func New

func New(contribs []ContributionDay) *Graph

New creates a graph instance with the contributions-per-day that are passed. Graph.Render can then be used to render the graph.

func (*Graph) Render

func (g *Graph) Render(f io.WriteCloser, theme Theme) error

Render writes the generated SVG to the given io.Writer in the appropriate Theme.

type Theme

type Theme func(string) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL