ascii

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package ascii provides functionality for generating ASCII art representations of GitHub contribution graphs.

Index

Constants

View Source
const (
	// Basic blocks
	EmptyBlock  = ' ' // Represents days with no contributions
	FutureBlock = '.' // Represents future dates

	// Foundation blocks (bottom layer)
	FoundationLow  = '░' // 1-33% intensity
	FoundationMed  = '▒' // 34-66% intensity
	FoundationHigh = '▓' // 67-100% intensity

	// Middle blocks (intermediate layers)
	MiddleLow  = '░'
	MiddleMed  = '▒'
	MiddleHigh = '▓'

	// Top blocks (highest layer, using special characters for visual distinction)
	TopLow  = '╻' // Lower intensity peak
	TopMed  = '┃' // Medium intensity peak
	TopHigh = '╽' // High intensity peak
)

Block character sets for different contribution levels. The ASCII art uses different characters depending on the position (foundation, middle, top) and intensity (low, medium, high) of contributions.

View Source
const (
	LowThreshold    = 0.33 // 33% of max contributions
	MediumThreshold = 0.66 // 66% of max contributions
)

Contribution level thresholds as percentages of the maximum contribution count

View Source
const GridWidth = 53

GridWidth defines the standard width for the ASCII output.

View Source
const HeaderTemplate = `` /* 447-byte string literal not displayed */

HeaderTemplate contains the ASCII art header for the output.

Variables

View Source
var ErrInvalidGrid = errors.New("invalid contribution grid")

ErrInvalidGrid is returned when the contribution grid is invalid

Functions

func GenerateASCII

func GenerateASCII(contributionGrid [][]types.ContributionDay, username string, year int, includeHeader bool, includeUserInfo bool) (string, error)

GenerateASCII creates a 2D ASCII art representation of the contribution data. It returns the generated ASCII art as a string and an error if the operation fails. When includeHeader is true, the output includes the header template.

Types

This section is empty.

Jump to

Keyboard shortcuts

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