aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2019-06-16 17:14:17 +0300
committerTulir Asokan <tulir@maunium.net>2019-06-16 17:14:17 +0300
commit967db3076249902da108b4d9344fb8ed9c221ccc (patch)
tree38de2f0e23f466758bab4db096a7fb36d2b95d05 /ui
parenteb2726e8df30bc8d62ec36eb99955276cd24b0e4 (diff)
Fix message text color. Fixes #82
Diffstat (limited to 'ui')
-rw-r--r--ui/messages/htmlmessage.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/ui/messages/htmlmessage.go b/ui/messages/htmlmessage.go
index 5b95a82..f3295b2 100644
--- a/ui/messages/htmlmessage.go
+++ b/ui/messages/htmlmessage.go
@@ -29,6 +29,7 @@ import (
type HTMLMessage struct {
Root html.Entity
FocusedBg tcell.Color
+ TextColor tcell.Color
focused bool
}
@@ -49,7 +50,16 @@ func (hw *HTMLMessage) Clone() MessageRenderer {
func (hw *HTMLMessage) Draw(screen mauview.Screen) {
if hw.focused {
- screen.SetStyle(tcell.StyleDefault.Background(hw.FocusedBg))
+ screen.SetStyle(tcell.StyleDefault.Background(hw.FocusedBg).Foreground(hw.TextColor))
+ }
+ if hw.TextColor != tcell.ColorDefault {
+ hw.Root.AdjustStyle(func(style tcell.Style) tcell.Style {
+ fg, _, _ := style.Decompose()
+ if fg == tcell.ColorDefault {
+ return style.Foreground(hw.TextColor)
+ }
+ return style
+ })
}
screen.Clear()
hw.Root.Draw(screen)
@@ -81,6 +91,7 @@ func (hw *HTMLMessage) CalculateBuffer(preferences config.UserPreferences, width
}
// TODO account for bare messages in initial startX
startX := 0
+ hw.TextColor = msg.TextColor()
hw.Root.CalculateBuffer(width, startX, preferences.BareMessageView)
}