-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hide underscores on VSCode integrated terminal while they're glitchy
- Loading branch information
1 parent
fc1bfc9
commit e7ede7e
Showing
2 changed files
with
26 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,15 @@ | ||
package gui | ||
|
||
import ( | ||
"github.com/gookit/color" | ||
"github.com/jesseduffield/gocui" | ||
"github.com/jesseduffield/lazydocker/pkg/utils" | ||
) | ||
|
||
var gocuiColorMap = map[string]gocui.Attribute{ | ||
"default": gocui.ColorDefault, | ||
"black": gocui.ColorBlack, | ||
"red": gocui.ColorRed, | ||
"green": gocui.ColorGreen, | ||
"yellow": gocui.ColorYellow, | ||
"blue": gocui.ColorBlue, | ||
"magenta": gocui.ColorMagenta, | ||
"cyan": gocui.ColorCyan, | ||
"white": gocui.ColorWhite, | ||
"bold": gocui.AttrBold, | ||
"reverse": gocui.AttrReverse, | ||
"underline": gocui.AttrUnderline, | ||
} | ||
|
||
// GetAttribute gets the gocui color attribute from the string | ||
func GetGocuiAttribute(key string) gocui.Attribute { | ||
if utils.IsValidHexValue(key) { | ||
values := color.HEX(key).Values() | ||
return gocui.NewRGBColor(int32(values[0]), int32(values[1]), int32(values[2])) | ||
} | ||
|
||
value, present := gocuiColorMap[key] | ||
if present { | ||
return value | ||
} | ||
return gocui.ColorDefault | ||
} | ||
|
||
// GetGocuiStyle bitwise OR's a list of attributes obtained via the given keys | ||
func GetGocuiStyle(keys []string) gocui.Attribute { | ||
var attribute gocui.Attribute | ||
for _, key := range keys { | ||
attribute |= GetGocuiAttribute(key) | ||
attribute |= utils.GetGocuiAttribute(key) | ||
} | ||
return attribute | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters