paint

package
v0.5.23 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 15

Documentation

Index

Constants

View Source
const (
	ColorBlack = ColorValid + iota
	ColorMaroon
	ColorGreen
	ColorOlive
	ColorNavy
	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
	ColorNavajoWhite
	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.

View Source
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.

View Source
const (
	DefaultFillRune = ' '
	DefaultNilRune  = rune(0)
)
View Source
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.

View Source
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                       = '▯'
)
View Source
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

View Source
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.

View Source
var ColorValues = map[Color]int32{}/* 379 elements not displayed */

ColorValues maps color constants to their RGB values.

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.

View Source
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 RegisterStyle(name StyleName, theme Style)

func RegisterTheme added in v0.5.10

func RegisterTheme(name ThemeName, theme Theme)

Types

type ArrowName added in v0.5.10

type ArrowName string
const (
	NilArrow   ArrowName = "nil"
	StockArrow ArrowName = "stock"
	WideArrow  ArrowName = "wide"
)

type ArrowRuneSet

type ArrowRuneSet struct {
	Up    rune
	Left  rune
	Down  rune
	Right rune
}

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 (m AttrMask) Blink(v bool) AttrMask

return the attributes with (true) or without (false) blink

func (AttrMask) Bold

func (m AttrMask) Bold(v bool) AttrMask

return the attributes with (true) or without (false) bold

func (AttrMask) Dim

func (m AttrMask) Dim(v bool) AttrMask

return the attributes with (true) or without (false) dim

func (m AttrMask) IsBlink() bool

check if the attributes include blink

func (AttrMask) IsBold

func (m AttrMask) IsBold() bool

check if the attributes include bold

func (AttrMask) IsDim

func (m AttrMask) IsDim() bool

check if the attributes include dim

func (AttrMask) IsItalic added in v0.1.4

func (m AttrMask) IsItalic() bool

check if the attributes include italics

func (AttrMask) IsNormal

func (m AttrMask) IsNormal() bool

check if the attributes are normal

func (AttrMask) IsReverse

func (m AttrMask) IsReverse() bool

check if the attributes include reverse

func (AttrMask) IsStrike added in v0.1.4

func (m AttrMask) IsStrike() bool

check if the attributes include italics

func (AttrMask) IsUnderline

func (m AttrMask) IsUnderline() bool

check if the attributes include underline

func (AttrMask) Italic added in v0.1.4

func (m AttrMask) Italic(v bool) AttrMask

return the attributes with (true) or without (false) italic

func (AttrMask) Normal

func (m AttrMask) Normal() AttrMask

return a normal attribute mask

func (AttrMask) Reverse

func (m AttrMask) Reverse(v bool) AttrMask

return the attributes with (true) or without (false) reverse

func (AttrMask) Strike added in v0.1.4

func (m AttrMask) Strike(v bool) AttrMask

return the attributes with (true) or without (false) strikethrough

func (AttrMask) Underline

func (m AttrMask) Underline(v bool) AttrMask

return the attributes with (true) or without (false) underline

type Border

type Border struct {
	DrawLeft    bool
	DrawRight   bool
	DrawTop     bool
	DrawBottom  bool
	TopLeft     rune
	Top         rune
	TopRight    rune
	Left        rune
	Right       rune
	BottomLeft  rune
	Bottom      rune
	BottomRight rune
}

func NewBorder

func NewBorder() *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

func FindColor(c Color, palette []Color) Color

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

func GetColor(name string) Color

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

func NewHexColor(v int32) Color

NewHexColor returns a color using the given 24-bit RGB value.

func NewRGBColor

func NewRGBColor(r, g, b int32) Color

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

func PaletteColor(index int) Color

PaletteColor creates a color based on the palette index.

func ParseColor

func ParseColor(name string) (c Color, ok bool)

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

func (c Color) Hex() int32

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) IsRGB

func (c Color) IsRGB() bool

IsRGB is true if the color is an RGB specific value.

func (Color) RGB

func (c Color) RGB() (int32, int32, int32)

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

func (c Color) String() string

Stringer interface implementation so the Color can be used in normal fmt operations without required the developer to jump any hoops.

func (Color) TrueColor

func (c Color) TrueColor() Color

TrueColor returns the true color (RGB) version of the provided color. This is useful for ensuring color accuracy when using named colors. This will override terminal theme colors.

func (Color) Valid

func (c Color) Valid() bool

Valid indicates the color is a valid value (has been set).

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 GetStyle added in v0.5.10

func GetStyle(name StyleName) (theme Style, ok bool)

func ParseStyle

func ParseStyle(value string) (style Style, err error)

func (Style) Attributes

func (s Style) Attributes(attrs AttrMask) Style

Attributes returns a new style based on s, with its attributes set as specified.

func (Style) Background

func (s Style) Background(c Color) Style

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 (s Style) Blink(on bool) Style

Blink returns a new style based on s, with the blink attribute set as requested.

func (Style) Bold

func (s Style) Bold(on bool) Style

Bold returns a new style based on s, with the bold attribute set as requested.

func (Style) Decompose

func (s Style) Decompose() (fg Color, bg Color, attr AttrMask)

Decompose breaks a style up, returning the foreground, background, and other attributes.

func (Style) Dim

func (s Style) Dim(on bool) Style

Dim returns a new style based on s, with the dim attribute set as requested.

func (Style) Equals added in v0.5.9

func (s Style) Equals(other Style) bool

func (Style) Foreground

func (s Style) Foreground(c Color) Style

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

func (s Style) Italic(on bool) Style

Italic returns a new style based on s, with the italic attribute set as requested.

func (Style) Normal

func (s Style) Normal() Style

Normal returns the style with all attributes disabled.

func (Style) Reverse

func (s Style) Reverse(on bool) Style

Reverse returns a new style based on s, with the reverse attribute set as requested. (Reverse usually changes the foreground and background colors.)

func (Style) Strike added in v0.1.4

func (s Style) Strike(on bool) Style

Strike sets strikethrough mode.

func (Style) String

func (s Style) String() string

func (Style) Underline

func (s Style) Underline(on bool) Style

Underline returns a new style based on s, with the underline attribute set as requested.

type StyleName added in v0.5.10

type StyleName string
const (
	NilStyle   StyleName = "nil"
	MonoStyle  StyleName = "mono"
	ColorStyle StyleName = "color"
)

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 GetTheme added in v0.5.10

func GetTheme(name ThemeName) (theme Theme, ok bool)

func MakeStyledColorFillTheme added in v0.5.10

func MakeStyledColorFillTheme(style Style) (theme Theme)

func (Theme) Clone added in v0.5.10

func (t Theme) Clone() Theme

func (Theme) String

func (t Theme) String() string

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

type ThemeName added in v0.5.10

type ThemeName string
const (
	NilTheme     ThemeName = "nil"
	MonoTheme    ThemeName = "mono"
	ColorTheme   ThemeName = "color"
	DisplayTheme ThemeName = "display"
)

Jump to

Keyboard shortcuts

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