Documentation ¶
Overview ¶
Package pango provides a type-safe way to construct pango markup. Using nested Span and Text nodes, pango formatted output can be easily constructed with compile-time validation of nesting and automatic escaping.
For example, to construct pango markup for:
<span color="#ff0000">Red <span weight="bold">Bold Text</span></span>
the go code would be:
pango.Span( colors.Hex("#ff0000"), "Red ", pango.Span( pango.Weight("bold"), "Bold Text", ), )
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( XXSmall Attribute = size("xx-small") XSmall = size("x-small") Small = size("small") Medium = size("medium") Large = size("large") XLarge = size("x-large") XXLarge = size("xx-large") Smaller = size("smaller") Larger = size("larger") )
Keyword sizes supported in Pango.
var ( StyleNormal Attribute = style("normal") Oblique = style("oblique") Italic = style("italic") )
Font styles supported in Pango.
var ( Ultralight Attribute = weight("ultralight") Light = weight("light") WeightNormal = weight("normal") Bold = weight("bold") UltraBold = weight("ultrabold") Heavy = weight("heavy") )
Keyword weights supported in Pango.
var ( StretchNormal Attribute = stretch("normal") UltraCondensed = stretch("ultracondensed") ExtraCondensed = stretch("extracondensed") Condensed = stretch("condensed") SemiCondensed = stretch("semicondensed") SemiExpanded = stretch("semiexpanded") Expanded = stretch("expanded") ExtraExpanded = stretch("extraexpanded") UltraExpanded = stretch("ultraexpanded") )
Pango font stretch keywords.
var ( UnderlineNone Attribute = underline("none") UnderlineSingle = underline("single") UnderlineDouble = underline("double") UnderlineLow = underline("low") UnderlineError = underline("error") )
Pango underline keywords.
Functions ¶
This section is empty.
Types ¶
type Alpha ¶
type Alpha float64
Alpha sets the foreground opacity on a scale of 0 to 1.
type Attribute ¶
Attribute represents a pango attribute name and value.
var ( VariantNormal Attribute = variant("normal") SmallCaps = variant("smallcaps") )
Pango font variants.
type Background ¶
Background wraps a bar color but applies it as a background instead of the foreground.
func (Background) AttrName ¶
func (b Background) AttrName() string
AttrName returns the name of the pango 'background' attribute.
func (Background) AttrValue ¶
func (b Background) AttrValue() string
AttrValue delegates to bar.Color to return the pango color value.
type BgAlpha ¶
type BgAlpha float64
BgAlpha sets the background opacity on a scale of 0 to 1.
type Font ¶
type Font string
Font sets the font face.
type LetterSpacing ¶
type LetterSpacing float64
LetterSpacing sets the letter spacing, in points.
func (LetterSpacing) AttrName ¶
func (l LetterSpacing) AttrName() string
AttrName returns the name of the pango 'letter_spacing' attribute.
func (LetterSpacing) AttrValue ¶
func (l LetterSpacing) AttrValue() string
AttrValue returns the letter spacing as a pango 'letter_spacing' value.
type Node ¶
type Node interface { // Pango returns a pango-formatted version of the element. Pango() string }
Node represents nodes in a pango "document".
func Span ¶
func Span(things ...interface{}) Node
Span constructs a new span with the given attributes and segments.
func Tag ¶
Tag constructs a pango element with the given name, with any children and/or attributes. The interface varargs are used as below:
- A pango.Attribute is added to the tag directly
- A pango.Element is added as a child node
- Any other object is added as a text node using the %v format.
type Rise ¶
type Rise int
Rise sets the font "rise" in pango units. Negative for subscript, positive for superscript.
type Size ¶
type Size float64
Size sets the font size, in points.
type StrikethroughColor ¶
StrikethroughColor wraps a bar color but applies it as the strikethrough color instead of the foreground.
func (StrikethroughColor) AttrName ¶
func (s StrikethroughColor) AttrName() string
AttrName returns the name of the pango 'strikethrough_color' attribute.
func (StrikethroughColor) AttrValue ¶
func (s StrikethroughColor) AttrValue() string
AttrValue delegates to bar.Color to return the pango color value.
type UnderlineColor ¶
UnderlineColor wraps a bar color but applies it as the underline color instead of the foreground.
func (UnderlineColor) AttrName ¶
func (u UnderlineColor) AttrName() string
AttrName returns the name of the pango 'underline_color' attribute.
func (UnderlineColor) AttrValue ¶
func (u UnderlineColor) AttrValue() string
AttrValue delegates to bar.Color to return the pango color value.
Directories ¶
Path | Synopsis |
---|---|
Package icons provides an interface for using icon fonts in a bar.
|
Package icons provides an interface for using icon fonts in a bar. |
fontawesome
Package fontawesome provides support for FontAwesome Icons from https://github.com/FortAwesome/Font-Awesome
|
Package fontawesome provides support for FontAwesome Icons from https://github.com/FortAwesome/Font-Awesome |
ionicons
Package ionicons provides support for Ionicicons from https://github.com/driftyco/ionicons
|
Package ionicons provides support for Ionicicons from https://github.com/driftyco/ionicons |
material
Package material provides support for Google's Material Design Icons from https://github.com/google/material-design-icons
|
Package material provides support for Google's Material Design Icons from https://github.com/google/material-design-icons |
material_community
Package materialCommunity provides support for the community fork "Material Design Icons" from https://materialdesignicons.com/
|
Package materialCommunity provides support for the community fork "Material Design Icons" from https://materialdesignicons.com/ |
typicons
Package typicons provides support for Typicons from https://github.com/stephenhutchings/typicons.font
|
Package typicons provides support for Typicons from https://github.com/stephenhutchings/typicons.font |