chat/message/theme: Tweak default colorscheme
Fewer grey names, lighter grey for system messages.
This commit is contained in:
parent
c69cefc873
commit
972bb86621
|
@ -156,19 +156,17 @@ var Themes []Theme
|
|||
var DefaultTheme *Theme
|
||||
|
||||
func readableColors256() *Palette {
|
||||
size := 247
|
||||
size := 225
|
||||
p := Palette{
|
||||
colors: make([]Style, size),
|
||||
colors: make([]Style, 0, size),
|
||||
size: size,
|
||||
}
|
||||
j := 0
|
||||
for i := 0; i < 256; i++ {
|
||||
if (16 <= i && i <= 18) || (232 <= i && i <= 237) {
|
||||
// Remove the ones near black, this is kinda sadpanda.
|
||||
if i == 0 || i == 7 || i == 8 || i == 15 || i == 16 || i == 17 || i > 230 {
|
||||
// Skip 31 Shades of Grey, and one hyperintelligent shade of blue.
|
||||
continue
|
||||
}
|
||||
p.colors[j] = Color256(i)
|
||||
j++
|
||||
p.colors = append(p.colors, Color256(i))
|
||||
}
|
||||
return &p
|
||||
}
|
||||
|
@ -207,8 +205,8 @@ func init() {
|
|||
{
|
||||
id: "colors",
|
||||
names: palette,
|
||||
sys: palette.Get(8), // Grey
|
||||
pm: palette.Get(7), // White
|
||||
sys: Color256(245), // Grey
|
||||
pm: Color256(7), // White
|
||||
highlight: style(Bold + "\033[48;5;11m\033[38;5;16m"), // Yellow highlight
|
||||
},
|
||||
{
|
||||
|
@ -237,7 +235,7 @@ func init() {
|
|||
}
|
||||
|
||||
func printPalette(p *Palette) {
|
||||
for _, color := range p.colors {
|
||||
fmt.Print(color.Format(color.String() + " "))
|
||||
for i, color := range p.colors {
|
||||
fmt.Printf("%d\t%s\n", i, color.Format(color.String()+" "))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package message
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
import "testing"
|
||||
|
||||
func TestThemePalette(t *testing.T) {
|
||||
var expected, actual string
|
||||
|
@ -15,21 +12,21 @@ func TestThemePalette(t *testing.T) {
|
|||
}
|
||||
|
||||
actual = color.String()
|
||||
expected = "38;05;5"
|
||||
expected = "38;05;6"
|
||||
if actual != expected {
|
||||
t.Errorf("Got: `%s`; Expected: `%s`", actual, expected)
|
||||
t.Errorf("Got: %q; Expected: %q", actual, expected)
|
||||
}
|
||||
|
||||
actual = color.Format("foo")
|
||||
expected = "\033[38;05;5mfoo\033[0m"
|
||||
expected = "\033[38;05;6mfoo\033[0m"
|
||||
if actual != expected {
|
||||
t.Errorf("Got: `%s`; Expected: `%s`", actual, expected)
|
||||
t.Errorf("Got: %q; Expected: %q", actual, expected)
|
||||
}
|
||||
|
||||
actual = palette.Get(palette.Len() + 1).String()
|
||||
expected = fmt.Sprintf("38;05;%d", 2)
|
||||
expected = "38;05;3"
|
||||
if actual != expected {
|
||||
t.Errorf("Got: `%s`; Expected: `%s`", actual, expected)
|
||||
t.Errorf("Got: %q; Expected: %q", actual, expected)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,28 +41,28 @@ func TestTheme(t *testing.T) {
|
|||
}
|
||||
|
||||
actual = color.Format("foo")
|
||||
expected = "\033[38;05;8mfoo\033[0m"
|
||||
expected = "\033[38;05;245mfoo\033[0m"
|
||||
if actual != expected {
|
||||
t.Errorf("Got: `%s`; Expected: `%s`", actual, expected)
|
||||
t.Errorf("Got: %q; Expected: %q", actual, expected)
|
||||
}
|
||||
|
||||
actual = colorTheme.ColorSys("foo")
|
||||
if actual != expected {
|
||||
t.Errorf("Got: `%s`; Expected: `%s`", actual, expected)
|
||||
t.Errorf("Got: %q; Expected: %q", actual, expected)
|
||||
}
|
||||
|
||||
u := NewUser(SimpleId("foo"))
|
||||
u.colorIdx = 4
|
||||
actual = colorTheme.ColorName(u)
|
||||
expected = "\033[38;05;4mfoo\033[0m"
|
||||
expected = "\033[38;05;5mfoo\033[0m"
|
||||
if actual != expected {
|
||||
t.Errorf("Got: `%s`; Expected: `%s`", actual, expected)
|
||||
t.Errorf("Got: %q; Expected: %q", actual, expected)
|
||||
}
|
||||
|
||||
msg := NewPublicMsg("hello", u)
|
||||
actual = msg.Render(&colorTheme)
|
||||
expected = "\033[38;05;4mfoo\033[0m: hello"
|
||||
expected = "\033[38;05;5mfoo\033[0m: hello"
|
||||
if actual != expected {
|
||||
t.Errorf("Got: `%s`; Expected: `%s`", actual, expected)
|
||||
t.Errorf("Got: %q; Expected: %q", actual, expected)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,6 +144,7 @@ func TestIgnore(t *testing.T) {
|
|||
|
||||
// ensure ignorer has received the message
|
||||
if !ignorer.user.HasMessages() {
|
||||
// FIXME: This is flaky :/
|
||||
t.Fatal("should have messages")
|
||||
}
|
||||
ignorer.user.HandleMsg(ignorer.user.ConsumeOne())
|
||||
|
|
|
@ -37,7 +37,7 @@ func TestHostGetPrompt(t *testing.T) {
|
|||
|
||||
u.Config.Theme = &message.Themes[0]
|
||||
actual = GetPrompt(u)
|
||||
expected = "[\033[38;05;2mfoo\033[0m] "
|
||||
expected = "[\033[38;05;3mfoo\033[0m] "
|
||||
if actual != expected {
|
||||
t.Errorf("Got: %q; Expected: %q", actual, expected)
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ func TestHostNameCollision(t *testing.T) {
|
|||
scanner.Scan()
|
||||
actual := scanner.Text()
|
||||
if !strings.HasPrefix(actual, "[foo] ") {
|
||||
// FIXME: Technically this is flakey. :/
|
||||
// FIXME: This is flaky. :/
|
||||
t.Errorf("First client failed to get 'foo' name: %q", actual)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue