Documentation ¶
Overview ¶
Package markuputil contains utilities for handling Pango markup and TextBuffer shenanigans.
Index ¶
- func Attrs(attrs ...*pango.Attribute) *pango.AttrList
- func Error(msg string) string
- func ErrorLabel(markup string) *gtk.Label
- func HashTag(table *gtk.TextTagTable, attrs TextTag) *gtk.TextTag
- func IsDarkTheme(w gtk.Widgetter) bool
- func NewAttrOpacity(alpha float64) *pango.Attribute
- func RGBHex(c color.RGBA) string
- type TextTag
- type TextTagsMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorLabel ¶
func ErrorLabel(markup string) *gtk.Label
ErrorLabel makes a new label with the class `.error'.
func HashTag ¶
func HashTag(table *gtk.TextTagTable, attrs TextTag) *gtk.TextTag
HashTag creates a tag inside the text tag table using the hash of the text tag attributes as the name. If the same tag has already been created, then it is returned.
func IsDarkTheme ¶
func IsDarkTheme(w gtk.Widgetter) bool
IsDarkTheme returns true if the given widget is inside an application with a dark theme. A dark theme implies the background color is dark. The function can be called concurrently, but it shouldn't ever be.
func NewAttrOpacity ¶
NewAttrOpacity creates a new AttrForegroundAlpha.
Types ¶
type TextTag ¶
type TextTag map[string]interface{}
TextTag describes a map of attribute/property name to its value for a TextTag. Attributes that need a -set suffix will be set to true automatically.
type TextTagsMap ¶
TextTagsMap describes a map of tag names to its attributes. It is used to declaratively construct a TextTagTable using NewTextTags.
func LinkTags ¶
func LinkTags() TextTagsMap
LinkTags gets the text tags with colors for a, a:hover and a:visited. The output of the function is cached for a short while, so the user doesn't have to store it. It is concurrently safe to call this function.
func (TextTagsMap) Combine ¶
func (m TextTagsMap) Combine(other TextTagsMap)
Combine adds all tags from other into m. If m already contains a tag that appears in other, then the tag is not overridden.
func (TextTagsMap) FromBuffer ¶
func (m TextTagsMap) FromBuffer(buffer *gtk.TextBuffer, name string) *gtk.TextTag
FromBuffer call FromTable on the buffer's tag table.
func (TextTagsMap) FromTable ¶
func (m TextTagsMap) FromTable(table *gtk.TextTagTable, name string) *gtk.TextTag
FromTable gets the tag with the given name from the given tag table, or if the tag doesn't exist, then a new one is added instead. If the name isn't known in either the table or the map, then the function will panic.
func (TextTagsMap) SetTagAttr ¶
func (m TextTagsMap) SetTagAttr(name, attr string, value interface{})
SetTagAttr sets the attribute/property of the tag with the given name.