DOC: adds descriptive comments to exported types and functions

Comments for palette.go exported types and functions.
This commit is contained in:
Ivan Marquez 2019-09-09 20:11:22 -04:00
parent cb55f19565
commit 9ac1601463
1 changed files with 41 additions and 16 deletions

View File

@ -2,33 +2,52 @@ package console
import ( import (
"fmt" "fmt"
ui "github.com/gizak/termui/v3"
"runtime" "runtime"
ui "github.com/gizak/termui/v3"
) )
// Theme is a representation of a theme
type Theme string type Theme string
const ( const (
ThemeDark Theme = "dark" // ThemeDark represents dark theme
ThemeDark Theme = "dark"
// ThemeLight represents light theme
ThemeLight Theme = "light" ThemeLight Theme = "light"
) )
const ( const (
ColorOlive ui.Color = 178 // ColorOlive represents color olive
ColorOlive ui.Color = 178
// ColorDeepSkyBlue represents color deepsky blue
ColorDeepSkyBlue ui.Color = 39 ColorDeepSkyBlue ui.Color = 39
ColorDeepPink ui.Color = 198 // ColorDeepPink represents color deep pink
ColorCian ui.Color = 43 ColorDeepPink ui.Color = 198
ColorOrange ui.Color = 166 // ColorCian represents color cyan
ColorPurple ui.Color = 129 ColorCian ui.Color = 43
ColorGreen ui.Color = 64 // ColorOrange represents color orange
ColorDarkRed ui.Color = 88 ColorOrange ui.Color = 166
ColorBlueViolet ui.Color = 57 // ColorPurple represents color purple
ColorDarkGrey ui.Color = 238 ColorPurple ui.Color = 129
ColorLightGrey ui.Color = 254 // ColorGreen represents color green
ColorGrey ui.Color = 242 ColorGreen ui.Color = 64
ColorWhite ui.Color = 15 // ColorDarkRed represents color dark red
ColorBlack ui.Color = 0 ColorDarkRed ui.Color = 88
ColorClear ui.Color = -1 // ColorBlueViolet represents color blue violet
ColorBlueViolet ui.Color = 57
// ColorDarkGrey represents color dark grey
ColorDarkGrey ui.Color = 238
// ColorLightGrey represents color light grey
ColorLightGrey ui.Color = 254
// ColorGrey represents color grey
ColorGrey ui.Color = 242
// ColorWhite represents color white
ColorWhite ui.Color = 15
// ColorBlack represents color black
ColorBlack ui.Color = 0
// ColorClear represents color clear
ColorClear ui.Color = -1
) )
const ( const (
@ -38,6 +57,7 @@ const (
menuColorReverseWindows ui.Color = 0 menuColorReverseWindows ui.Color = 0
) )
// Palette represents a color palette
type Palette struct { type Palette struct {
ContentColors []ui.Color ContentColors []ui.Color
GradientColors [][]ui.Color GradientColors [][]ui.Color
@ -46,6 +66,7 @@ type Palette struct {
ReverseColor ui.Color ReverseColor ui.Color
} }
// GetPalette returns a color palette based on specified theme
func GetPalette(theme Theme) Palette { func GetPalette(theme Theme) Palette {
switch theme { switch theme {
case ThemeDark: case ThemeDark:
@ -69,6 +90,8 @@ func GetPalette(theme Theme) Palette {
} }
} }
// GetMenuColor returns a color based on the
// operating system target
func GetMenuColor() ui.Color { func GetMenuColor() ui.Color {
switch runtime.GOOS { switch runtime.GOOS {
case "windows": case "windows":
@ -78,6 +101,8 @@ func GetMenuColor() ui.Color {
} }
} }
// GetMenuColorReverse returns a color based on the
// operating system target
func GetMenuColorReverse() ui.Color { func GetMenuColorReverse() ui.Color {
switch runtime.GOOS { switch runtime.GOOS {
case "windows": case "windows":