Get recent theme changes to work when color = false

This commit is contained in:
makeworld 2021-12-03 20:52:30 -05:00
parent f270fa2b23
commit b52263c487
2 changed files with 9 additions and 8 deletions

View File

@ -381,6 +381,7 @@ func Init() error {
themeMu.Lock() themeMu.Lock()
theme["bg"] = tcell.ColorBlack theme["bg"] = tcell.ColorBlack
cview.Styles.PrimitiveBackgroundColor = tcell.ColorBlack cview.Styles.PrimitiveBackgroundColor = tcell.ColorBlack
themeMu.Unlock()
} }
hasDarkTerminalBackground = termenv.HasDarkBackground() hasDarkTerminalBackground = termenv.HasDarkBackground()

View File

@ -162,7 +162,7 @@ func convertRegularGemini(s string, numLinks, width int, proxied bool) (string,
// Underline non-gemini links if enabled // Underline non-gemini links if enabled
var linkTag string var linkTag string
if viper.GetBool("a-general.underline") { if viper.GetBool("a-general.underline") {
linkTag = "::u" linkTag = `[` + config.GetColorString("foreign_link") + linkTag + `::u]`
} }
// Wrap and add link text // Wrap and add link text
@ -215,27 +215,27 @@ func convertRegularGemini(s string, numLinks, width int, proxied bool) (string,
wrappedLink = wrapLine(linkText, width, wrappedLink = wrapLine(linkText, width,
strings.Repeat(" ", indent)+ strings.Repeat(" ", indent)+
`["`+strconv.Itoa(num-1)+`"][`+config.GetColorString("foreign_link")+linkTag+`]`, `["`+strconv.Itoa(num-1)+`"]`+linkTag,
`[-::-][""]`, `[-::-][""]`,
false, // Don't indent the first line, it's the one with link number false, // Don't indent the first line, it's the one with link number
) )
wrappedLink[0] = fmt.Sprintf(`[%s::b][`, config.GetColorString("link_number")) + wrappedLink[0] = fmt.Sprintf(`[%s::b][`, config.GetColorString("link_number")) +
strconv.Itoa(num) + "[]" + "[-::-]" + spacing + strconv.Itoa(num) + "[][-::-]" + spacing +
`["` + strconv.Itoa(num-1) + `"][` + config.GetColorString("foreign_link") + linkTag + `]` + `["` + strconv.Itoa(num-1) + `"]` + linkTag +
wrappedLink[0] + `[-::-][""]` wrappedLink[0] + `[-::-][""]`
} else { } else {
// No color // No color
wrappedLink = wrapLine(linkText, width, wrappedLink = wrapLine(linkText, width,
strings.Repeat(" ", len(strconv.Itoa(num))+4)+ // +4 for spaces and brackets strings.Repeat(" ", indent)+
`["`+strconv.Itoa(num-1)+`"][`+linkTag+`]`, `["`+strconv.Itoa(num-1)+`"]`+linkTag,
`[::-][""]`, `[::-][""]`,
false, // Don't indent the first line, it's the one with link number false, // Don't indent the first line, it's the one with link number
) )
wrappedLink[0] = `[::b][` + strconv.Itoa(num) + "[][::-] " + wrappedLink[0] = `[::b][` + strconv.Itoa(num) + "[][::-]" + spacing +
`["` + strconv.Itoa(num-1) + `"][` + linkTag + `]` + `["` + strconv.Itoa(num-1) + `"]` + linkTag +
wrappedLink[0] + `[::-][""]` wrappedLink[0] + `[::-][""]`
} }
} }