theme/font/weight.go

Functions

Functions

func IsBold

IsBold returns true if this weight is considered bold (>= 700).

func (w Weight) IsBold() bool {
	return w >= Bold
}

func IsLight

IsLight returns true if this weight is considered light (<= 300).

func (w Weight) IsLight() bool {
	return w <= Light
}

func String

String returns the human-readable name for the font weight.

For non-standard values, it returns the numeric representation.

func (w Weight) String() string {
	if name, ok := weightNames[w]; ok {
		return name
	}
	return fmt.Sprintf("Weight(%d)", int(w))
}