-
-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make tty_indexed.go
respond to None
like tty_truecolour.go
#869
Conversation
tty_indexed.go
respond to None
like tty_truecolour.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, thanks.
formatters/tty_indexed_test.go
Outdated
) | ||
|
||
func TestClosestColour(t *testing.T) { | ||
actual := findClosest(ttyTables[256], chroma.MustParseColour("#e06c75")) | ||
assert.Equal(t, chroma.MustParseColour("#d75f87"), actual) | ||
} | ||
|
||
func TestNoneColour(t *testing.T) { | ||
style := styles.Registry["gruvbox"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not rely on an existing style for the test. Instead, create a style specifically for this test using the StyleBuilder
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
if !ok { | ||
clr, ok = theme[token.Type.SubCategory()] | ||
if !ok { | ||
clr = theme[token.Type.Category()] | ||
clr, ok = theme[token.Type.Category()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a reasonable change to me, thanks 👍
Use a custom style for the test. Color value cred goes here: https://www.litscape.com/word_tools/contains_only.php
tokenType := chroma.None | ||
|
||
style, err := chroma.NewStyle("test", chroma.StyleEntries{ | ||
chroma.Background: "#D0ab1e", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this change, it only worked on 16M color terminals. After there's a Chroma release with alecthomas/chroma#869 in it we should revert back to "None" here and use the new Chroma release instead.
Before this change, asking
tty_indexed.go
for theNone
type ("No highlighting") returned an empty string.With this change in place, asking
tty_indexed.go
for theNone
type returns (the closest it can get to) the same colour astty_truecolor.go
.Relates to walles/moar#161 (comment).