diff --git a/appview/pages/templates/repo/blob.html b/appview/pages/templates/repo/blob.html index 7c452c29..d4c7643a 100644 --- a/appview/pages/templates/repo/blob.html +++ b/appview/pages/templates/repo/blob.html @@ -59,7 +59,6 @@

{{ else }}
- {{ if .ShowRendered }}
{{ .RenderedContents }}
{{ else }} diff --git a/cmd/syntax/chroma.go b/cmd/syntax/chroma.go deleted file mode 100644 index a578ebd5..00000000 --- a/cmd/syntax/chroma.go +++ /dev/null @@ -1,57 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "os" - - "github.com/alecthomas/chroma/v2/formatters/html" - "github.com/alecthomas/chroma/v2/styles" -) - -var ( - lightTheme = "catppuccin-latte" - 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() - - if *outFile == "" { - fmt.Println("error: output file path is required") - flag.Usage() - os.Exit(1) - } - - file, err := os.Create(*outFile) - if err != nil { - fmt.Printf("error creating file: %v\n", err) - os.Exit(1) - } - defer file.Close() - - formatter := html.New(html.WithClasses(true)) - - formatter.WriteCSS(file, styles.Get(lightTheme)) - - file.WriteString("\n@media (prefers-color-scheme: dark) {\n") - formatter.WriteCSS(file, styles.Get(darkTheme)) - file.WriteString("}\n") - - file.WriteString(targetHl) -} diff --git a/flake.nix b/flake.nix index 0e014ed2..b9a6233a 100644 --- a/flake.nix +++ b/flake.nix @@ -69,15 +69,6 @@ doCheck = false; }; - syntax-chroma = final.buildGoModule { - pname = "chroma"; - version = "0.1.0"; - src = gitignoreSource ./.; - subPackages = ["cmd/syntax/chroma.go"]; - vendorHash = goModHash; - CGO_ENABLED = 1; - }; - appview = with final; final.pkgsStatic.buildGoModule { pname = "appview"; @@ -91,7 +82,6 @@ cp -f ${inter-fonts-src}/web/InterVariable*.woff2 appview/pages/static/fonts/ cp -f ${inter-fonts-src}/web/InterDisplay*.woff2 appview/pages/static/fonts/ cp -f ${ibm-plex-mono-src}/fonts/complete/woff2/IBMPlexMono-Regular.woff2 appview/pages/static/fonts/ - ${pkgs.syntax-chroma}/bin/chroma -out appview/pages/static/syntax.css ${pkgs.tailwindcss}/bin/tailwindcss -i input.css -o appview/pages/static/tw.css popd ''; diff --git a/input.css b/input.css index 5c6114e8..3bc743c2 100644 --- a/input.css +++ b/input.css @@ -90,3 +90,169 @@ } } } + +/* Background */ .bg { color: #4c4f69; background-color: #eff1f5; } +/* PreWrapper */ .chroma { color: #4c4f69; background-color: #eff1f5; } +/* Error */ .chroma .err { color: #d20f39 } +/* LineLink */ .chroma .lnlinks { outline: none; text-decoration: none; color: inherit } +/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; } +/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; } +/* LineHighlight */ .chroma .hl { background-color: #bcc0cc } +/* LineNumbersTable */ .chroma .lnt { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #8c8fa1 } +/* LineNumbers */ .chroma .ln { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #8c8fa1 } +/* Line */ .chroma .line { display: flex; } +/* Keyword */ .chroma .k { color: #8839ef } +/* KeywordConstant */ .chroma .kc { color: #fe640b } +/* KeywordDeclaration */ .chroma .kd { color: #d20f39 } +/* KeywordNamespace */ .chroma .kn { color: #179299 } +/* KeywordPseudo */ .chroma .kp { color: #8839ef } +/* KeywordReserved */ .chroma .kr { color: #8839ef } +/* KeywordType */ .chroma .kt { color: #d20f39 } +/* NameAttribute */ .chroma .na { color: #1e66f5 } +/* NameBuiltin */ .chroma .nb { color: #04a5e5 } +/* NameBuiltinPseudo */ .chroma .bp { color: #04a5e5 } +/* NameClass */ .chroma .nc { color: #df8e1d } +/* NameConstant */ .chroma .no { color: #df8e1d } +/* NameDecorator */ .chroma .nd { color: #1e66f5; font-weight: bold } +/* NameEntity */ .chroma .ni { color: #179299 } +/* NameException */ .chroma .ne { color: #fe640b } +/* NameFunction */ .chroma .nf { color: #1e66f5 } +/* NameFunctionMagic */ .chroma .fm { color: #1e66f5 } +/* NameLabel */ .chroma .nl { color: #04a5e5 } +/* NameNamespace */ .chroma .nn { color: #fe640b } +/* NameProperty */ .chroma .py { color: #fe640b } +/* NameTag */ .chroma .nt { color: #8839ef } +/* NameVariable */ .chroma .nv { color: #dc8a78 } +/* NameVariableClass */ .chroma .vc { color: #dc8a78 } +/* NameVariableGlobal */ .chroma .vg { color: #dc8a78 } +/* NameVariableInstance */ .chroma .vi { color: #dc8a78 } +/* NameVariableMagic */ .chroma .vm { color: #dc8a78 } +/* LiteralString */ .chroma .s { color: #40a02b } +/* LiteralStringAffix */ .chroma .sa { color: #d20f39 } +/* LiteralStringBacktick */ .chroma .sb { color: #40a02b } +/* LiteralStringChar */ .chroma .sc { color: #40a02b } +/* LiteralStringDelimiter */ .chroma .dl { color: #1e66f5 } +/* LiteralStringDoc */ .chroma .sd { color: #9ca0b0 } +/* LiteralStringDouble */ .chroma .s2 { color: #40a02b } +/* LiteralStringEscape */ .chroma .se { color: #1e66f5 } +/* LiteralStringHeredoc */ .chroma .sh { color: #9ca0b0 } +/* LiteralStringInterpol */ .chroma .si { color: #40a02b } +/* LiteralStringOther */ .chroma .sx { color: #40a02b } +/* LiteralStringRegex */ .chroma .sr { color: #179299 } +/* LiteralStringSingle */ .chroma .s1 { color: #40a02b } +/* LiteralStringSymbol */ .chroma .ss { color: #40a02b } +/* LiteralNumber */ .chroma .m { color: #fe640b } +/* LiteralNumberBin */ .chroma .mb { color: #fe640b } +/* LiteralNumberFloat */ .chroma .mf { color: #fe640b } +/* LiteralNumberHex */ .chroma .mh { color: #fe640b } +/* LiteralNumberInteger */ .chroma .mi { color: #fe640b } +/* LiteralNumberIntegerLong */ .chroma .il { color: #fe640b } +/* LiteralNumberOct */ .chroma .mo { color: #fe640b } +/* Operator */ .chroma .o { color: #04a5e5; font-weight: bold } +/* OperatorWord */ .chroma .ow { color: #04a5e5; font-weight: bold } +/* Comment */ .chroma .c { color: #9ca0b0; font-style: italic } +/* CommentHashbang */ .chroma .ch { color: #9ca0b0; font-style: italic } +/* CommentMultiline */ .chroma .cm { color: #9ca0b0; font-style: italic } +/* CommentSingle */ .chroma .c1 { color: #9ca0b0; font-style: italic } +/* CommentSpecial */ .chroma .cs { color: #9ca0b0; font-style: italic } +/* CommentPreproc */ .chroma .cp { color: #9ca0b0; font-style: italic } +/* CommentPreprocFile */ .chroma .cpf { color: #9ca0b0; font-weight: bold; font-style: italic } +/* GenericDeleted */ .chroma .gd { color: #d20f39; background-color: #ccd0da } +/* GenericEmph */ .chroma .ge { font-style: italic } +/* GenericError */ .chroma .gr { color: #d20f39 } +/* GenericHeading */ .chroma .gh { color: #fe640b; font-weight: bold } +/* GenericInserted */ .chroma .gi { color: #40a02b; background-color: #ccd0da } +/* GenericStrong */ .chroma .gs { font-weight: bold } +/* GenericSubheading */ .chroma .gu { color: #fe640b; font-weight: bold } +/* GenericTraceback */ .chroma .gt { color: #d20f39 } +/* GenericUnderline */ .chroma .gl { text-decoration: underline } + +@media (prefers-color-scheme: dark) { +/* Background */ .bg { color: #cad3f5; background-color: #24273a; } +/* PreWrapper */ .chroma { color: #cad3f5; background-color: #24273a; } +/* Error */ .chroma .err { color: #ed8796 } +/* LineLink */ .chroma .lnlinks { outline: none; text-decoration: none; color: inherit } +/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; } +/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; } +/* LineHighlight */ .chroma .hl { background-color: #494d64 } +/* LineNumbersTable */ .chroma .lnt { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #8087a2 } +/* LineNumbers */ .chroma .ln { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #8087a2 } +/* Line */ .chroma .line { display: flex; } +/* Keyword */ .chroma .k { color: #c6a0f6 } +/* KeywordConstant */ .chroma .kc { color: #f5a97f } +/* KeywordDeclaration */ .chroma .kd { color: #ed8796 } +/* KeywordNamespace */ .chroma .kn { color: #8bd5ca } +/* KeywordPseudo */ .chroma .kp { color: #c6a0f6 } +/* KeywordReserved */ .chroma .kr { color: #c6a0f6 } +/* KeywordType */ .chroma .kt { color: #ed8796 } +/* NameAttribute */ .chroma .na { color: #8aadf4 } +/* NameBuiltin */ .chroma .nb { color: #91d7e3 } +/* NameBuiltinPseudo */ .chroma .bp { color: #91d7e3 } +/* NameClass */ .chroma .nc { color: #eed49f } +/* NameConstant */ .chroma .no { color: #eed49f } +/* NameDecorator */ .chroma .nd { color: #8aadf4; font-weight: bold } +/* NameEntity */ .chroma .ni { color: #8bd5ca } +/* NameException */ .chroma .ne { color: #f5a97f } +/* NameFunction */ .chroma .nf { color: #8aadf4 } +/* NameFunctionMagic */ .chroma .fm { color: #8aadf4 } +/* NameLabel */ .chroma .nl { color: #91d7e3 } +/* NameNamespace */ .chroma .nn { color: #f5a97f } +/* NameProperty */ .chroma .py { color: #f5a97f } +/* NameTag */ .chroma .nt { color: #c6a0f6 } +/* NameVariable */ .chroma .nv { color: #f4dbd6 } +/* NameVariableClass */ .chroma .vc { color: #f4dbd6 } +/* NameVariableGlobal */ .chroma .vg { color: #f4dbd6 } +/* NameVariableInstance */ .chroma .vi { color: #f4dbd6 } +/* NameVariableMagic */ .chroma .vm { color: #f4dbd6 } +/* LiteralString */ .chroma .s { color: #a6da95 } +/* LiteralStringAffix */ .chroma .sa { color: #ed8796 } +/* LiteralStringBacktick */ .chroma .sb { color: #a6da95 } +/* LiteralStringChar */ .chroma .sc { color: #a6da95 } +/* LiteralStringDelimiter */ .chroma .dl { color: #8aadf4 } +/* LiteralStringDoc */ .chroma .sd { color: #6e738d } +/* LiteralStringDouble */ .chroma .s2 { color: #a6da95 } +/* LiteralStringEscape */ .chroma .se { color: #8aadf4 } +/* LiteralStringHeredoc */ .chroma .sh { color: #6e738d } +/* LiteralStringInterpol */ .chroma .si { color: #a6da95 } +/* LiteralStringOther */ .chroma .sx { color: #a6da95 } +/* LiteralStringRegex */ .chroma .sr { color: #8bd5ca } +/* LiteralStringSingle */ .chroma .s1 { color: #a6da95 } +/* LiteralStringSymbol */ .chroma .ss { color: #a6da95 } +/* LiteralNumber */ .chroma .m { color: #f5a97f } +/* LiteralNumberBin */ .chroma .mb { color: #f5a97f } +/* LiteralNumberFloat */ .chroma .mf { color: #f5a97f } +/* LiteralNumberHex */ .chroma .mh { color: #f5a97f } +/* LiteralNumberInteger */ .chroma .mi { color: #f5a97f } +/* LiteralNumberIntegerLong */ .chroma .il { color: #f5a97f } +/* LiteralNumberOct */ .chroma .mo { color: #f5a97f } +/* Operator */ .chroma .o { color: #91d7e3; font-weight: bold } +/* OperatorWord */ .chroma .ow { color: #91d7e3; font-weight: bold } +/* Comment */ .chroma .c { color: #6e738d; font-style: italic } +/* CommentHashbang */ .chroma .ch { color: #6e738d; font-style: italic } +/* CommentMultiline */ .chroma .cm { color: #6e738d; font-style: italic } +/* CommentSingle */ .chroma .c1 { color: #6e738d; font-style: italic } +/* CommentSpecial */ .chroma .cs { color: #6e738d; font-style: italic } +/* CommentPreproc */ .chroma .cp { color: #6e738d; font-style: italic } +/* CommentPreprocFile */ .chroma .cpf { color: #6e738d; font-weight: bold; font-style: italic } +/* GenericDeleted */ .chroma .gd { color: #ed8796; background-color: #363a4f } +/* GenericEmph */ .chroma .ge { font-style: italic } +/* GenericError */ .chroma .gr { color: #ed8796 } +/* GenericHeading */ .chroma .gh { color: #f5a97f; font-weight: bold } +/* GenericInserted */ .chroma .gi { color: #a6da95; background-color: #363a4f } +/* GenericStrong */ .chroma .gs { font-weight: bold } +/* GenericSubheading */ .chroma .gu { color: #f5a97f; font-weight: bold } +/* GenericTraceback */ .chroma .gt { color: #ed8796 } +/* GenericUnderline */ .chroma .gl { text-decoration: underline } +} + +.chroma .line:has(.ln:target) { + background-color: rgba(140, 143, 161, 0.2); +} + +@media (prefers-color-scheme: dark) { + .chroma .line:has(.ln:target) { + background-color: rgba(128, 135, 162, 0.2); + } +} + +