From 229879c2ddeb06ebf0e73593ca79625e31d71318 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sat, 19 Apr 2025 17:19:53 +0100 Subject: [PATCH] appview: highlight linked lines --- appview/pages/pages.go | 2 -- cmd/syntax/chroma.go | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/appview/pages/pages.go b/appview/pages/pages.go index b17dc1d3..f3e3d9d1 100644 --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -498,8 +498,6 @@ type RepoBlobParams struct { func (p *Pages) RepoBlob(w io.Writer, params RepoBlobParams) error { var style *chroma.Style = styles.Get("catpuccin-latte") - b := style.Builder() - style, _ = b.Build() if params.ShowRendered { switch markup.GetFormat(params.Path) { diff --git a/cmd/syntax/chroma.go b/cmd/syntax/chroma.go index 619865fc..a578ebd5 100644 --- a/cmd/syntax/chroma.go +++ b/cmd/syntax/chroma.go @@ -14,6 +14,20 @@ var ( darkTheme = "catppuccin-macchiato" ) +const ( + targetHl = ` + .chroma .line:has(.ln:target) { + background-color: rgba(140, 143, 161, 0.3); + } + + @media (prefers-color-scheme: dark) { + .chroma .line:has(.ln:target) { + background-color: rgba(128, 135, 162, 0.3); + } + } + ` +) + func main() { outFile := flag.String("out", "", "css output file path") flag.Parse() @@ -38,4 +52,6 @@ func main() { file.WriteString("\n@media (prefers-color-scheme: dark) {\n") formatter.WriteCSS(file, styles.Get(darkTheme)) file.WriteString("}\n") + + file.WriteString(targetHl) } -- 2.51.2