Finalize support themes

Fixes #9
This commit is contained in:
erroneousboat 2016-10-11 19:28:37 +02:00 committed by JP Bruins Slot
parent 7a9bfce4ed
commit 1b64f6a966
6 changed files with 46 additions and 9 deletions

View File

@ -8,9 +8,12 @@ of the binaries for your system from the `bin` folder. Rename the file for
convenience into `slack-term` and create a `slack-term.json` file with
the following contents in your home folder.
```
```javascript
{
"slack_token": "yourslacktokenhere"
// add the following to use light theme, default is dark
"theme": "light"
}
```

View File

@ -50,7 +50,7 @@ func (c *Channels) Buffer() termui.Buffer {
var cells []termui.Cell
if y == c.CursorPosition {
cells = termui.DefaultTxBuilder.Build(
item, termui.ColorBlack, termui.ColorWhite)
item, c.List.ItemBgColor, c.List.ItemFgColor)
} else {
cells = termui.DefaultTxBuilder.Build(
item, c.List.ItemFgColor, c.List.ItemBgColor)
@ -70,11 +70,20 @@ func (c *Channels) Buffer() termui.Buffer {
if y == c.CursorPosition {
buf.Set(x+1, y,
termui.Cell{
Ch: ' ', Fg: termui.ColorBlack, Bg: termui.ColorWhite,
Ch: ' ',
Fg: c.List.ItemBgColor,
Bg: c.List.ItemFgColor,
},
)
} else {
buf.Set(x+1, y, termui.Cell{Ch: ' '})
buf.Set(
x+1, y,
termui.Cell{
Ch: ' ',
Fg: c.List.ItemFgColor,
Bg: c.List.ItemBgColor,
},
)
}
x++
}

View File

@ -94,7 +94,14 @@ func (c *Chat) Buffer() termui.Buffer {
// When we're not at the end of the pane, fill it up
// with empty characters
for x < c.List.InnerBounds().Max.X {
buf.Set(x, currentY, termui.Cell{Ch: ' '})
buf.Set(
x, currentY,
termui.Cell{
Ch: ' ',
Fg: c.List.ItemFgColor,
Bg: c.List.ItemBgColor,
},
)
x++
}
currentY--
@ -106,7 +113,14 @@ func (c *Chat) Buffer() termui.Buffer {
for currentY >= paneMinY {
x := c.List.InnerBounds().Min.X
for x < c.List.InnerBounds().Max.X {
buf.Set(x, currentY, termui.Cell{Ch: ' '})
buf.Set(
x, currentY,
termui.Cell{
Ch: ' ',
Fg: c.List.ItemFgColor,
Bg: c.List.ItemBgColor,
},
)
x++
}
currentY--

View File

@ -37,7 +37,11 @@ func (i *Input) Buffer() termui.Buffer {
buf.Set(
i.Par.InnerX()+i.CursorPosition,
i.Par.Block.InnerY(),
termui.Cell{Ch: char.Ch, Fg: termui.ColorBlack, Bg: termui.ColorWhite},
termui.Cell{
Ch: char.Ch,
Fg: i.Par.TextBgColor,
Bg: i.Par.TextFgColor,
},
)
return buf

View File

@ -38,7 +38,14 @@ func (m *Mode) Buffer() termui.Buffer {
x := m.Par.InnerBounds().Min.X
for x < m.Par.InnerBounds().Max.X {
if i < start {
buf.Set(x, m.Par.InnerY(), termui.Cell{Ch: ' '})
buf.Set(
x, m.Par.InnerY(),
termui.Cell{
Ch: ' ',
Fg: m.Par.TextFgColor,
Bg: m.Par.TextBgColor,
},
)
x++
i++
} else {

View File

@ -33,7 +33,7 @@ func NewConfig(filepath string) (*Config, error) {
"fg": termui.ColorBlack,
"bg": termui.ColorDefault,
"border.fg": termui.ColorBlack,
"label.fg": termui.ColorGreen,
"label.fg": termui.ColorBlue,
"par.fg": termui.ColorYellow,
"par.label.bg": termui.ColorWhite,
}