Monorepo for Tangled tangled.org

appview: blob: fix weird bg color issue

Changed files
+43 -15
appview
pages
templates
repo
+40
appview/pages/chroma.go
··· 1 + package pages 2 + 3 + import "github.com/alecthomas/chroma/v2" 4 + 5 + var tangledTheme map[chroma.TokenType]string = map[chroma.TokenType]string{ 6 + // Keywords 7 + chroma.Keyword: "text-blue-400", 8 + chroma.KeywordConstant: "text-indigo-400", 9 + chroma.KeywordDeclaration: "text-purple-400", 10 + chroma.KeywordNamespace: "text-teal-400", 11 + chroma.KeywordReserved: "text-pink-400", 12 + 13 + // Names 14 + chroma.Name: "text-gray-700", 15 + chroma.NameFunction: "text-green-500", 16 + chroma.NameClass: "text-orange-400", 17 + chroma.NameNamespace: "text-cyan-500", 18 + chroma.NameVariable: "text-red-400", 19 + chroma.NameBuiltin: "text-yellow-500", 20 + 21 + // Literals 22 + chroma.LiteralString: "text-emerald-500 ", 23 + chroma.LiteralStringChar: "text-lime-500", 24 + chroma.LiteralNumber: "text-rose-400", 25 + chroma.LiteralNumberFloat: "text-amber-500", 26 + 27 + // Operators 28 + chroma.Operator: "text-blue-500", 29 + chroma.OperatorWord: "text-indigo-500", 30 + 31 + // Comments 32 + chroma.Comment: "text-gray-500 italic", 33 + chroma.CommentSingle: "text-gray-400 italic", 34 + 35 + // Generic 36 + chroma.GenericError: "text-red-600", 37 + chroma.GenericHeading: "text-purple-500 font-bold", 38 + chroma.GenericDeleted: "text-red-400 line-through", 39 + chroma.GenericInserted: "text-green-400 underline", 40 + }
+1 -2
appview/pages/pages.go
··· 431 431 style := styles.Get("bw") 432 432 b := style.Builder() 433 433 b.Add(chroma.LiteralString, "noitalic") 434 - b.Add(chroma.Background, "bg:") 435 434 style, _ = b.Build() 436 435 437 436 if params.Lines < 5000 { 438 437 c := params.Contents 439 438 formatter := chromahtml.New( 440 - chromahtml.InlineCode(true), 439 + chromahtml.InlineCode(false), 441 440 chromahtml.WithLineNumbers(true), 442 441 chromahtml.WithLinkableLineNumbers(true, "L"), 443 442 chromahtml.Standalone(false),
+1 -12
appview/pages/templates/repo/blob.html
··· 52 52 </p> 53 53 {{ else }} 54 54 <div class="overflow-auto relative"> 55 - {{ range $idx, $line := $lines }} 56 - {{ $linenr := add $idx 1 }} 57 - <div class="flex"> 58 - <a href="#L{{ $linenr }}" id="L{{ $linenr }}" class="no-underline peer"> 59 - <span class="{{ $code_number_style }}" 60 - style="min-width: {{ $tot_chars }}ch;"> 61 - {{ $linenr }} 62 - </span> 63 - </a> 64 - <div class="whitespace-pre peer-target:bg-yellow-200 dark:peer-target:bg-yellow-900">{{ $line | escapeHtml }}</div> 65 - </div> 66 - {{ end }} 55 + <div class="whitespace-pre peer-target:bg-yellow-200 dark:peer-target:bg-yellow-900">{{ $.Contents | escapeHtml }}</div> 67 56 </div> 68 57 {{ end }} 69 58 {{ end }}
+1 -1
tailwind.config.js
··· 2 2 const colors = require("tailwindcss/colors"); 3 3 4 4 module.exports = { 5 - content: ["./appview/pages/templates/**/*.html"], 5 + content: ["./appview/pages/templates/**/*.html", "./appview/pages/chroma.go"], 6 6 darkMode: "media", 7 7 theme: { 8 8 container: {