habit

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation ยถ

Index ยถ

Constants ยถ

View Source
const (
	DefaultIcon  = "weights"
	DefaultColor = "blue"
)

Variables ยถ

View Source
var (
	// IconValues lists the icon names HEY accepts for habits.
	IconValues = iconNames()
	// ColorValues lists the color names HEY accepts for habits.
	ColorValues = strings.Join(Colors, ", ")
)
View Source
var Colors = []string{"blue", "red", "gold", "green", "teal", "purple", "pink", "brown"}

Colors are the habit colors HEY accepts, in the order its own enum declares them.

View Source
var EveryDay = []int32{0, 1, 2, 3, 4, 5, 6}
View Source
var Icons = []Icon{
	{"weights", "๐Ÿ’ช"}, {"art", "๐ŸŽจ"}, {"baseball", "โšพ"}, {"basketball", "๐Ÿ€"},
	{"bed", "๐Ÿ˜ด"}, {"bicycle", "๐Ÿšฒ"}, {"brain", "๐Ÿง "}, {"camera", "๐Ÿ“ท"},
	{"cat", "๐Ÿฑ"}, {"church", "โ›ช"}, {"clean", "๐Ÿงน"}, {"cook", "๐Ÿณ"},
	{"dog", "๐Ÿถ"}, {"football", "๐Ÿˆ"}, {"fruit", "๐ŸŽ"}, {"game", "๐ŸŽฎ"},
	{"garden", "๐ŸŒป"}, {"guitar", "๐ŸŽธ"}, {"heart", "๐Ÿ’—"}, {"hydrate", "๐Ÿ’ง"},
	{"meditate", "๐Ÿง˜"}, {"money", "๐Ÿ’ฐ"}, {"music", "๐ŸŽต"}, {"piano", "๐ŸŽน"},
	{"pill", "๐Ÿ’Š"}, {"plant", "๐ŸŒฑ"}, {"read", "๐Ÿ“–"}, {"run", "๐Ÿƒ"},
	{"smoke", "๐Ÿšฌ"}, {"soccer", "โšฝ"}, {"study", "๐Ÿ“š"}, {"swim", "๐ŸŒŠ"},
	{"tea", "๐Ÿต"}, {"toothbrush", "๐Ÿชฅ"}, {"tree", "๐ŸŒณ"}, {"tv", "๐Ÿ“บ"},
	{"vegetable", "๐Ÿฅ•"}, {"walk", "๐Ÿšถ"}, {"water", "๐Ÿšฐ"}, {"write", "๐Ÿ“"},
	{"yoga", "๐Ÿคธ"}, {"heat", "๐Ÿ”ฅ"}, {"ice", "๐ŸงŠ"}, {"lotus", "๐ŸŒธ"},
	{"breathe", "๐Ÿ’จ"}, {"drink", "๐Ÿฅค"}, {"star", "โญ"},
}

Icons are the habit icons HEY accepts, in the order its own enum declares them.

Functions ยถ

func EmojiFor ยถ

func EmojiFor(icon string) string

EmojiFor answers the emoji standing in for an icon, and nothing for a name HEY does not know, so a habit carrying an icon this build has not heard of still lists.

func FormatDays ยถ

func FormatDays(days []int32) string

FormatDays returns weekdays in the numeric form accepted by HEY.

func ParseDays ยถ

func ParseDays(value string) ([]int32, error)

ParseDays accepts comma-separated weekday names or numbers from Sunday (0) through Saturday (6).

func ValidateColor ยถ

func ValidateColor(value string) error

ValidateColor accepts a color name supported by HEY habits.

func ValidateIcon ยถ

func ValidateIcon(value string) error

ValidateIcon accepts an icon name supported by HEY habits.

Types ยถ

type Icon ยถ

type Icon struct {
	Name  string
	Emoji string
}

Icon is one of the icons HEY draws a habit with. HEY serves an SVG per icon, which a terminal cannot draw, so each carries the emoji that stands in for it. The emoji are all two cells wide โ€” see TestEveryHabitEmojiIsTwoCellsWide โ€” because a habit's icon sits in lists whose width is measured.

Jump to

Keyboard shortcuts

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