Skip to content

Commit

Permalink
support a few more styling options
Browse files Browse the repository at this point in the history
  • Loading branch information
cdmistman authored and F1bonacc1 committed May 6, 2024
1 parent 5a7b83e commit f8c25b9
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/command/command_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (c *CmdWrapper) StderrPipe() (io.ReadCloser, error) {
return c.cmd.StderrPipe()
}

func (c *CmdWrapper) AttachIo() () {
func (c *CmdWrapper) AttachIo() {
c.cmd.Stdin = os.Stdin
c.cmd.Stdout = os.Stdout
c.cmd.Stderr = os.Stderr
Expand Down
16 changes: 14 additions & 2 deletions src/config/styles.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ type (
Dialog struct {
FgColor Color `yaml:"fgColor"`
BgColor Color `yaml:"bgColor"`
ContrastBgColor Color `yaml:"contrastBgColor"`
AttentionBgColor Color `yaml:"attentionBgColor"`
ButtonFgColor Color `yaml:"buttonFgColor"`
ButtonBgColor Color `yaml:"buttonBgColor"`
ButtonFocusFgColor Color `yaml:"buttonFocusFgColor"`
Expand Down Expand Up @@ -182,6 +184,16 @@ func (s *Styles) BgColor() tcell.Color {
return s.Body().BgColor.Color()
}

// ContrastBgColor returns the Contrast background color.
func (s *Styles) ContrastBgColor() tcell.Color {
return s.Dialog().ContrastBgColor.Color()
}

// AttentionBgColor returns the Contrast background color.
func (s *Styles) AttentionBgColor() tcell.Color {
return s.Dialog().AttentionBgColor.Color()
}

// BorderColor returns the border color.
func (s *Styles) BorderColor() tcell.Color {
return s.Body().BorderColor.Color()
Expand Down Expand Up @@ -215,8 +227,8 @@ func (s *Styles) Dialog() Dialog {
// Update apply terminal colors based on styles.
func (s *Styles) Update() {
tview.Styles.PrimitiveBackgroundColor = s.BgColor()
//tview.Styles.ContrastBackgroundColor = s.BgColor()
tview.Styles.MoreContrastBackgroundColor = s.BgColor()
tview.Styles.ContrastBackgroundColor = s.ContrastBgColor()
tview.Styles.MoreContrastBackgroundColor = s.AttentionBgColor()
tview.Styles.PrimaryTextColor = s.FgColor()
tview.Styles.BorderColor = s.BorderColor()
tview.Styles.TitleColor = s.FgColor()
Expand Down
2 changes: 2 additions & 0 deletions src/config/themes/cobalt-theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ style:
dialog:
fgColor: cadetblue
bgColor: black
contrastBgColor: blue
attentionBgColor: red
buttonFgColor: black
buttonBgColor: lightskyblue
buttonFocusFgColor: black
Expand Down
2 changes: 2 additions & 0 deletions src/config/themes/default-theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ style:
dialog:
fgColor: cadetblue
bgColor: black
contrastBgColor: blue
attentionBgColor: red
buttonFgColor: black
buttonBgColor: lightskyblue
buttonFocusFgColor: black
Expand Down
2 changes: 2 additions & 0 deletions src/config/themes/light-theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ style:
dialog:
fgColor: cadetblue
bgColor: "#3B3B3B"
contrastBgColor: blue
attentionBgColor: red
buttonFgColor: "#3B3B3B"
buttonBgColor: lightskyblue
buttonFocusFgColor: "#3B3B3B"
Expand Down
2 changes: 2 additions & 0 deletions src/config/themes/monokai-theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ style:
dialog:
fgColor: cadetblue
bgColor: black
contrastBgColor: blue
attentionBgColor: red
buttonFgColor: black
buttonBgColor: dodgerblue
buttonFocusFgColor: black
Expand Down
2 changes: 2 additions & 0 deletions src/config/themes/onedark-theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ style:
dialog:
fgColor: cadetblue
bgColor: black
contrastBgColor: blue
attentionBgColor: red
buttonFgColor: black
buttonBgColor: '#61AFEF'
buttonFocusFgColor: black
Expand Down
4 changes: 2 additions & 2 deletions src/tui/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ func (pv *pcView) attentionMessage(message string) {
SetSelectable(false).
SetAlign(tview.AlignCenter).
SetExpansion(0).
SetTextColor(tcell.ColorWhite).
SetBackgroundColor(tcell.ColorRed))
SetTextColor(tview.Styles.ContrastSecondaryTextColor).
SetBackgroundColor(tview.Styles.MoreContrastBackgroundColor))
}

func (pv *pcView) hideAttentionMessage() {
Expand Down

0 comments on commit f8c25b9

Please sign in to comment.