Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterArrows(name ArrowName, arrow ArrowRuneSet)
- func RegisterBorderRunes(name BorderName, border BorderRuneSet)
- func RegisterSpinners(name SpinnerName, spinner SpinnerRuneSet)
- func RegisterStyle(name StyleName, theme Style)
- func RegisterTheme(name ThemeName, theme Theme)
- type ArrowName
- type ArrowRuneSet
- type AttrMask
- func (m AttrMask) Blink(v bool) AttrMask
- func (m AttrMask) Bold(v bool) AttrMask
- func (m AttrMask) Dim(v bool) AttrMask
- func (m AttrMask) IsBlink() bool
- func (m AttrMask) IsBold() bool
- func (m AttrMask) IsDim() bool
- func (m AttrMask) IsItalic() bool
- func (m AttrMask) IsNormal() bool
- func (m AttrMask) IsReverse() bool
- func (m AttrMask) IsStrike() bool
- func (m AttrMask) IsUnderline() bool
- func (m AttrMask) Italic(v bool) AttrMask
- func (m AttrMask) Normal() AttrMask
- func (m AttrMask) Reverse(v bool) AttrMask
- func (m AttrMask) Strike(v bool) AttrMask
- func (m AttrMask) Underline(v bool) AttrMask
- type Border
- type BorderName
- type BorderRuneSet
- type Color
- type SpinnerName
- type SpinnerRuneSet
- type Style
- func (s Style) Attributes(attrs AttrMask) Style
- func (s Style) Background(c Color) Style
- func (s Style) Blink(on bool) Style
- func (s Style) Bold(on bool) Style
- func (s Style) Decompose() (fg Color, bg Color, attr AttrMask)
- func (s Style) Dim(on bool) Style
- func (s Style) Equals(other Style) bool
- func (s Style) Foreground(c Color) Style
- func (s Style) Italic(on bool) Style
- func (s Style) Normal() Style
- func (s Style) Reverse(on bool) Style
- func (s Style) Strike(on bool) Style
- func (s Style) String() string
- func (s Style) Underline(on bool) Style
- type StyleName
- type Theme
- type ThemeAspect
- type ThemeName
Constants ¶
const ( ColorBlack = ColorValid + iota ColorMaroon ColorGreen ColorOlive ColorPurple ColorTeal ColorSilver ColorGray ColorRed ColorLime ColorYellow ColorBlue ColorFuchsia ColorAqua ColorWhite Color16 Color17 Color18 Color19 Color20 Color21 Color22 Color23 Color24 Color25 Color26 Color27 Color28 Color29 Color30 Color31 Color32 Color33 Color34 Color35 Color36 Color37 Color38 Color39 Color40 Color41 Color42 Color43 Color44 Color45 Color46 Color47 Color48 Color49 Color50 Color51 Color52 Color53 Color54 Color55 Color56 Color57 Color58 Color59 Color60 Color61 Color62 Color63 Color64 Color65 Color66 Color67 Color68 Color69 Color70 Color71 Color72 Color73 Color74 Color75 Color76 Color77 Color78 Color79 Color80 Color81 Color82 Color83 Color84 Color85 Color86 Color87 Color88 Color89 Color90 Color91 Color92 Color93 Color94 Color95 Color96 Color97 Color98 Color99 Color100 Color101 Color102 Color103 Color104 Color105 Color106 Color107 Color108 Color109 Color110 Color111 Color112 Color113 Color114 Color115 Color116 Color117 Color118 Color119 Color120 Color121 Color122 Color123 Color124 Color125 Color126 Color127 Color128 Color129 Color130 Color131 Color132 Color133 Color134 Color135 Color136 Color137 Color138 Color139 Color140 Color141 Color142 Color143 Color144 Color145 Color146 Color147 Color148 Color149 Color150 Color151 Color152 Color153 Color154 Color155 Color156 Color157 Color158 Color159 Color160 Color161 Color162 Color163 Color164 Color165 Color166 Color167 Color168 Color169 Color170 Color171 Color172 Color173 Color174 Color175 Color176 Color177 Color178 Color179 Color180 Color181 Color182 Color183 Color184 Color185 Color186 Color187 Color188 Color189 Color190 Color191 Color192 Color193 Color194 Color195 Color196 Color197 Color198 Color199 Color200 Color201 Color202 Color203 Color204 Color205 Color206 Color207 Color208 Color209 Color210 Color211 Color212 Color213 Color214 Color215 Color216 Color217 Color218 Color219 Color220 Color221 Color222 Color223 Color224 Color225 Color226 Color227 Color228 Color229 Color230 Color231 Color232 Color233 Color234 Color235 Color236 Color237 Color238 Color239 Color240 Color241 Color242 Color243 Color244 Color245 Color246 Color247 Color248 Color249 Color250 Color251 Color252 Color253 Color254 Color255 ColorAliceBlue ColorAntiqueWhite ColorAquaMarine ColorAzure ColorBeige ColorBisque ColorBlanchedAlmond ColorBlueViolet ColorBrown ColorBurlyWood ColorCadetBlue ColorChartreuse ColorChocolate ColorCoral ColorCornflowerBlue ColorCornsilk ColorCrimson ColorDarkBlue ColorDarkCyan ColorDarkGoldenrod ColorDarkGray ColorDarkGreen ColorDarkKhaki ColorDarkMagenta ColorDarkOliveGreen ColorDarkOrange ColorDarkOrchid ColorDarkRed ColorDarkSalmon ColorDarkSeaGreen ColorDarkSlateBlue ColorDarkSlateGray ColorDarkTurquoise ColorDarkViolet ColorDeepPink ColorDeepSkyBlue ColorDimGray ColorDodgerBlue ColorFireBrick ColorFloralWhite ColorForestGreen ColorGainsboro ColorGhostWhite ColorGold ColorGoldenrod ColorGreenYellow ColorHoneydew ColorHotPink ColorIndianRed ColorIndigo ColorIvory ColorKhaki ColorLavender ColorLavenderBlush ColorLawnGreen ColorLemonChiffon ColorLightBlue ColorLightCoral ColorLightCyan ColorLightGoldenrodYellow ColorLightGray ColorLightGreen ColorLightPink ColorLightSalmon ColorLightSeaGreen ColorLightSkyBlue ColorLightSlateGray ColorLightSteelBlue ColorLightYellow ColorLimeGreen ColorLinen ColorMediumAquamarine ColorMediumBlue ColorMediumOrchid ColorMediumPurple ColorMediumSeaGreen ColorMediumSlateBlue ColorMediumSpringGreen ColorMediumTurquoise ColorMediumVioletRed ColorMidnightBlue ColorMintCream ColorMistyRose ColorMoccasin ColorOldLace ColorOliveDrab ColorOrange ColorOrangeRed ColorOrchid ColorPaleGoldenrod ColorPaleGreen ColorPaleTurquoise ColorPaleVioletRed ColorPapayaWhip ColorPeachPuff ColorPeru ColorPink ColorPlum ColorPowderBlue ColorRebeccaPurple ColorRosyBrown ColorRoyalBlue ColorSaddleBrown ColorSalmon ColorSandyBrown ColorSeaGreen ColorSeashell ColorSienna ColorSkyblue ColorSlateBlue ColorSlateGray ColorSnow ColorSpringGreen ColorSteelBlue ColorTan ColorThistle ColorTomato ColorTurquoise ColorViolet ColorWheat ColorWhiteSmoke ColorYellowGreen )
Note that the order of these options is important -- it follows the definitions used by ECMA and XTerm. Hence any further named colors must begin at a value not less than 256.
const ( ColorGrey = ColorGray ColorDimGrey = ColorDimGray ColorDarkGrey = ColorDarkGray ColorDarkSlateGrey = ColorDarkSlateGray ColorLightGrey = ColorLightGray ColorLightSlateGrey = ColorLightSlateGray ColorSlateGrey = ColorSlateGray )
These are aliases for the color gray, because some of us spell it as grey.
const ( DefaultFillRune = ' ' DefaultNilRune = rune(0) )
const ( RuneBoxLineX = '╳' RuneCheckbox = '✔' RuneSterling = '£' RuneDArrow = '↓' RuneLArrow = '←' RuneRArrow = '→' RuneUArrow = '↑' RuneBullet = '·' RuneBoard = '░' RuneCkBoard = '▒' RuneDegree = '°' RuneDiamond = '◆' RuneGEqual = '≥' RunePi = 'π' RuneHLine = '─' RuneLantern = '§' RunePlus = '┼' RuneLEqual = '≤' RuneLLCorner = '└' RuneLRCorner = '┘' RuneNEqual = '≠' RunePlMinus = '±' RuneS1 = '⎺' RuneS3 = '⎻' RuneS7 = '⎼' RuneS9 = '⎽' RuneBlock = '█' RuneTTee = '┬' RuneRTee = '┤' RuneLTee = '├' RuneBTee = '┴' RuneULCorner = '┌' RuneURCorner = '┐' RuneVLine = '│' RuneLLCornerRounded = '╰' RuneLRCornerRounded = '╯' RuneULCornerRounded = '╭' RuneURCornerRounded = '╮' RuneLeftwardsTwoHeadedArrowWithTriangleArrowheads = '⯬' RuneUpwardsTwoHeadedArrowWithTriangleArrowheads = '⯭' RuneRightwardsTwoHeadedArrowWithTriangleArrowheads = '⯮' RuneDownwardsTwoHeadedArrowWithTriangleArrowheads = '⯯' RuneFilledSquareCentred = '⯀' RuneFilledMediumUpPointingTriangleCentred = '⯅' RuneFilledMediumDownPointingTriangleCentred = '⯆' RuneFilledMediumLeftPointingTriangleCentred = '⯇' RuneFilledMediumRightPointingTriangleCentred = '⯈' RuneLeftwardsFilledCircledHollowArrow = '⮈' RuneUpwardsFilledCircledHollowArrow = '⮉' RuneRightwardsFilledCircledHollowArrow = '⮊' RuneDownwardsFilledCircledHollowArrow = '⮋' RuneTriangleUp = '▲' RuneTriangleLeft = '◀' RuneTriangleDown = '▼' RuneTriangleRight = '▶' RuneEllipsis = '…' RuneBraille1235678 = '⣷' RuneBraille2345678 = '⣾' RuneBraille1345678 = '⣽' RuneBraille1245678 = '⣻' RuneBraille1234568 = '⢿' RuneBraille1234567 = '⡿' RuneBraille1234578 = '⣟' RuneBraille1234678 = '⣯' RuneBraille1 = '⠁' RuneBraille2 = '⠂' RuneBraille3 = '⠄' RuneBraille4 = '⠈' RuneBraille5 = '⠐' RuneBraille6 = '⠠' RuneBraille7 = '⡀' RuneBraille8 = '⢀' RuneBraille47 = '⡈' RuneBraille18 = '⢁' RuneBraille26 = '⠢' RuneBraille35 = '⠔' RuneSevenDotSpinner0 = RuneBraille1235678 RuneSevenDotSpinner1 = RuneBraille2345678 RuneSevenDotSpinner2 = RuneBraille1345678 RuneSevenDotSpinner3 = RuneBraille1245678 RuneSevenDotSpinner4 = RuneBraille1234568 RuneSevenDotSpinner5 = RuneBraille1234567 RuneSevenDotSpinner6 = RuneBraille1234578 RuneSevenDotSpinner7 = RuneBraille1234678 RuneOneDotSpinner0 = RuneBraille4 RuneOneDotSpinner1 = RuneBraille1 RuneOneDotSpinner2 = RuneBraille2 RuneOneDotSpinner3 = RuneBraille3 RuneOneDotSpinner4 = RuneBraille7 RuneOneDotSpinner5 = RuneBraille8 RuneOneDotSpinner6 = RuneBraille6 RuneOneDotSpinner7 = RuneBraille5 RuneOrbitDotSpinner0 = RuneBraille47 RuneOrbitDotSpinner1 = RuneBraille18 RuneOrbitDotSpinner2 = RuneBraille26 RuneOrbitDotSpinner3 = RuneBraille35 )
The names of these constants are chosen to match Terminfo names, modulo case, and changing the prefix from ACS_ to Rune. These are the runes we provide extra special handling for, with ASCII fallbacks for terminals that lack them.
const ( RuneFilledCircle = '●' RuneFilledDiamond = '◆' RuneFilledDownPointingSmallTriangle = '▾' RuneFilledDownPointingTriangle = '▼' RuneFilledLeftPointingPointer = '◄' RuneFilledLeftPointingSmallTriangle = '◂' RuneFilledLeftPointingTriangle = '◀' RuneFilledLowerLeftTriangle = '◣' RuneFilledLowerRightTriangle = '◢' RuneFilledMediumSmallSquare = '◾' RuneFilledMediumSquare = '◼' RuneFilledParallelogram = '▰' RuneFilledRectangle = '▬' RuneFilledRightPointingPointer = '►' RuneFilledRightPointingSmallTriangle = '▸' RuneFilledRightPointingTriangle = '▶' RuneFilledSmallSquare = '▪' RuneFilledSquare = '■' RuneFilledUpPointingSmallTriangle = '▴' RuneFilledUpPointingTriangle = '▲' RuneFilledUpperLeftTriangle = '◤' RuneFilledUpperRightTriangle = '◥' RuneFilledVerticalRectangle = '▮' RuneBoxDrawingsDoubleDownAndHorizontal = '╦' RuneBoxDrawingsDoubleDownAndLeft = '╗' RuneBoxDrawingsDoubleDownAndRight = '╔' RuneBoxDrawingsDoubleHorizontal = '═' RuneBoxDrawingsDoubleUpAndHorizontal = '╩' RuneBoxDrawingsDoubleUpAndLeft = '╝' RuneBoxDrawingsDoubleUpAndRight = '╚' RuneBoxDrawingsDoubleVertical = '║' RuneBoxDrawingsDoubleVerticalAndHorizontal = '╬' RuneBoxDrawingsDoubleVerticalAndLeft = '╣' RuneBoxDrawingsDoubleVerticalAndRight = '╠' RuneBoxDrawingsDownDoubleAndHorizontalSingle = '╥' RuneBoxDrawingsDownDoubleAndLeftSingle = '╖' RuneBoxDrawingsDownDoubleAndRightSingle = '╓' RuneBoxDrawingsDownHeavyAndHorizontalLight = '┰' RuneBoxDrawingsDownHeavyAndLeftLight = '┒' RuneBoxDrawingsDownHeavyAndLeftUpLight = '┧' RuneBoxDrawingsDownHeavyAndRightLight = '┎' RuneBoxDrawingsDownHeavyAndRightUpLight = '┟' RuneBoxDrawingsDownHeavyAndUpHorizontalLight = '╁' RuneBoxDrawingsDownLightAndHorizontalHeavy = '┯' RuneBoxDrawingsDownLightAndLeftHeavy = '┑' RuneBoxDrawingsDownLightAndLeftUpHeavy = '┩' RuneBoxDrawingsDownLightAndRightHeavy = '┍' RuneBoxDrawingsDownLightAndRightUpHeavy = '┡' RuneBoxDrawingsDownLightAndUpHorizontalHeavy = '╇' RuneBoxDrawingsDownSingleAndHorizontalDouble = '╤' RuneBoxDrawingsDownSingleAndLeftDouble = '╕' RuneBoxDrawingsDownSingleAndRightDouble = '╒' RuneBoxDrawingsHeavyDoubleDashHorizontal = '╍' RuneBoxDrawingsHeavyDoubleDashVertical = '╏' RuneBoxDrawingsHeavyDown = '╻' RuneBoxDrawingsHeavyDownAndHorizontal = '┳' RuneBoxDrawingsHeavyDownAndLeft = '┓' RuneBoxDrawingsHeavyDownAndRight = '┏' RuneBoxDrawingsHeavyHorizontal = '━' RuneBoxDrawingsHeavyLeft = '╸' RuneBoxDrawingsHeavyLeftAndLightRight = '╾' RuneBoxDrawingsHeavyQuadrupleDashHorizontal = '┉' RuneBoxDrawingsHeavyQuadrupleDashVertical = '┋' RuneBoxDrawingsHeavyRight = '╺' RuneBoxDrawingsHeavyTripleDashHorizontal = '┅' RuneBoxDrawingsHeavyTripleDashVertical = '┇' RuneBoxDrawingsHeavyUp = '╹' RuneBoxDrawingsHeavyUpAndHorizontal = '┻' RuneBoxDrawingsHeavyUpAndLeft = '┛' RuneBoxDrawingsHeavyUpAndLightDown = '╿' RuneBoxDrawingsHeavyUpAndRight = '┗' RuneBoxDrawingsHeavyVertical = '┃' RuneBoxDrawingsHeavyVerticalAndHorizontal = '╋' RuneBoxDrawingsHeavyVerticalAndLeft = '┫' RuneBoxDrawingsHeavyVerticalAndRight = '┣' RuneBoxDrawingsLeftDownHeavyAndRightUpLight = '╅' RuneBoxDrawingsLeftHeavyAndRightDownLight = '┭' RuneBoxDrawingsLeftHeavyAndRightUpLight = '┵' RuneBoxDrawingsLeftHeavyAndRightVerticalLight = '┽' RuneBoxDrawingsLeftLightAndRightDownHeavy = '┲' RuneBoxDrawingsLeftLightAndRightUpHeavy = '┺' RuneBoxDrawingsLeftLightAndRightVerticalHeavy = '╊' RuneBoxDrawingsLeftUpHeavyAndRightDownLight = '╃' RuneBoxDrawingsLightArcDownAndLeft = '╮' RuneBoxDrawingsLightArcDownAndRight = '╭' RuneBoxDrawingsLightArcUpAndLeft = '╯' RuneBoxDrawingsLightArcUpAndRight = '╰' RuneBoxDrawingsLightDiagonalCross = '╳' RuneBoxDrawingsLightDiagonalUpperLeftToLowerRight = '╲' RuneBoxDrawingsLightDiagonalUpperRightToLowerLeft = '╱' RuneBoxDrawingsLightDoubleDashHorizontal = '╌' RuneBoxDrawingsLightDoubleDashVertical = '╎' RuneBoxDrawingsLightDown = '╷' RuneBoxDrawingsLightDownAndHorizontal = '┬' RuneBoxDrawingsLightDownAndLeft = '┐' RuneBoxDrawingsLightDownAndRight = '┌' RuneBoxDrawingsLightHorizontal = '─' RuneBoxDrawingsLightLeft = '╴' RuneBoxDrawingsLightLeftAndHeavyRight = '╼' RuneBoxDrawingsLightQuadrupleDashHorizontal = '┈' RuneBoxDrawingsLightQuadrupleDashVertical = '┊' RuneBoxDrawingsLightRight = '╶' RuneBoxDrawingsLightTripleDashHorizontal = '┄' RuneBoxDrawingsLightTripleDashVertical = '┆' RuneBoxDrawingsLightUp = '╵' RuneBoxDrawingsLightUpAndHeavyDown = '╽' RuneBoxDrawingsLightUpAndHorizontal = '┴' RuneBoxDrawingsLightUpAndLeft = '┘' RuneBoxDrawingsLightUpAndRight = '└' RuneBoxDrawingsLightVertical = '│' RuneBoxDrawingsLightVerticalAndHorizontal = '┼' RuneBoxDrawingsLightVerticalAndLeft = '┤' RuneBoxDrawingsLightVerticalAndRight = '├' RuneBoxDrawingsRightDownHeavyAndLeftUpLight = '╆' RuneBoxDrawingsRightHeavyAndLeftDownLight = '┮' RuneBoxDrawingsRightHeavyAndLeftUpLight = '┶' RuneBoxDrawingsRightHeavyAndLeftVerticalLight = '┾' RuneBoxDrawingsRightLightAndLeftDownHeavy = '┱' RuneBoxDrawingsRightLightAndLeftUpHeavy = '┹' RuneBoxDrawingsRightLightAndLeftVerticalHeavy = '╉' RuneBoxDrawingsRightUpHeavyAndLeftDownLight = '╄' RuneBoxDrawingsUpDoubleAndHorizontalSingle = '╨' RuneBoxDrawingsUpDoubleAndLeftSingle = '╜' RuneBoxDrawingsUpDoubleAndRightSingle = '╙' RuneBoxDrawingsUpHeavyAndDownHorizontalLight = '╀' RuneBoxDrawingsUpHeavyAndHorizontalLight = '┸' RuneBoxDrawingsUpHeavyAndLeftDownLight = '┦' RuneBoxDrawingsUpHeavyAndLeftLight = '┚' RuneBoxDrawingsUpHeavyAndRightDownLight = '┞' RuneBoxDrawingsUpHeavyAndRightLight = '┖' RuneBoxDrawingsUpLightAndDownHorizontalHeavy = '╈' RuneBoxDrawingsUpLightAndHorizontalHeavy = '┷' RuneBoxDrawingsUpLightAndLeftDownHeavy = '┪' RuneBoxDrawingsUpLightAndLeftHeavy = '┙' RuneBoxDrawingsUpLightAndRightDownHeavy = '┢' RuneBoxDrawingsUpLightAndRightHeavy = '┕' RuneBoxDrawingsUpSingleAndHorizontalDouble = '╧' RuneBoxDrawingsUpSingleAndLeftDouble = '╛' RuneBoxDrawingsUpSingleAndRightDouble = '╘' RuneBoxDrawingsVerticalDoubleAndHorizontalSingle = '╫' RuneBoxDrawingsVerticalDoubleAndLeftSingle = '╢' RuneBoxDrawingsVerticalDoubleAndRightSingle = '╟' RuneBoxDrawingsVerticalHeavyAndHorizontalLight = '╂' RuneBoxDrawingsVerticalHeavyAndLeftLight = '┨' RuneBoxDrawingsVerticalHeavyAndRightLight = '┠' RuneBoxDrawingsVerticalLightAndHorizontalHeavy = '┿' RuneBoxDrawingsVerticalLightAndLeftHeavy = '┥' RuneBoxDrawingsVerticalLightAndRightHeavy = '┝' RuneBoxDrawingsVerticalSingleAndHorizontalDouble = '╪' RuneBoxDrawingsVerticalSingleAndLeftDouble = '╡' RuneBoxDrawingsVerticalSingleAndRightDouble = '╞' RuneBullseye = '◎' RuneCircleWithAllButUpperLeftQuadrantFilled = '◕' RuneCircleWithLeftHalfFilled = '◐' RuneCircleWithLowerHalfFilled = '◒' RuneCircleWithRightHalfFilled = '◑' RuneCircleWithUpperHalfFilled = '◓' RuneCircleWithUpperRightQuadrantFilled = '◔' RuneCircleWithVerticalFill = '◍' RuneDarkShade = '▓' RuneDottedCircle = '◌' RuneFisheye = '◉' RuneFullBlock = '█' RuneInverseBullet = '◘' RuneInverseHollowCircle = '◙' RuneLargeCircle = '◯' RuneLeftFiveEighthsBlock = '▋' RuneLeftHalfFilledCircle = '◖' RuneLeftHalfBlock = '▌' RuneLeftOneEighthBlock = '▏' RuneLeftOneQuarterBlock = '▎' RuneLeftSevenEighthsBlock = '▉' RuneLeftThreeEighthsBlock = '▍' RuneLeftThreeQuartersBlock = '▊' RuneLightShade = '░' RuneLowerFiveEighthsBlock = '▅' RuneLowerHalfBlock = '▄' RuneLowerHalfCircle = '◡' RuneLowerHalfInverseHollowCircle = '◛' RuneLowerLeftQuadrantCircularArc = '◟' RuneLowerLeftTriangle = '◺' RuneLowerOneEighthBlock = '▁' RuneLowerOneQuarterBlock = '▂' RuneLowerRightQuadrantCircularArc = '◞' RuneLowerRightTriangle = '◿' RuneLowerSevenEighthsBlock = '▇' RuneLowerThreeEighthsBlock = '▃' RuneLowerThreeQuartersBlock = '▆' RuneLozenge = '◊' RuneMediumShade = '▒' RuneQuadrantLowerLeft = '▖' RuneQuadrantLowerRight = '▗' RuneQuadrantUpperLeft = '▘' RuneQuadrantUpperLeftAndLowerLeftAndLowerRight = '▙' RuneQuadrantUpperLeftAndLowerRight = '▚' RuneQuadrantUpperLeftAndUpperRightAndLowerLeft = '▛' RuneQuadrantUpperLeftAndUpperRightAndLowerRight = '▜' RuneQuadrantUpperRight = '▝' RuneQuadrantUpperRightAndLowerLeft = '▞' RuneQuadrantUpperRightAndLowerLeftAndLowerRight = '▟' RuneRightHalfFilledCircle = '◗' RuneRightHalfBlock = '▐' RuneRightOneEighthBlock = '▕' RuneSquareWithDiagonalCrosshatchFill = '▩' RuneSquareWithHorizontalFill = '▤' RuneSquareWithLeftHalfFilled = '◧' RuneSquareWithLowerRightDiagonalHalfFilled = '◪' RuneSquareWithOrthogonalCrosshatchFill = '▦' RuneSquareWithRightHalfFilled = '◨' RuneSquareWithUpperLeftDiagonalHalfFilled = '◩' RuneSquareWithUpperLeftToLowerRightFill = '▧' RuneSquareWithUpperRightToLowerLeftFill = '▨' RuneSquareWithVerticalFill = '▥' RuneUpPointingTriangleWithLeftHalfFilled = '◭' RuneUpPointingTriangleWithRightHalfFilled = '◮' RuneUpperHalfBlock = '▀' RuneUpperHalfCircle = '◠' RuneUpperHalfInverseHollowCircle = '◚' RuneUpperLeftQuadrantCircularArc = '◜' RuneUpperLeftTriangle = '◸' RuneUpperOneEighthBlock = '▔' RuneUpperRightQuadrantCircularArc = '◝' RuneUpperRightTriangle = '◹' RuneHollowBullet = '◦' RuneHollowCircle = '○' RuneHollowCircleWithLowerLeftQuadrant = '◵' RuneHollowCircleWithLowerRightQuadrant = '◶' RuneHollowCircleWithUpperLeftQuadrant = '◴' RuneHollowCircleWithUpperRightQuadrant = '◷' RuneHollowDiamond = '◇' RuneHollowDiamondContainingFilledSmallDiamond = '◈' RuneHollowDownPointingSmallTriangle = '▿' RuneHollowDownPointingTriangle = '▽' RuneHollowLeftPointingPointer = '◅' RuneHollowLeftPointingSmallTriangle = '◃' RuneHollowLeftPointingTriangle = '◁' RuneHollowMediumSmallSquare = '◽' RuneHollowMediumSquare = '◻' RuneHollowParallelogram = '▱' RuneHollowRectangle = '▭' RuneHollowRightPointingPointer = '▻' RuneHollowRightPointingSmallTriangle = '▹' RuneHollowRightPointingTriangle = '▷' RuneHollowSmallSquare = '▫' RuneHollowSquare = '□' RuneHollowSquareContainingFilledSmallSquare = '▣' RuneHollowSquareWithLowerLeftQuadrant = '◱' RuneHollowSquareWithLowerRightQuadrant = '◲' RuneHollowSquareWithRoundedCorners = '▢' RuneHollowSquareWithUpperLeftQuadrant = '◰' RuneHollowSquareWithUpperRightQuadrant = '◳' RuneHollowSquareWithVerticalBisectingLine = '◫' RuneHollowUpPointingSmallTriangle = '▵' RuneHollowUpPointingTriangle = '△' RuneHollowUpPointingTriangleWithDot = '◬' RuneHollowVerticalRectangle = '▯' )
const ( // ColorReset is used to indicate that the color should use the // vanilla terminal colors. (Basically go back to the defaults.) ColorReset = ColorSpecial | iota )
Special colors.
Variables ¶
var ( SafeSpinnerRuneSet = SpinnerRuneSet{ '/', '|', '\\', '-', } OneDotSpinnerRuneSet = SpinnerRuneSet{ RuneOneDotSpinner0, RuneOneDotSpinner1, RuneOneDotSpinner2, RuneOneDotSpinner3, RuneOneDotSpinner4, RuneOneDotSpinner5, RuneOneDotSpinner6, RuneOneDotSpinner7, } OrbitDotSpinnerRuneSet = SpinnerRuneSet{ RuneOrbitDotSpinner0, RuneOrbitDotSpinner1, RuneOrbitDotSpinner2, RuneOrbitDotSpinner3, } SevenDotSpinnerRuneSet = SpinnerRuneSet{ RuneSevenDotSpinner0, RuneSevenDotSpinner1, RuneSevenDotSpinner2, RuneSevenDotSpinner3, RuneSevenDotSpinner4, RuneSevenDotSpinner5, RuneSevenDotSpinner6, RuneSevenDotSpinner7, } )
var ColorNames = map[string]Color{}/* 146 elements not displayed */
ColorNames holds the written names of colors. Useful to present a list of recognized named colors.
var ColorValues = map[Color]int32{}/* 379 elements not displayed */
ColorValues maps color constants to their RGB values.
var RuneFallbacks = map[rune]string{ RuneBoxLineX: "X", RuneCheckbox: "*", RuneSterling: "f", RuneDArrow: "v", RuneLArrow: "<", RuneRArrow: ">", RuneUArrow: "^", RuneBullet: "o", RuneBoard: "#", RuneCkBoard: ":", RuneDegree: "\\", RuneDiamond: "+", RuneGEqual: ">", RunePi: "*", RuneHLine: "-", RuneLantern: "#", RunePlus: "+", RuneLEqual: "<", RuneLLCorner: "+", RuneLRCorner: "+", RuneNEqual: "!", RunePlMinus: "#", RuneS1: "~", RuneS3: "-", RuneS7: "-", RuneS9: "_", RuneBlock: "#", RuneTTee: "+", RuneRTee: "+", RuneLTee: "+", RuneBTee: "+", RuneULCorner: "+", RuneURCorner: "+", RuneVLine: "|", RuneLLCornerRounded: "+", RuneLRCornerRounded: "+", RuneULCornerRounded: "+", RuneURCornerRounded: "+", RuneLeftwardsTwoHeadedArrowWithTriangleArrowheads: "<", RuneUpwardsTwoHeadedArrowWithTriangleArrowheads: "^", RuneRightwardsTwoHeadedArrowWithTriangleArrowheads: ">", RuneDownwardsTwoHeadedArrowWithTriangleArrowheads: "v", RuneFilledSquareCentred: "#", RuneFilledMediumUpPointingTriangleCentred: "^", RuneFilledMediumDownPointingTriangleCentred: "v", RuneFilledMediumLeftPointingTriangleCentred: "<", RuneFilledMediumRightPointingTriangleCentred: ">", RuneLeftwardsFilledCircledHollowArrow: "<", RuneUpwardsFilledCircledHollowArrow: "^", RuneRightwardsFilledCircledHollowArrow: ">", RuneDownwardsFilledCircledHollowArrow: "v", RuneTriangleUp: "^", RuneTriangleLeft: "<", RuneTriangleDown: "v", RuneTriangleRight: ">", RuneEllipsis: "…", RuneSevenDotSpinner0: "/", RuneSevenDotSpinner1: "|", RuneSevenDotSpinner2: "\\", RuneSevenDotSpinner3: "-", RuneSevenDotSpinner4: "/", RuneSevenDotSpinner5: "|", RuneSevenDotSpinner6: "\\", RuneSevenDotSpinner7: "-", RuneOneDotSpinner0: "/", RuneOneDotSpinner1: "|", RuneOneDotSpinner2: "\\", RuneOneDotSpinner3: "-", RuneOneDotSpinner4: "/", RuneOneDotSpinner5: "|", RuneOneDotSpinner6: "\\", RuneOneDotSpinner7: "-", RuneOrbitDotSpinner0: "/", RuneOrbitDotSpinner1: "|", RuneOrbitDotSpinner2: "\\", RuneOrbitDotSpinner3: "-", }
RuneFallbacks is the default map of fallback strings that will be used to replace a rune when no other more appropriate transformation is available, and the rune cannot be displayed directly.
New entries may be added to this map over time, as it becomes clear that such is desirable. Characters that represent either letters or numbers should not be added to this list unless it is certain that the meaning will still convey unambiguously.
As an example, it would be appropriate to add an ASCII mapping for the full width form of the letter 'A', but it would not be appropriate to do so a glyph representing the country China.
Programs that desire richer fallbacks may register additional ones, or change or even remove these mappings with Screen.RegisterRuneFallback Screen.UnregisterRuneFallback methods.
Note that Unicode is presumed to be able to display all glyphs. This is a pretty poor assumption, but there is no easy way to figure out which glyphs are supported in a given font. Hence, some care in selecting the characters you support in your application is still appropriate.
var StyleInvalid = Style{/* contains filtered or unexported fields */}
StyleInvalid is just an arbitrary invalid style used internally.
Functions ¶
func RegisterArrows ¶ added in v0.5.10
func RegisterArrows(name ArrowName, arrow ArrowRuneSet)
func RegisterBorderRunes ¶ added in v0.5.10
func RegisterBorderRunes(name BorderName, border BorderRuneSet)
func RegisterSpinners ¶ added in v0.5.18
func RegisterSpinners(name SpinnerName, spinner SpinnerRuneSet)
func RegisterStyle ¶ added in v0.5.10
func RegisterTheme ¶ added in v0.5.10
Types ¶
type ArrowRuneSet ¶
func GetArrows ¶ added in v0.5.10
func GetArrows(name ArrowName) (arrow ArrowRuneSet, ok bool)
func (ArrowRuneSet) String ¶
func (b ArrowRuneSet) String() string
type AttrMask ¶
type AttrMask int
AttrMask represents a mask of text attributes, apart from color. Note that support for attributes may vary widely across terminals.
const ( AttrBold AttrMask = 1 << iota AttrBlink AttrReverse AttrUnderline AttrDim AttrItalic AttrStrike AttrInvalid // Mark the style or attributes invalid AttrNone AttrMask = 0 // Just normal text. )
Attributes are not colors, but affect the display of text. They can be combined.
func (AttrMask) IsUnderline ¶
check if the attributes include underline
func (AttrMask) Italic ¶ added in v0.1.4
return the attributes with (true) or without (false) italic
type Border ¶
type BorderName ¶ added in v0.5.10
type BorderName string
const ( NilBorder BorderName = "nil" EmptyBorder BorderName = "empty" StockBorder BorderName = "standard" RoundedBorder BorderName = "rounded" DoubleBorder BorderName = "double" )
type BorderRuneSet ¶
type BorderRuneSet struct { TopLeft rune Top rune TopRight rune Left rune Right rune BottomLeft rune Bottom rune BottomRight rune }
func GetDefaultBorderRunes ¶ added in v0.5.10
func GetDefaultBorderRunes(name BorderName) (border BorderRuneSet, ok bool)
func (BorderRuneSet) String ¶
func (b BorderRuneSet) String() string
type Color ¶
type Color uint64
Color represents a color. The low numeric values are the same as used by ECMA-48, and beyond that XTerm. A 24-bit RGB value may be used by adding in the ColorIsRGB flag. For Color names we use the W3C approved color names.
We use a 64-bit integer to allow future expansion if we want to add an 8-bit alpha, while still leaving us some room for extra options.
Note that on various terminals colors may be approximated however, or not supported at all. If no suitable representation for a color is known, the library will simply not set any color, deferring to whatever default attributes the terminal uses.
const ( // ColorDefault is used to leave the Color unchanged from whatever // system or terminal default may exist. It's also the zero value. ColorDefault Color = 0 // ColorIsValid is used to indicate the color value is actually // valid (initialized). This is useful to permit the zero value // to be treated as the default. ColorValid Color = 1 << 32 // ColorIsRGB is used to indicate that the numeric value is not // a known color constant, but rather an RGB value. The lower // order 3 bytes are RGB. ColorIsRGB Color = 1 << 33 // ColorSpecial is a flag used to indicate that the values have // special meaning, and live outside of the color space(s). ColorSpecial Color = 1 << 34 )
func FindColor ¶
FindColor attempts to find a given color, or the best match possible for it, from the palette given. This is an expensive operation, so results should be cached by the caller.
func GetColor ¶
GetColor creates a Color from a color name (W3C name). A hex value may be supplied as a string in the format "#ffffff".
func NewHexColor ¶
NewHexColor returns a color using the given 24-bit RGB value.
func NewRGBColor ¶
NewRGBColor returns a new color with the given red, green, and blue values. Each value must be represented in the range 0-255.
func PaletteColor ¶
PaletteColor creates a color based on the palette index.
func ParseColor ¶
GetColor creates a Color from a color name (W3C name). A hex value may be supplied as a string in the format "#ffffff".
func (Color) Hex ¶
Hex returns the color's hexadecimal RGB 24-bit value with each component consisting of a single byte, ala R << 16 | G << 8 | B. If the color is unknown or unset, -1 is returned.
func (Color) RGB ¶
RGB returns the red, green, and blue components of the color, with each component represented as a value 0-255. In the event that the color cannot be broken up (not set usually), -1 is returned for each value.
func (Color) String ¶
Stringer interface implementation so the Color can be used in normal fmt operations without required the developer to jump any hoops.
type SpinnerName ¶ added in v0.5.18
type SpinnerName string
const ( SafeSpinner SpinnerName = "safe-spinner" OneDotSpinner SpinnerName = "one-dot-spinner" OrbitDotSpinner SpinnerName = "orbit-dot-spinner" SevenDotSpinner SpinnerName = "seven-dot-spinner" )
type SpinnerRuneSet ¶ added in v0.5.18
type SpinnerRuneSet []rune
func GetSpinners ¶ added in v0.5.18
func GetSpinners(name SpinnerName) (arrow SpinnerRuneSet, ok bool)
func (SpinnerRuneSet) String ¶ added in v0.5.18
func (b SpinnerRuneSet) String() string
func (SpinnerRuneSet) Strings ¶ added in v0.5.18
func (b SpinnerRuneSet) Strings() (s []string)
type Style ¶
type Style struct {
// contains filtered or unexported fields
}
Style represents a complete text style, including both foreground color, background color, and additional attributes such as "bold" or "underline".
Note that not all terminals can display all colors or attributes, and many might have specific incompatibilities between specific attributes and color combinations.
To use Style, just declare a variable of its type.
var StyleDefault Style
StyleDefault represents a default style, based upon the context. It is the zero value.
func GetDefaultColorStyle ¶ added in v0.5.10
func GetDefaultColorStyle() (theme Style)
func GetDefaultMonoStyle ¶ added in v0.5.10
func GetDefaultMonoStyle() (theme Style)
func ParseStyle ¶
func (Style) Attributes ¶
Attributes returns a new style based on s, with its attributes set as specified.
func (Style) Background ¶
Background returns a new style based on s, with the background color set as requested. ColorDefault can be used to select the global default.
func (Style) Blink ¶
Blink returns a new style based on s, with the blink attribute set as requested.
func (Style) Decompose ¶
Decompose breaks a style up, returning the foreground, background, and other attributes.
func (Style) Foreground ¶
Foreground returns a new style based on s, with the foreground color set as requested. ColorDefault can be used to select the global default.
func (Style) Italic ¶
Italic returns a new style based on s, with the italic attribute set as requested.
func (Style) Reverse ¶
Reverse returns a new style based on s, with the reverse attribute set as requested. (Reverse usually changes the foreground and background colors.)
type Theme ¶
type Theme struct { Content ThemeAspect Border ThemeAspect }
func GetDefaultColorTheme ¶ added in v0.5.10
func GetDefaultColorTheme() (theme Theme)
func GetDefaultMonoTheme ¶ added in v0.5.10
func GetDefaultMonoTheme() (theme Theme)
func MakeStyledColorFillTheme ¶ added in v0.5.10
type ThemeAspect ¶
type ThemeAspect struct { Normal Style Selected Style Active Style Prelight Style Insensitive Style FillRune rune BorderRunes BorderRuneSet ArrowRunes ArrowRuneSet Overlay bool // keep existing background }
func (ThemeAspect) String ¶
func (t ThemeAspect) String() string