Documentation
¶
Index ¶
- Constants
- Variables
- func BasicTo256(b string) string
- func BasicToRGB(basic string) string
- func BasicToRGBInt(basic string) (r, g, b uint8)
- func Color256(color int) (string, error)
- func Color256ToBasic(str256 string) (string, error)
- func Color256ToRGB(str256 string) (string, error)
- func ConvertColorIfGreaterThanExpect(to colortool.Level, src string) (string, error)
- func ConvertThemeColor()
- func GetTheme(path string) error
- func HexToRgb(hex string) (rgb []uint8)
- func HslToRgb(h, s, l float64) (uint8, uint8, uint8)
- func IsValidHexColor(color string) bool
- func RGB(r, g, b uint8) (string, error)
- func RGBMultiply(rgbStr string, radio float64) string
- func RGBTo256(r, g, b uint8) string
- func RGBTo256Int(r, g, b uint8) int
- func RGBToBasic(r, g, b uint8) string
- func RGBToBasicInt(r, g, b uint8) string
- func SetClassic()
- type All
- type ErrBadColor
- type ErrOpenTheme
- type ErrUnknownColorType
- type Style
- type Theme
Constants ¶
View Source
const ( BasicFormat = "\033[0;%dm" Color256Format = "\033[38;5;%dm" RGBFormat = "\033[38;2;%d;%d;%dm" )
Variables ¶
View Source
var ColorLevel = colortool.DetectColorLevel()
View Source
var Ext = Theme{}/* 231 elements not displayed */
View Source
var Git = map[string]Style{ "git_unmodified": { Color: global.BrightBlack, }, "git_modified": { Color: global.Yellow, }, "git_renamed": { Color: global.Blue, }, "git_copied": { Color: global.Purple, }, "git_deleted": { Color: global.Red, }, "git_added": { Color: global.Green, }, "git_untracked": { Color: global.BrightBlack, }, "git_ignored": { Color: global.BrightRed, }, "git_type_changed": { Color: global.Yellow, }, "git_updated_but_unmerged": { Color: global.BrightYellow, }, "git-repo-skip": { Color: global.BrightBlack, Icon: "-", }, "git-repo-clean": { Color: global.Green, Icon: "clean", }, "git-repo-dirty": { Color: global.Yellow, Icon: "dirty", }, "git-branch-master": { Color: global.Green, Bold: true, }, "git-branch": { Color: global.Yellow, }, "git-branch-none": { Color: global.BrightBlack, Icon: "-", }, "git-author": { Color: rgb(67, 202, 207), }, "git-author-date": { Color: rgb(54, 102, 180), }, "git-commit-hash": { Color: global.BrightBlack, }, }
View Source
var Group = map[string]Style{ "group": { Color: global.Yellow, Bold: true, }, "root": { Color: global.Red, Bold: true, }, }
View Source
var InfoTheme = Theme{ "inode": Style{ Color: global.Purple, }, "time": Style{ Color: global.Blue, }, "reset": Style{ Color: global.Reset, }, "-": { Color: global.White, }, "charset": { Color: global.White, Italics: true, }, "mime": { Color: global.White, Italics: true, }, "checksum": { Underline: true, }, }
View Source
var Name = map[string]Style{ "home": { Icon: "\ue617", Color: global.White, }, "desktop": { Icon: "\uf108", Color: global.White, }, "documents": { Icon: "\uF02D", Color: global.White, }, "doc": { Color: doc, Icon: "\uf02d", }, "links": { Icon: "\uf0f6", Color: global.White, }, "downloads": { Icon: "\uf498", Color: global.White, }, "trash": { Icon: "\uf1f8", Color: global.BrightBlack, }, ".trash": { Icon: "\uf1f8", Color: global.BrightBlack, }, "searches": { Icon: "\uf422", Color: global.White, }, "microsoft": { Icon: "\uF17A", Color: global.White, }, "google": { Icon: "\uf1a0", Color: global.White, }, "onedrive": { Icon: "\ue762", Color: global.Blue, }, "onedrivetemp": { Icon: "\ue762", Color: global.Blue, }, "favorites": { Icon: "\ue623", Color: global.Red, }, "saved games": { Icon: "\uf11b", Color: global.Red, }, ".wakatime": { Icon: "\ue641", Color: global.White, }, ".azure": { Icon: "\uebd8", Color: global.White, }, "contacts": { Icon: "\uf0c0", Color: global.White, }, "users": { Icon: "\uf0c0", Color: global.White, }, "lib": { Icon: "\uF121", Color: global.White, }, "library": { Icon: "\uF121", Color: global.White, }, "bin": { Icon: "\uE5FC", Color: global.Green, }, "share": { Icon: "\uf064", Color: global.White, }, "license": { Icon: "", Color: key, }, "licence": { Icon: "", Color: key, }, "shell": { Icon: "\uF489", Color: bash, }, "config": { Icon: "\uE615", Color: conf, }, ".ds_store": { Color: global.BrightBlack, Icon: "\uf179", }, "pkgbuild": { Color: pkg, Icon: "\uf303", }, ".srcinfo": { Color: pkg, Icon: "\uf303", }, "applications": { Icon: "\ueb44", Color: global.Green, }, "android": { Icon: "\uE70E", Color: global.White, }, ".idea": { Icon: "\uE7B5", Color: global.White, }, ".github": { Icon: "\uF408", Color: global.White, }, ".gitattributes": { Icon: "\uE65D", Color: global.BrightBlack, }, ".gitmodules": { Icon: "\uE65D", Color: global.BrightBlack, }, ".gitconfig": { Icon: "\uE65D", Color: global.BrightBlack, }, ".vscode": { Icon: "\uE70C", Color: global.White, }, "include": { Icon: "\ue5fc", Color: global.White, }, ".dotnet": { Icon: "\ue72e", Color: global.White, }, "src": { Icon: "\ue796", Color: global.White, }, "node_modules": { Icon: "\ue5fa", Color: global.White, }, "font": { Icon: "\uf031", Color: global.White, }, "fonts": { Icon: "\uf031", Color: global.White, }, ".git": { Color: global.White, Icon: "\uF1D3", }, ".gitignore": { Color: global.BrightBlack, Icon: "\ue65d", }, ".gitignore_global": { Color: global.BrightBlack, Icon: "\ue65d", }, ".gitlab-ci.yml": { Color: global.White, Icon: "\uF296", }, "cmakelists.txt": { Color: lang, Icon: "\uE20F", }, "makefile": { Color: lang, Icon: "\uE20F", }, "justfile": { Color: lang, Icon: "\uE20F", }, "history": { Icon: "\uF1DA", Color: global.BrightBlack, }, ".history": { Icon: "\uF1DA", Color: global.BrightBlack, }, "recovery": { Icon: "\uF1DA", Color: global.BrightBlack, }, "apple": { Color: global.BrightBlack, Icon: "\uF179", }, "dockerfile": { Color: global.BrightYellow, Icon: "\ue7b0", }, "dockerignore": { Color: global.BrightYellow, Icon: "\ue7b0", }, "readme": { Color: global.Yellow, Icon: "\uF48A", Underline: true, Bold: true, }, "readme.md": { Color: global.Yellow, Icon: "\uF48A", Underline: true, Bold: true, }, "flake.nix": { Color: global.Yellow, Icon: "\uF313", Underline: true, Bold: true, }, "jenkinsfile": { Color: lang, Icon: "\uE66E", }, "brewfile": { Color: lang, Icon: "\uF016", }, "sdk": { Icon: "\uF121", Color: global.White, }, "pictures": { Icon: "\uF1C5", Color: global.White, }, "videos": { Icon: "", Color: global.White, }, "movies": { Icon: "", Color: global.White, }, "music": { Icon: "\uF025", Color: global.White, }, "audio": { Icon: "\uF025", Color: global.White, }, "cargo.lock": { Color: lang, Icon: "\uE7A8", Faint: true, Underline: true, }, "cargo.toml": { Color: lang, Icon: "\uE7A8", Underline: true, }, "known_hosts": { Color: global.White, Icon: "\uEB39", }, "repo": { Color: global.White, Icon: "\uea62", }, ".ssh": { Icon: "\ueba9", Color: global.White, }, "boot": { Icon: "\uf287", Color: global.White, }, "cache": { Icon: "\uf49b", Color: global.White, }, "passwd": { Color: global.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: global.BrightBlack, Icon: "\uF179", }, "maintainers": { Color: global.White, Icon: "\uF0C0", }, "__pycache__": { Color: lang, Icon: "\uE606", Faint: true, }, "requirements.txt": { Color: global.White, Icon: "\uE606", Faint: true, }, "robots.txt": { Color: global.White, Icon: "\U000F06A9", }, "docker-compose.yml": { Color: global.BrightYellow, Icon: "\ue7b0", }, "docker-compose.yaml": { Color: global.BrightYellow, Icon: "\ue7b0", }, "contributing": { Color: global.White, Icon: "\uF0C0", }, "contributing.md": { Color: global.White, Icon: "\uF0C0", }, "cron.minutely": { Color: global.White, Icon: "\uE5FC", }, "cron.d": { Color: global.White, Icon: "\uE5FC", }, "cron.daily": { Color: global.White, Icon: "\uE5FC", }, "cron.hourly": { Color: global.White, Icon: "\uE5FC", }, "cron.mouthly": { Color: global.White, Icon: "\uE5FC", }, "cron.weekly": { Color: global.White, Icon: "\uE5FC", }, "crontab": { Color: global.White, Icon: "\uE5FC", }, }
View Source
var Owner = map[string]Style{ "owner": { Color: global.Yellow, Bold: true, }, "root": { Color: global.Red, Bold: true, }, }
View Source
var Permission = map[string]Style{ "block": { Color: global.Cyan, Bold: true, }, "directory": { Color: global.Blue, Bold: true, }, "link": { Color: global.Purple, Bold: true, }, "char": { Color: global.Yellow, Bold: true, }, "pipe": { Color: global.Yellow, Bold: true, }, "socket": { Color: global.Yellow, Bold: true, }, "setuid": { Color: global.Purple, Bold: true, }, "setgid": { Color: global.Purple, Bold: true, }, "read": { Color: global.Yellow, Bold: true, }, "write": { Color: global.Red, Bold: true, }, "exe": { Color: global.Green, Bold: true, }, "-": { Color: global.BrightBlack, }, "octal": { Color: color256(208), Bold: true, }, }
View Source
var Size = map[string]Style{ "-": { Color: global.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: global.Yellow, Icon: "► ", }, "pipe": { Color: global.Cyan, Icon: "\uF124", }, "socket": { Color: global.Cyan, Icon: "\uF1E6", }, "device": { Color: global.Yellow, Icon: "", }, "char": { Color: global.Yellow, Icon: "", }, "exe": { Color: global.Green, Icon: "\uF17A", }, "link": { Color: global.Purple, }, "file": { Color: global.White, Icon: "\uF016", }, "hidden-file": { Color: global.White, Icon: "", }, "mounts": { Color: global.BrightBlack, }, }
View Source
var Symlink = map[string]Style{ "symlink_path": { Color: global.Green, }, "symlink_broken_path": { Color: global.Red, Underline: true, }, "symlink": { Color: global.Purple, Icon: "\ueb15", }, "symlink_arrow": { Color: global.BrightWhite, Icon: " => ", }, "link-num": { Color: global.Red, }, }
Functions ¶
func BasicToRGBInt ¶
func Color256ToBasic ¶
Color256ToBasic convert 256 color to basic color
func Color256ToRGB ¶
Color256ToRGB convert 256 color to RGB color
func ConvertThemeColor ¶
func ConvertThemeColor()
func IsValidHexColor ¶ added in v0.28.0
func RGBMultiply ¶
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 RGBToBasicInt ¶
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) CheckLowerCase ¶
func (a *All) CheckLowerCase()
func (*All) UnmarshalJSON ¶
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 ¶
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 (*Style) ToReadable ¶
func (*Style) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.