theme

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Black        = "\033[0;30m" // 0,0,0
	Red          = "\033[0;31m" // 205,0,0
	Green        = "\033[0;32m" // 0,205,0
	Yellow       = "\033[0;33m" // 205,205,0
	Blue         = "\033[0;34m" // 0,0,238
	Purple       = "\033[0;35m" // 205,0,205
	Cyan         = "\033[0;36m" // 0,205,205
	White        = "\033[0;37m" // 229,229,229
	BrightBlack  = "\033[0;90m" // 127,127,127
	BrightRed    = "\033[0;91m" // 255,0,0
	BrightGreen  = "\033[0;92m" // 0,255,0
	BrightYellow = "\033[0;93m" // 255,255,0
	BrightBlue   = "\033[0;94m" // 92,92,255
	BrightPurple = "\033[0;95m" // 255,0,255
	BrightCyan   = "\033[0;96m" // 0,255,255
	BrightWhite  = "\033[0;97m" // 255,255,255
	Success      = Green
	Error        = Red
	Warn         = Yellow
	Underline    = "\033[4m"
	Bold         = "\033[1m"
)
View Source
const (
	BasicFormat    = "\033[0;%dm"
	Color256Format = "\033[38;5;%dm"
	RGBFormat      = "\033[38;2;%d;%d;%dm"
)
View Source
const (
	None      = colortool.LevelNo
	Ascii     = colortool.Level16
	C256      = colortool.Level256
	TrueColor = colortool.LevelRgb
)
View Source
const Reset = "\033[0m"

Variables

View Source
var Ext = Theme{}/* 190 elements not displayed */
View Source
var Git = map[string]Style{
	"git_unmodified": {
		Color: BrightBlack,
	},
	"git_modified": {
		Color: Yellow,
	},
	"git_renamed": {
		Color: Blue,
	},
	"git_copied": {
		Color: Purple,
	},
	"git_deleted": {
		Color: Red,
	},
	"git_added": {
		Color: Green,
	},
	"git_untracked": {
		Color: BrightBlack,
	},
	"git_ignored": {
		Color: BrightRed,
	},
	"git_type_changed": {
		Color: Yellow,
	},
	"git_updated_but_unmerged": {
		Color: BrightYellow,
	},
}
View Source
var Group = map[string]Style{
	"group": {
		Color: Yellow,
	},
	"root": {
		Color: Red,
	},
}
View Source
var InfoTheme = Theme{
	"inode": Style{
		Color: Purple,
	},
	"time": Style{
		Color: Blue,
	},
	"reset": Style{
		Color: Reset,
	},
	"-": {
		Color: White,
	},
}
View Source
var Name = map[string]Style{
	"home": {
		Icon:  "\ue617",
		Color: White,
	},
	"desktop": {
		Icon:  "\uf108",
		Color: White,
	},
	"documents": {
		Icon:  "\uf0f6",
		Color: White,
	},
	"links": {
		Icon:  "\uf0f6",
		Color: White,
	},
	"downloads": {
		Icon:  "\uf498",
		Color: White,
	},
	"trash": {
		Icon:  "\uf1f8",
		Color: BrightBlack,
	},
	"searches": {
		Icon:  "\uf422",
		Color: White,
	},
	"microsoft": {
		Icon:  "\uF17A",
		Color: White,
	},
	"google": {
		Icon:  "\uf1a0",
		Color: White,
	},
	"onedrive": {
		Icon:  "\ue762",
		Color: Blue,
	},
	"onedrivetemp": {
		Icon:  "\ue762",
		Color: Blue,
	},
	"favorites": {
		Icon:  "\ue623",
		Color: Red,
	},
	"saved games": {
		Icon:  "\uf11b",
		Color: Red,
	},
	".wakatime": {
		Icon:  "\ue641",
		Color: White,
	},
	".azure": {
		Icon:  "\uebd8",
		Color: White,
	},
	"contacts": {
		Icon:  "\uf0c0",
		Color: White,
	},
	"users": {
		Icon:  "\uf0c0",
		Color: White,
	},
	"lib": {
		Icon:  "\uF121",
		Color: White,
	},
	"library": {
		Icon:  "\uF121",
		Color: White,
	},
	"bin": {
		Icon:  "\uE5FC",
		Color: Green,
	},
	"share": {
		Icon:  "\uf064",
		Color: White,
	},
	"license": {
		Icon:  "",
		Color: key,
	},
	"shell": {
		Icon:  "\uF489",
		Color: bash,
	},
	"config": {
		Icon:  "\uE615",
		Color: conf,
	},
	".ds_store": {
		Color: BrightBlack,
		Icon:  "\uf179",
	},
	".gitconfig": {
		Color: conf,
		Icon:  "\uf1d3",
	},
	"pkgbuild": {
		Color: pkg,
		Icon:  "\uf303",
	},
	".srcinfo": {
		Color: pkg,
		Icon:  "\uf303",
	},
	"applications": {
		Icon:  "\ueb44",
		Color: Green,
	},
	"android": {
		Icon:  "\uE70E",
		Color: White,
	},
	".idea": {
		Icon:  "\uE7B5",
		Color: White,
	},
	".github": {
		Icon:  "\uF408",
		Color: White,
	},
	".vscode": {
		Icon:  "\uE70C",
		Color: White,
	},
	"include": {
		Icon:  "\ue5fc",
		Color: White,
	},
	".dotnet": {
		Icon:  "\ue72e",
		Color: White,
	},
	"src": {
		Icon:  "\ue796",
		Color: White,
	},
	"node_modules": {
		Icon:  "\ue5fa",
		Color: White,
	},
	"font": {
		Icon:  "\uf031",
		Color: White,
	},
	"fonts": {
		Icon:  "\uf031",
		Color: White,
	},
	".git": {
		Color: White,
		Icon:  "\uF1D3",
	},
	".gitignore": {
		Color: BrightBlack,
		Icon:  "\ue65d",
	},
	"cmakeLists.txt": {
		Color: lang,
		Icon:  "\uE20F",
	},
	"makefile": {
		Color: lang,
		Icon:  "\uE20F",
	},
	"justfile": {
		Color: lang,
		Icon:  "\uE20F",
	},
	"history": {
		Icon:  "\uF1DA",
		Color: BrightBlack,
	},
	".history": {
		Icon:  "\uF1DA",
		Color: BrightBlack,
	},
	"recovery": {
		Icon:  "\uF1DA",
		Color: BrightBlack,
	},
	"apple": {
		Color: BrightBlack,
		Icon:  "\uF179",
	},
	"dockerfile": {
		Color: Yellow,
		Icon:  "\ue7b0",
	},
	"readme": {
		Color:     BrightYellow,
		Icon:      "\uF48A",
		Underline: true,
		Bold:      true,
	},
	"readme.md": {
		Color:     BrightYellow,
		Icon:      "\uF48A",
		Underline: true,
		Bold:      true,
	},
	"sdk": {
		Icon:  "\uF121",
		Color: White,
	},
	"pictures": {
		Icon:  "\uF1C5",
		Color: White,
	},
	"videos": {
		Icon:  "",
		Color: White,
	},
	"movies": {
		Icon:  "",
		Color: White,
	},
	"music": {
		Icon:  "\uF025",
		Color: White,
	},
	"audio": {
		Icon:  "\uF025",
		Color: White,
	},
	"cargo.lock": {
		Color: lock,
		Icon:  "\uE7A8",
	},
	"cargo.toml": {
		Color: lang,
		Icon:  "\uE7A8",
	},
	"known_hosts": {
		Color: White,
		Icon:  "\uEB39",
	},
	"repo": {
		Color: White,
		Icon:  "\uea62",
	},
	".ssh": {
		Icon:  "\ueba9",
		Color: White,
	},
	"boot": {
		Icon:  "\uf287",
		Color: White,
	},
	"cache": {
		Icon:  "\uf49b",
		Color: White,
	},
}
View Source
var Owner = map[string]Style{
	"owner": {
		Color: Yellow,
	},
	"root": {
		Color: Red,
	},
}
View Source
var Permission = map[string]Style{
	"D": {
		Color: Cyan,
	},
	"d": {
		Color: Blue,
	},
	"l": {
		Color: Purple,
	},
	"b": {
		Color: Yellow,
	},
	"c": {
		Color: Yellow,
	},
	"p": {
		Color: Yellow,
	},
	"s": {
		Color: Yellow,
	},
	"r": {
		Color: Yellow,
	},
	"w": {
		Color: Red,
	},
	"x": {
		Color: Green,
	},
	"-": {
		Color: White,
	},
	"octal": {
		Color: color256(208),
	},
}
View Source
var Size = map[string]Style{
	"-": {
		Color: White,
	},
	"block": {
		Color: rgb(20, 255, 100),
	},
	"bit": {
		Color: rgb(20, 255, 100),
	},
	"B": {
		Color: rgb(20, 230, 100),
	},
	"KB": {
		Color: rgb(20, 207, 100),
	},
	"MB": {
		Color: rgb(20, 188, 100),
	},
	"GB": {
		Color: rgb(20, 170, 100),
	},
	"TB": {
		Color: rgb(20, 153, 100),
	},
	"PB": {
		Color: rgb(20, 138, 100),
	},
	"EB": {
		Color: rgb(20, 125, 100),
	},
	"ZB": {
		Color: rgb(20, 112, 100),
	},
	"YB": {
		Color: rgb(20, 100, 100),
	},
	"BB": {
		Color: rgb(20, 90, 100),
	},
	"NB": {
		Color: rgb(20, 70, 100),
	},
}
View Source
var Special = map[string]Style{
	"dir": {
		Color: dir,
		Icon:  "\uF115",
	},
	"pipe": {
		Color: Cyan,
		Icon:  "\uF124",
	},
	"socket": {
		Color: Cyan,
		Icon:  "\uF1E6",
	},
	"exe": {
		Color: Green,
		Icon:  "\uF17A",
	},
	"link": {
		Color: Purple,
	},
	"file": {
		Color: White,
		Icon:  "\uF016",
	},
}
View Source
var Symlink = map[string]Style{
	"symlink_path": {
		Color: Green,
	},
	"symlink_broken_path": {
		Color:     Red,
		Underline: true,
	},
	"symlink": {
		Color: Purple,
		Icon:  "\ueb15",
	},
	"symlink_arrow": {
		Color: BrightWhite,
		Icon:  " => ",
	},
}

Functions

func BasicTo256 added in v0.9.0

func BasicTo256(b string) string

BasicTo256 convert basic color to 256 color

func BasicToRGB added in v0.9.0

func BasicToRGB(basic string) string

BasicToRGB convert basic color to rgb color

func BasicToRGBInt added in v0.9.0

func BasicToRGBInt(basic string) (r, g, b uint8)

func Color256 added in v0.9.0

func Color256(color int) (string, error)

func Color256ToBasic added in v0.9.0

func Color256ToBasic(str256 string) (string, error)

Color256ToBasic convert 256 color to basic color

func Color256ToRGB added in v0.9.0

func Color256ToRGB(str256 string) (string, error)

Color256ToRGB convert 256 color to RGB color

func ConvertColor added in v0.9.0

func ConvertColor(to colortool.Level, src string) (string, error)

func ConvertColorIfGreaterThanExpect added in v0.9.0

func ConvertColorIfGreaterThanExpect(to colortool.Level, src string) (string, error)

func ConvertThemeColor added in v0.9.0

func ConvertThemeColor()

func GetTheme

func GetTheme(path string) error

func HexToRgb added in v0.9.0

func HexToRgb(hex string) (rgb []uint8)

HexToRgb convert hex color to rgb color from gookit/color github.com/gookit/color

func RGB added in v0.9.0

func RGB(r, g, b uint8) (string, error)

func RGBMultiply added in v0.9.0

func RGBMultiply(rgbStr string, radio float64) string

RGBMultiply will multiply each r,g,b value by radio if radio < 0, return the original string if radio = 0, return the color of black if 0 < radio < 1, the color will be darker if radio > 1, the color will be lighter, and if the result is greater than 255, it will be 255

func RGBTo256 added in v0.9.0

func RGBTo256(r, g, b uint8) (string, error)

RGBTo256 convert rgb color to 256 color

func RGBTo256Int added in v0.9.0

func RGBTo256Int(r, g, b uint8) int

RGBTo256Int convert rgb color to 256 color

func RGBToBasic added in v0.9.0

func RGBToBasic(r, g, b uint8) (string, error)

RGBToBasic convert rgb color to basic color

func RGBToBasicInt added in v0.9.0

func RGBToBasicInt(r, g, b uint8) string

func RemoveAllColor added in v0.11.0

func RemoveAllColor()

Types

type All added in v0.11.0

type All struct {
	InfoTheme  Theme `json:"info,omitempty"`
	Permission Theme `json:"permission,omitempty"`
	Size       Theme `json:"size,omitempty"`
	User       Theme `json:"user,omitempty"`
	Group      Theme `json:"group,omitempty"`
	Symlink    Theme `json:"symlink,omitempty"`
	Git        Theme `json:"git,omitempty"`
	Name       Theme `json:"name,omitempty"`
	Special    Theme `json:"special,omitempty"`
	Ext        Theme `json:"ext,omitempty"`
}
var (
	DefaultAll All
)

func (*All) Apply added in v0.11.0

func (a *All) Apply(f func(theme Theme))

type ErrBadColor added in v0.9.0

type ErrBadColor struct {
	// contains filtered or unexported fields
}

func (ErrBadColor) Error added in v0.9.0

func (e ErrBadColor) Error() string

type ErrUnknownColorType added in v0.9.0

type ErrUnknownColorType struct {
	colortool.Level
}

func (ErrUnknownColorType) Error added in v0.9.0

func (e ErrUnknownColorType) Error() string

type Style

type Style struct {
	// Color of the text.
	Color string `json:"color,omitempty"`
	// unicode Icon
	Icon      string `json:"icon,omitempty"`
	Underline bool   `json:"underline,omitempty"`
	Bold      bool   `json:"bold,omitempty"`
}

func (*Style) FromReadable added in v0.11.0

func (s *Style) FromReadable() error

func (*Style) ToReadable added in v0.11.0

func (s *Style) ToReadable() Style

type Theme

type Theme map[string]Style

Jump to

Keyboard shortcuts

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