Documentation ¶
Index ¶
Constants ¶
const ( STYLE_PLAIN StyleFormattingMask = 0 STYLE_BOLD = 1 << iota STYLE_UNDERLINE )
Variables ¶
This section is empty.
Functions ¶
func DeSerializeStyleTcell ¶
Deserialize a serialized style string into a tcell.Style.
func SerializeStyle ¶
func SerializeStyle(foreground string, background string, formatting StyleFormattingMask) string
Given a foreground color, background color, and formatting mask, return a serialized version of the style. SerializeStyle("red", "green", STYLE_BOLD) // => "red:green:B" SerializeStyle("red", "", STYLE_BOLD | STYLE_UNDERLINE) // => "red::B" SerializeStyle("red", "#FF00FF", STYLE_PLAIN) // => "red:#FF00FF:"
Types ¶
type StyleFormattingMask ¶
type StyleFormattingMask int
func DeSerializeStyle ¶
func DeSerializeStyle(styleString string) (string, string, StyleFormattingMask, error)
Given a serialized style string, deserialize into a forgeground color, background color, and formatting mask. Also returns an error parsing if there was one. DeSerializeStyle("red:green:B") // => "red", "green", STYLE_BOLD, nil DeSerializeStyle(":") // => "", "", STYLE_PLAIN, error("Less than or greater than three colon-separated parts in style formatting string.")