package objects import "fmt" import "git.tebibyte.media/tomo/tomo" import "git.tebibyte.media/tomo/tomo/theme" // Heading is a label that denotes the start of some section of content. It can // have a level from 0 to 2, with 0 being the most prominent and 2 being the // most subtle. The level is described in the role variation. type Heading struct { tomo.TextBox } // NewHeading creates a new section heading. The level can be from 0 to 2. func NewHeading (level int, text string) *Label { if level < 0 { level = 0 } if level > 2 { level = 2 } this := &Label { TextBox: tomo.NewTextBox() } theme.Apply(this, theme.R("objects", "Heading", fmt.Sprint(level))) this.SetText(text) return this }