theme

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

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
)

Variables

View Source
var Ext = Theme{}/* 223 elements not displayed */
View Source
var Git = map[string]Style{
	"git_unmodified": {
		Color: constval.BrightBlack,
	},
	"git_modified": {
		Color: constval.Yellow,
	},
	"git_renamed": {
		Color: constval.Blue,
	},
	"git_copied": {
		Color: constval.Purple,
	},
	"git_deleted": {
		Color: constval.Red,
	},
	"git_added": {
		Color: constval.Green,
	},
	"git_untracked": {
		Color: constval.BrightBlack,
	},
	"git_ignored": {
		Color: constval.BrightRed,
	},
	"git_type_changed": {
		Color: constval.Yellow,
	},
	"git_updated_but_unmerged": {
		Color: constval.BrightYellow,
	},
	"git-repo-skip": {
		Color: constval.BrightBlack,
		Icon:  "-",
	},
	"git-repo-clean": {
		Color: constval.Green,
		Icon:  "clean",
	},
	"git-repo-dirty": {
		Color: constval.Yellow,
		Icon:  "dirty",
	},
	"git-branch-master": {
		Color: constval.Green,
		Bold:  true,
	},
	"git-branch": {
		Color: constval.Yellow,
	},
	"git-branch-none": {
		Color: constval.BrightBlack,
		Icon:  "-",
	},
}
View Source
var Group = map[string]Style{
	"group": {
		Color: constval.Yellow,
		Bold:  true,
	},
	"root": {
		Color: constval.Red,
		Bold:  true,
	},
}
View Source
var InfoTheme = Theme{
	"inode": Style{
		Color: constval.Purple,
	},
	"time": Style{
		Color: constval.Blue,
	},
	"reset": Style{
		Color: constval.Reset,
	},
	"-": {
		Color: constval.White,
	},
	"charset": {
		Color:   constval.White,
		Italics: true,
	},
	"mime": {
		Color:   constval.White,
		Italics: true,
	},
	"checksum": {
		Underline: true,
	},
}
View Source
var Name = map[string]Style{
	"home": {
		Icon:  "\ue617",
		Color: constval.White,
	},
	"desktop": {
		Icon:  "\uf108",
		Color: constval.White,
	},
	"documents": {
		Icon:  "\uF02D",
		Color: constval.White,
	},
	"doc": {
		Color: doc,
		Icon:  "\uf02d",
	},
	"links": {
		Icon:  "\uf0f6",
		Color: constval.White,
	},
	"downloads": {
		Icon:  "\uf498",
		Color: constval.White,
	},
	"trash": {
		Icon:  "\uf1f8",
		Color: constval.BrightBlack,
	},
	".trash": {
		Icon:  "\uf1f8",
		Color: constval.BrightBlack,
	},
	"searches": {
		Icon:  "\uf422",
		Color: constval.White,
	},
	"microsoft": {
		Icon:  "\uF17A",
		Color: constval.White,
	},
	"google": {
		Icon:  "\uf1a0",
		Color: constval.White,
	},
	"onedrive": {
		Icon:  "\ue762",
		Color: constval.Blue,
	},
	"onedrivetemp": {
		Icon:  "\ue762",
		Color: constval.Blue,
	},
	"favorites": {
		Icon:  "\ue623",
		Color: constval.Red,
	},
	"saved games": {
		Icon:  "\uf11b",
		Color: constval.Red,
	},
	".wakatime": {
		Icon:  "\ue641",
		Color: constval.White,
	},
	".azure": {
		Icon:  "\uebd8",
		Color: constval.White,
	},
	"contacts": {
		Icon:  "\uf0c0",
		Color: constval.White,
	},
	"users": {
		Icon:  "\uf0c0",
		Color: constval.White,
	},
	"lib": {
		Icon:  "\uF121",
		Color: constval.White,
	},
	"library": {
		Icon:  "\uF121",
		Color: constval.White,
	},
	"bin": {
		Icon:  "\uE5FC",
		Color: constval.Green,
	},
	"share": {
		Icon:  "\uf064",
		Color: constval.White,
	},
	"license": {
		Icon:  "",
		Color: key,
	},
	"licence": {
		Icon:  "",
		Color: key,
	},
	"shell": {
		Icon:  "\uF489",
		Color: bash,
	},
	"config": {
		Icon:  "\uE615",
		Color: conf,
	},
	".ds_store": {
		Color: constval.BrightBlack,
		Icon:  "\uf179",
	},
	"pkgbuild": {
		Color: pkg,
		Icon:  "\uf303",
	},
	".srcinfo": {
		Color: pkg,
		Icon:  "\uf303",
	},
	"applications": {
		Icon:  "\ueb44",
		Color: constval.Green,
	},
	"android": {
		Icon:  "\uE70E",
		Color: constval.White,
	},
	".idea": {
		Icon:  "\uE7B5",
		Color: constval.White,
	},
	".github": {
		Icon:  "\uF408",
		Color: constval.White,
	},
	".gitattributes": {
		Icon:  "\uE65D",
		Color: constval.BrightBlack,
	},
	".gitmodules": {
		Icon:  "\uE65D",
		Color: constval.BrightBlack,
	},
	".gitconfig": {
		Icon:  "\uE65D",
		Color: constval.BrightBlack,
	},
	".vscode": {
		Icon:  "\uE70C",
		Color: constval.White,
	},
	"include": {
		Icon:  "\ue5fc",
		Color: constval.White,
	},
	".dotnet": {
		Icon:  "\ue72e",
		Color: constval.White,
	},
	"src": {
		Icon:  "\ue796",
		Color: constval.White,
	},
	"node_modules": {
		Icon:  "\ue5fa",
		Color: constval.White,
	},
	"font": {
		Icon:  "\uf031",
		Color: constval.White,
	},
	"fonts": {
		Icon:  "\uf031",
		Color: constval.White,
	},
	".git": {
		Color: constval.White,
		Icon:  "\uF1D3",
	},
	".gitignore": {
		Color: constval.BrightBlack,
		Icon:  "\ue65d",
	},
	".gitignore_global": {
		Color: constval.BrightBlack,
		Icon:  "\ue65d",
	},
	".gitlab-ci.yml": {
		Color: constval.White,
		Icon:  "\uF296",
	},
	"cmakelists.txt": {
		Color: lang,
		Icon:  "\uE20F",
	},
	"makefile": {
		Color: lang,
		Icon:  "\uE20F",
	},
	"justfile": {
		Color: lang,
		Icon:  "\uE20F",
	},
	"history": {
		Icon:  "\uF1DA",
		Color: constval.BrightBlack,
	},
	".history": {
		Icon:  "\uF1DA",
		Color: constval.BrightBlack,
	},
	"recovery": {
		Icon:  "\uF1DA",
		Color: constval.BrightBlack,
	},
	"apple": {
		Color: constval.BrightBlack,
		Icon:  "\uF179",
	},
	"dockerfile": {
		Color: constval.BrightYellow,
		Icon:  "\ue7b0",
	},
	"dockerignore": {
		Color: constval.BrightYellow,
		Icon:  "\ue7b0",
	},
	"readme": {
		Color:     constval.Yellow,
		Icon:      "\uF48A",
		Underline: true,
		Bold:      true,
	},
	"readme.md": {
		Color:     constval.Yellow,
		Icon:      "\uF48A",
		Underline: true,
		Bold:      true,
	},
	"flake.nix": {
		Color:     constval.Yellow,
		Icon:      "\uF313",
		Underline: true,
		Bold:      true,
	},
	"jenkinsfile": {
		Color: lang,
		Icon:  "\uE66E",
	},
	"brewfile": {
		Color: lang,
		Icon:  "\uF016",
	},
	"sdk": {
		Icon:  "\uF121",
		Color: constval.White,
	},
	"pictures": {
		Icon:  "\uF1C5",
		Color: constval.White,
	},
	"videos": {
		Icon:  "",
		Color: constval.White,
	},
	"movies": {
		Icon:  "",
		Color: constval.White,
	},
	"music": {
		Icon:  "\uF025",
		Color: constval.White,
	},
	"audio": {
		Icon:  "\uF025",
		Color: constval.White,
	},
	"cargo.lock": {
		Color:     lang,
		Icon:      "\uE7A8",
		Faint:     true,
		Underline: true,
	},
	"cargo.toml": {
		Color:     lang,
		Icon:      "\uE7A8",
		Underline: true,
	},
	"known_hosts": {
		Color: constval.White,
		Icon:  "\uEB39",
	},
	"repo": {
		Color: constval.White,
		Icon:  "\uea62",
	},
	".ssh": {
		Icon:  "\ueba9",
		Color: constval.White,
	},
	"boot": {
		Icon:  "\uf287",
		Color: constval.White,
	},
	"cache": {
		Icon:  "\uf49b",
		Color: constval.White,
	},
	"passwd": {
		Color: constval.Cyan,
		Icon:  "\uF023",
	},
	"vagrantfile": {
		Color: lang,
		Icon:  "⍱",
	},
	"package.json": {
		Color:     conf,
		Icon:      "\uE718",
		Underline: true,
	},
	"tsconfig.json": {
		Color:     conf,
		Icon:      "\uE628",
		Underline: true,
	},
	"go.mod": {
		Color:     lang,
		Icon:      "\uE626",
		Underline: true,
	},
	"go.sum": {
		Color:     lang,
		Icon:      "\uE626",
		Underline: true,
		Faint:     true,
	},
	".python_history": {
		Color: lang,
		Icon:  "\uE606",
	},
	".cfusertextencoding": {
		Color: constval.BrightBlack,
		Icon:  "\uF179",
	},
	"maintainers": {
		Color: constval.White,
		Icon:  "\uF0C0",
	},
	"__pycache__": {
		Color: lang,
		Icon:  "\uE606",
		Faint: true,
	},
	"requirements.txt": {
		Color: constval.White,
		Icon:  "\uE606",
		Faint: true,
	},
	"robots.txt": {
		Color: constval.White,
		Icon:  "\U000F06A9",
	},
	"docker-compose.yml": {
		Color: constval.BrightYellow,
		Icon:  "\ue7b0",
	},
	"docker-compose.yaml": {
		Color: constval.BrightYellow,
		Icon:  "\ue7b0",
	},
	"contributing": {
		Color: constval.White,
		Icon:  "\uF0C0",
	},
	"contributing.md": {
		Color: constval.White,
		Icon:  "\uF0C0",
	},
	"cron.minutely": {
		Color: constval.White,
		Icon:  "\uE5FC",
	},
	"cron.d": {
		Color: constval.White,
		Icon:  "\uE5FC",
	},
	"cron.daily": {
		Color: constval.White,
		Icon:  "\uE5FC",
	},
	"cron.hourly": {
		Color: constval.White,
		Icon:  "\uE5FC",
	},
	"cron.mouthly": {
		Color: constval.White,
		Icon:  "\uE5FC",
	},
	"cron.weekly": {
		Color: constval.White,
		Icon:  "\uE5FC",
	},
	"crontab": {
		Color: constval.White,
		Icon:  "\uE5FC",
	},
}
View Source
var Owner = map[string]Style{
	"owner": {
		Color: constval.Yellow,
		Bold:  true,
	},
	"root": {
		Color: constval.Red,
		Bold:  true,
	},
}
View Source
var Permission = map[string]Style{
	"block": {
		Color: constval.Cyan,
		Bold:  true,
	},
	"directory": {
		Color: constval.Blue,
		Bold:  true,
	},
	"link": {
		Color: constval.Purple,
		Bold:  true,
	},
	"char": {
		Color: constval.Yellow,
		Bold:  true,
	},
	"pipe": {
		Color: constval.Yellow,
		Bold:  true,
	},
	"socket": {
		Color: constval.Yellow,
		Bold:  true,
	},
	"setuid": {
		Color: constval.Purple,
		Bold:  true,
	},
	"setgid": {
		Color: constval.Purple,
		Bold:  true,
	},
	"read": {
		Color: constval.Yellow,
		Bold:  true,
	},
	"write": {
		Color: constval.Red,
		Bold:  true,
	},
	"exe": {
		Color: constval.Green,
		Bold:  true,
	},
	"-": {
		Color: constval.BrightBlack,
	},
	"octal": {
		Color: color256(208),
		Bold:  true,
	},
}
View Source
var Size = map[string]Style{
	"-": {
		Color: constval.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),
	},
	"KiB": {
		Color: rgb(20, 207, 100),
	},
	"MB": {
		Color: rgb(20, 188, 100),
	},
	"MiB": {
		Color: rgb(20, 188, 100),
	},
	"GB": {
		Color: rgb(20, 170, 100),
	},
	"GiB": {
		Color: rgb(20, 170, 100),
	},
	"TB": {
		Color: rgb(20, 153, 100),
	},
	"TiB": {
		Color: rgb(20, 153, 100),
	},
}
View Source
var Special = map[string]Style{
	"dir": {
		Color: dir,
		Icon:  "\uE5FF",
	},
	"empty-dir": {
		Color: dir,
		Icon:  "\uF115",
	},
	"dir-prompt": {
		Color: constval.Yellow,
		Icon:  "► ",
	},
	"pipe": {
		Color: constval.Cyan,
		Icon:  "\uF124",
	},
	"socket": {
		Color: constval.Cyan,
		Icon:  "\uF1E6",
	},
	"device": {
		Color: constval.Yellow,
		Icon:  "󰜫",
	},
	"char": {
		Color: constval.Yellow,
		Icon:  "",
	},
	"exe": {
		Color: constval.Green,
		Icon:  "\uF17A",
	},
	"link": {
		Color: constval.Purple,
	},
	"file": {
		Color: constval.White,
		Icon:  "\uF016",
	},
	"hidden-file": {
		Color: constval.White,
		Icon:  "",
	},
	"mounts": {
		Color: constval.BrightBlack,
	},
}
View Source
var Symlink = map[string]Style{
	"symlink_path": {
		Color: constval.Green,
	},
	"symlink_broken_path": {
		Color:     constval.Red,
		Underline: true,
	},
	"symlink": {
		Color: constval.Purple,
		Icon:  "\ueb15",
	},
	"symlink_arrow": {
		Color: constval.BrightWhite,
		Icon:  " => ",
	},
	"link-num": {
		Color: constval.Red,
	},
}

Functions

func BasicTo256

func BasicTo256(b string) string

BasicTo256 convert basic color to 256 color

func BasicToRGB

func BasicToRGB(basic string) string

BasicToRGB convert basic color to rgb color

func BasicToRGBInt

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

func Color256

func Color256(color int) (string, error)

func Color256ToBasic

func Color256ToBasic(str256 string) (string, error)

Color256ToBasic convert 256 color to basic color

func Color256ToRGB

func Color256ToRGB(str256 string) (string, error)

Color256ToRGB convert 256 color to RGB color

func ConvertColor

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

func ConvertColorIfGreaterThanExpect

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

func ConvertThemeColor

func ConvertThemeColor()

func GetTheme

func GetTheme(path string) error

func HexToRgb

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

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

func RGB

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

func RGBMultiply

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

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

RGBTo256 convert rgb color to 256 color

func RGBTo256Int

func RGBTo256Int(r, g, b uint8) int

RGBTo256Int convert rgb color to 256 color

func RGBToBasic

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

RGBToBasic convert rgb color to basic color

func RGBToBasicInt

func RGBToBasicInt(r, g, b uint8) string

func SetClassic

func SetClassic()

Types

type All

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

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

func (*All) CheckLowerCase

func (a *All) CheckLowerCase()

func (*All) UnmarshalJSON

func (a *All) UnmarshalJSON(bytes []byte) error

type ErrBadColor

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

func (ErrBadColor) Error

func (e ErrBadColor) Error() string

type ErrOpenTheme

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

func (ErrOpenTheme) Error

func (e ErrOpenTheme) Error() string

type ErrUnknownColorType

type ErrUnknownColorType struct {
	colortool.Level
}

func (ErrUnknownColorType) Error

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"`
	Faint     bool   `json:"faint,omitempty"`
	Italics   bool   `json:"italics,omitempty"`
	Blink     bool   `json:"blink,omitempty"`
}

func (*Style) FromReadable

func (s *Style) FromReadable() error

func (*Style) ToReadable

func (s *Style) ToReadable() Style

func (*Style) UnmarshalJSON

func (s *Style) UnmarshalJSON(bytes []byte) error

type StyleForUnmarshal

type StyleForUnmarshal struct {
	Color     string `json:"color,omitempty"`
	Icon      string `json:"icon,omitempty"`
	Underline bool   `json:"underline,omitempty"`
	Bold      bool   `json:"bold,omitempty"`
	Faint     bool   `json:"faint,omitempty"`
	Italics   bool   `json:"italics,omitempty"`
	Blink     bool   `json:"blink,omitempty"`
}

type Theme

type Theme map[string]Style

func (Theme) UnmarshalJSON

func (t Theme) UnmarshalJSON(bytes []byte) error

Jump to

Keyboard shortcuts

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