Skip to content
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

Use preformatted_text color for rendering plain text files #351

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use preformatted_text color for rendering plain text files
Using a color from the theme should make the rendering of text
files be more in line with the colors chosen for styled content.
Furthermore, allowing some form of user override for the color
of plain text files allows users to individually fix bad color
combinations. Such as in my case, where the combination of a
solarized terminal theme and the default color chosen by amfora
causes plain text files to be rendered as white text on an almost
equally bright background.
seifferth committed Oct 23, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 680801e98df71c97f9e109d3046eda1652da18ed
2 changes: 1 addition & 1 deletion renderer/renderer.go
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ func RenderPlainText(s string) string {
// It used to add a left margin, now this is done elsewhere.
// The function is kept for convenience and in case rendering
// is needed in the future.
return cview.Escape(s)
return fmt.Sprintf("[%s]", config.GetColorString("preformatted_text")) + cview.Escape(s)
}

// wrapLine wraps a line to the provided width, and adds the provided prefix and suffix to each wrapped line.