1
0
mirror of https://github.com/makew0rld/amfora.git synced 2025-02-02 15:07:34 -05:00

Use preformatted_text color for rendering plain text files (#351)

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.
This commit is contained in:
Frank Seifferth 2024-12-18 22:55:12 +01:00 committed by GitHub
parent b4aa0bcb72
commit 1115614463
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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.