Skip to content

Commit

Permalink
Unalias term package
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Feb 8, 2022
1 parent e98632a commit d0cfccd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import (
wildcard "github.com/IGLOU-EU/go-wildcard"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/muesli/termenv"
terminal "golang.org/x/term"
"golang.org/x/term"
)

var (
Version = ""
CommitSHA = ""

term = termenv.EnvColorProfile()
env = termenv.EnvColorProfile()
theme Theme

groups = []string{localDevice, networkDevice, fuseDevice, specialDevice, loopsDevice, bindsMount}
Expand Down Expand Up @@ -180,7 +180,7 @@ func main() {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
if term == termenv.ANSI {
if env == termenv.ANSI {
// enforce ANSI theme for limited color support
theme, err = loadTheme("ansi")
if err != nil {
Expand Down Expand Up @@ -291,9 +291,9 @@ func main() {
}

// detect terminal width
isTerminal := terminal.IsTerminal(int(os.Stdout.Fd()))
isTerminal := term.IsTerminal(int(os.Stdout.Fd()))
if isTerminal && *width == 0 {
w, _, err := terminal.GetSize(int(os.Stdout.Fd()))
w, _, err := term.GetSize(int(os.Stdout.Fd()))
if err == nil {
*width = uint(w)
}
Expand Down
42 changes: 21 additions & 21 deletions themes.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,33 @@ func loadTheme(theme string) (Theme, error) {
themes := make(map[string]Theme)

themes["dark"] = Theme{
colorRed: term.Color("#E88388"),
colorYellow: term.Color("#DBAB79"),
colorGreen: term.Color("#A8CC8C"),
colorBlue: term.Color("#71BEF2"),
colorGray: term.Color("#B9BFCA"),
colorMagenta: term.Color("#D290E4"),
colorCyan: term.Color("#66C2CD"),
colorRed: env.Color("#E88388"),
colorYellow: env.Color("#DBAB79"),
colorGreen: env.Color("#A8CC8C"),
colorBlue: env.Color("#71BEF2"),
colorGray: env.Color("#B9BFCA"),
colorMagenta: env.Color("#D290E4"),
colorCyan: env.Color("#66C2CD"),
}

themes["light"] = Theme{
colorRed: term.Color("#D70000"),
colorYellow: term.Color("#FFAF00"),
colorGreen: term.Color("#005F00"),
colorBlue: term.Color("#000087"),
colorGray: term.Color("#303030"),
colorMagenta: term.Color("#AF00FF"),
colorCyan: term.Color("#0087FF"),
colorRed: env.Color("#D70000"),
colorYellow: env.Color("#FFAF00"),
colorGreen: env.Color("#005F00"),
colorBlue: env.Color("#000087"),
colorGray: env.Color("#303030"),
colorMagenta: env.Color("#AF00FF"),
colorCyan: env.Color("#0087FF"),
}

themes["ansi"] = Theme{
colorRed: term.Color("9"),
colorYellow: term.Color("11"),
colorGreen: term.Color("10"),
colorBlue: term.Color("12"),
colorGray: term.Color("7"),
colorMagenta: term.Color("13"),
colorCyan: term.Color("8"),
colorRed: env.Color("9"),
colorYellow: env.Color("11"),
colorGreen: env.Color("10"),
colorBlue: env.Color("12"),
colorGray: env.Color("7"),
colorMagenta: env.Color("13"),
colorCyan: env.Color("8"),
}

if _, ok := themes[theme]; !ok {
Expand Down

0 comments on commit d0cfccd

Please sign in to comment.