Make tty_indexed.go respond to None like tty_truecolour.go#869
Merged
alecthomas merged 3 commits intoalecthomas:masterfrom Oct 15, 2023
Merged
Make tty_indexed.go respond to None like tty_truecolour.go#869alecthomas merged 3 commits intoalecthomas:masterfrom
tty_indexed.go respond to None like tty_truecolour.go#869alecthomas merged 3 commits intoalecthomas:masterfrom
Conversation
tty_indexed.go respond to None like tty_truecolour.go
alecthomas
requested changes
Oct 12, 2023
formatters/tty_indexed_test.go
Outdated
| } | ||
|
|
||
| func TestNoneColour(t *testing.T) { | ||
| style := styles.Registry["gruvbox"] |
Owner
There was a problem hiding this comment.
Let's not rely on an existing style for the test. Instead, create a style specifically for this test using the StyleBuilder.
| clr, ok = theme[token.Type.SubCategory()] | ||
| if !ok { | ||
| clr = theme[token.Type.Category()] | ||
| clr, ok = theme[token.Type.Category()] |
Owner
There was a problem hiding this comment.
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
alecthomas
reviewed
Oct 12, 2023
| tokenType := chroma.None | ||
|
|
||
| style, err := chroma.NewStyle("test", chroma.StyleEntries{ | ||
| chroma.Background: "#D0ab1e", |
Contributor
Author
There was a problem hiding this comment.
alecthomas
approved these changes
Oct 12, 2023
walles
added a commit
to walles/moor
that referenced
this pull request
Oct 14, 2023
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this change, asking
tty_indexed.gofor theNonetype ("No highlighting") returned an empty string.With this change in place, asking
tty_indexed.gofor theNonetype returns (the closest it can get to) the same colour astty_truecolor.go.Relates to walles/moor#161 (comment).