color

package
v0.2.1-0...-dabd69d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2017 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	STYLE_PLAIN StyleFormattingMask = 0
	STYLE_BOLD                      = 1 << iota
	STYLE_UNDERLINE
)

Variables

This section is empty.

Functions

func DeSerializeStyleTcell

func DeSerializeStyleTcell(styleString string) tcell.Style

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.")

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL