Fix rmd preview chunk colouring#867
Merged
renkun-ken merged 3 commits intoREditorSupport:masterfrom Nov 17, 2021
Merged
Conversation
If a chunk background colour is not defined, fall back to a vscode theme colour
renkun-ken
reviewed
Nov 17, 2021
| outCol = `rgba(${regOut[0] ?? 100}, ${regOut[1] ?? 100}, ${regOut[2] ?? 100}, ${Number(regOut[3]) + 0.05 ?? .5})`; | ||
| } else { | ||
| chunkCol = 'var(--vscode-selection-background)'; | ||
| outCol = 'var(--vscode-selection-background)'; |
Member
Member
There was a problem hiding this comment.
Looks like we should use something like rgba(128, 128, 128, 0.1) and rgba(128, 128, 128, 0.05) to get a more consistent coloring under different themes.
renkun-ken
reviewed
Nov 17, 2021
| const chunkCol = String(config().get('rmarkdown.chunkBackgroundColor')); | ||
| const colReg = /[0-9.]+/g; | ||
| const regOut = chunkCol.match(colReg); | ||
| const outCol = `rgba(${regOut[0] ?? 100}, ${regOut[1] ?? 100}, ${regOut[2] ?? 100}, ${Number(regOut[3]) + 0.05 ?? .5})`; |
Member
There was a problem hiding this comment.
I suspect that the alpha channel should be something like ${Number(regOut[3]) - 0.05 ?? .05} to make the output more like the background. In light themes, the default rendering looks like the code chunk is more highlighted than the output from the background.
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.


What problem did you solve?
Resolves #866. If a chunk background colour is not defined, fall back to a vscode theme colour
How can I check this pull request?