diff options
author | silverwind <me@silverwind.io> | 2023-03-15 03:20:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-14 22:20:19 -0400 |
commit | 202803fc69d21763a06d8d0f5a4c46509c18f6f1 (patch) | |
tree | 4e273829061a640ceb6b3a33e563b3e8d842a8ae /web_src/less/chroma | |
parent | bf730528cadc4727eab8844934b6a0716d327243 (diff) | |
download | gitea-202803fc69d21763a06d8d0f5a4c46509c18f6f1.tar.gz gitea-202803fc69d21763a06d8d0f5a4c46509c18f6f1.zip |
Replace Less with CSS (#23481)
Ran most of the Less files through the Less compiler and Prettier and
then followed up with a round of manual fixes.
The Less compiler had unfortunately stripped all `//` style comments
that I had to restore (It did preserve `/* */` comments). Other fixes
include duplicate selector removal which were revealed after the
transpilation and which weren't caught by stylelint before but now are.
Fixes: https://github.com/go-gitea/gitea/issues/15565
Diffstat (limited to 'web_src/less/chroma')
-rw-r--r-- | web_src/less/chroma/base.less | 50 | ||||
-rw-r--r-- | web_src/less/chroma/chroma-style-diff.go | 79 | ||||
-rw-r--r-- | web_src/less/chroma/dark.less | 74 | ||||
-rw-r--r-- | web_src/less/chroma/light.less | 74 |
4 files changed, 0 insertions, 277 deletions
diff --git a/web_src/less/chroma/base.less b/web_src/less/chroma/base.less deleted file mode 100644 index 597ee2a72d..0000000000 --- a/web_src/less/chroma/base.less +++ /dev/null @@ -1,50 +0,0 @@ -.chroma { - background-color: var(--color-code-bg); -} - -/* LineTableTD */ -.chroma .lntd { - vertical-align: top; - padding: 0; - margin: 0; - border: 0; -} - -/* LineTable */ -.chroma .lntable { - border-spacing: 0; - padding: 0; - margin: 0; - border: 0; - width: auto; - overflow: auto; - display: block; -} - -/* LineHighlight */ -.chroma .hl { - display: block; - width: 100%; -} - -/* LineNumbersTable */ -.chroma .lnt { - margin-right: .4em; - padding: 0 .4em; -} - -/* LineNumbers */ -.chroma .ln { - margin-right: .4em; - padding: 0 .4em; -} - -/* GenericStrong */ -.chroma .gs { - font-weight: 600; -} - -/* GenericUnderline */ -.chroma .gl { - text-decoration: underline; -} diff --git a/web_src/less/chroma/chroma-style-diff.go b/web_src/less/chroma/chroma-style-diff.go deleted file mode 100644 index 4243259689..0000000000 --- a/web_src/less/chroma/chroma-style-diff.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2023 The Gitea Authors. All rights reserved. -// SPDX-License-Identifier: MIT - -//go:build ignore - -/* -This tool is used to compare the CSS names in a chroma builtin styles with the Gitea theme CSS names. - -It outputs the difference between the two sets of CSS names, eg: - -``` -CSS names not in builtin: -.chroma .ln ----- -Builtin CSS names not in file: -.chroma .vm -``` - -Developers could use this tool to re-sync the CSS names in the Gitea theme. -*/ - -package main - -import ( - "os" - "regexp" - "strings" - - "github.com/alecthomas/chroma/v2" -) - -func main() { - if len(os.Args) != 2 { - println("Usage: chroma-style-diff css-or-less-file") - os.Exit(1) - } - - data, err := os.ReadFile(os.Args[1]) - if err != nil { - println(err.Error()) - os.Exit(1) - } - - content := string(data) - - // a simple CSS parser to collect CSS names - content = regexp.MustCompile("//.*\r?\n").ReplaceAllString(content, "\n") - content = regexp.MustCompile("/\\*.*?\\*/").ReplaceAllString(content, "") - matches := regexp.MustCompile("\\s*([-.#:\\w\\s]+)\\s*\\{[^}]*}").FindAllStringSubmatch(content, -1) - - cssNames := map[string]bool{} - for _, matchGroup := range matches { - cssName := strings.TrimSpace(matchGroup[1]) - cssNames[cssName] = true - } - - // collect Chroma builtin CSS names - builtin := map[string]bool{} - for tokenType, cssName := range chroma.StandardTypes { - if tokenType > 0 && cssName != "" { - builtin[".chroma ."+cssName] = true - } - } - - // show the diff - println("CSS names not in builtin:") - for cssName := range cssNames { - if !builtin[cssName] { - println(cssName) - } - } - println("----") - println("Builtin CSS names not in file:") - for cssName := range builtin { - if !cssNames[cssName] { - println(cssName) - } - } -} diff --git a/web_src/less/chroma/dark.less b/web_src/less/chroma/dark.less deleted file mode 100644 index 1b0c722a16..0000000000 --- a/web_src/less/chroma/dark.less +++ /dev/null @@ -1,74 +0,0 @@ -.chroma .bp { color: #fabd2f; } /* NameBuiltinPseudo */ -.chroma .c { color: #777e94; } /* Comment */ -.chroma .c1 { color: #777e94; } /* CommentSingle */ -.chroma .ch { color: #777e94; } /* CommentHashbang */ -.chroma .cm { color: #777e94; } /* CommentMultiline */ -.chroma .cp { color: #8ec07c; } /* CommentPreproc */ -.chroma .cpf { color: #649bc4; } /* CommentPreprocFile */ -.chroma .cs { color: #9075cd; } /* CommentSpecial */ -.chroma .dl { color: #649bc4; } /* LiteralStringDelimiter */ -.chroma .fm {} /* NameFunctionMagic */ -.chroma .g {} /* Generic */ -.chroma .gd { color: #ffffff; background-color: #5f3737; } /* GenericDeleted */ -.chroma .ge { color: #ddee30; } /* GenericEmph */ -.chroma .gh { color: #ffaa10; } /* GenericHeading */ -.chroma .gi { color: #ffffff; background-color: #3a523a; } /* GenericInserted */ -.chroma .gl {} /* GenericUnderline */ -.chroma .go { color: #777e94; } /* GenericOutput */ -.chroma .gp { color: #ebdbb2; } /* GenericPrompt */ -.chroma .gr { color: #ff4433; } /* GenericError */ -.chroma .gs { color: #ebdbb2; } /* GenericStrong */ -.chroma .gt { color: #ff7540; } /* GenericTraceback */ -.chroma .gu { color: #b8bb26; } /* GenericSubheading */ -.chroma .il { color: #649bc4; } /* LiteralNumberIntegerLong */ -.chroma .k { color: #ff7540; } /* Keyword */ -.chroma .kc { color: #649bc4; } /* KeywordConstant */ -.chroma .kd { color: #ff7540; } /* KeywordDeclaration */ -.chroma .kn { color: #ffaa10; } /* KeywordNamespace */ -.chroma .kp { color: #5f8700; } /* KeywordPseudo */ -.chroma .kr { color: #ff7540; } /* KeywordReserved */ -.chroma .kt { color: #ff7b72; } /* KeywordType */ -.chroma .l {} /* Literal */ -.chroma .ld {} /* LiteralDate */ -.chroma .m { color: #649bc4; } /* LiteralNumber */ -.chroma .mb { color: #649bc4; } /* LiteralNumberBin */ -.chroma .mf { color: #649bc4; } /* LiteralNumberFloat */ -.chroma .mh { color: #649bc4; } /* LiteralNumberHex */ -.chroma .mi { color: #649bc4; } /* LiteralNumberInteger */ -.chroma .mo { color: #649bc4; } /* LiteralNumberOct */ -.chroma .n { color: #c9d1d9; } /* Name */ -.chroma .na { color: #b8bb26; } /* NameAttribute */ -.chroma .nb { color: #fabd2f; } /* NameBuiltin */ -.chroma .nc { color: #ffaa10; } /* NameClass */ -.chroma .nd { color: #8ec07c; } /* NameDecorator */ -.chroma .ne { color: #ff7540; } /* NameException */ -.chroma .nf { color: #fabd2f; } /* NameFunction */ -.chroma .ni { color: #fabd2f; } /* NameEntity */ -.chroma .nl { color: #ff7540; } /* NameLabel */ -.chroma .nn { color: #ffaa10; } /* NameNamespace */ -.chroma .no { color: #649bc4; } /* NameConstant */ -.chroma .nt { color: #ff7540; } /* NameTag */ -.chroma .nv { color: #ebdbb2; } /* NameVariable */ -.chroma .nx { color: #b6bac5; } /* NameOther */ -.chroma .o { color: #ff7540; } /* Operator */ -.chroma .ow { color: #5f8700; } /* OperatorWord */ -.chroma .p { color: #d2d4db; } /* Punctuation */ -.chroma .py {} /* NameProperty */ -.chroma .s { color: #b8bb26; } /* LiteralString */ -.chroma .s1 { color: #b8bb26; } /* LiteralStringSingle */ -.chroma .s2 { color: #b8bb26; } /* LiteralStringDouble */ -.chroma .sa { color: #649bc4; } /* LiteralStringAffix */ -.chroma .sb { color: #b8bb26; } /* LiteralStringBacktick */ -.chroma .sc { color: #649bc4; } /* LiteralStringChar */ -.chroma .sd { color: #777e94; } /* LiteralStringDoc */ -.chroma .se { color: #ff7540; } /* LiteralStringEscape */ -.chroma .sh { color: #649bc4; } /* LiteralStringHeredoc */ -.chroma .si { color: #ffaa10; } /* LiteralStringInterpol */ -.chroma .sr { color: #9075cd; } /* LiteralStringRegex */ -.chroma .ss { color: #ff7540; } /* LiteralStringSymbol */ -.chroma .sx { color: #ffaa10; } /* LiteralStringOther */ -.chroma .vc { color: #ff7540; } /* NameVariableClass */ -.chroma .vg { color: #ffaa10; } /* NameVariableGlobal */ -.chroma .vi { color: #ffaa10; } /* NameVariableInstance */ -.chroma .vm {} /* NameVariableMagic */ -.chroma .w { color: #7f8699; } /* TextWhitespace */ diff --git a/web_src/less/chroma/light.less b/web_src/less/chroma/light.less deleted file mode 100644 index 4bfce8fe71..0000000000 --- a/web_src/less/chroma/light.less +++ /dev/null @@ -1,74 +0,0 @@ -.chroma .bp { color: #999999; } /* NameBuiltinPseudo */ -.chroma .c { color: #6a737d; } /* Comment */ -.chroma .c1 { color: #6a737d; } /* CommentSingle */ -.chroma .ch { color: #6a737d; } /* CommentHashbang */ -.chroma .cm { color: #999988; } /* CommentMultiline */ -.chroma .cp { color: #109295; } /* CommentPreproc */ -.chroma .cpf { color: #4c4dbc; } /* CommentPreprocFile */ -.chroma .cs { color: #999999; } /* CommentSpecial */ -.chroma .dl { color: #106303; } /* LiteralStringDelimiter */ -.chroma .fm {} /* NameFunctionMagic */ -.chroma .g {} /* Generic */ -.chroma .gd { color: #000000; background-color: #ffdddd; } /* GenericDeleted */ -.chroma .ge { color: #000000; } /* GenericEmph */ -.chroma .gh { color: #999999; } /* GenericHeading */ -.chroma .gi { color: #000000; background-color: #ddffdd; } /* GenericInserted */ -.chroma .gl {} /* GenericUnderline */ -.chroma .go { color: #888888; } /* GenericOutput */ -.chroma .gp { color: #555555; } /* GenericPrompt */ -.chroma .gr { color: #aa0000; } /* GenericError */ -.chroma .gs {} /* GenericStrong */ -.chroma .gt { color: #aa0000; } /* GenericTraceback */ -.chroma .gu { color: #aaaaaa; } /* GenericSubheading */ -.chroma .il { color: #009999; } /* LiteralNumberIntegerLong */ -.chroma .k { color: #d73a49; } /* Keyword */ -.chroma .kc { color: #d73a49; } /* KeywordConstant */ -.chroma .kd { color: #d73a49; } /* KeywordDeclaration */ -.chroma .kn { color: #d73a49; } /* KeywordNamespace */ -.chroma .kp { color: #d73a49; } /* KeywordPseudo */ -.chroma .kr { color: #d73a49; } /* KeywordReserved */ -.chroma .kt { color: #445588; } /* KeywordType */ -.chroma .l {} /* Literal */ -.chroma .ld {} /* LiteralDate */ -.chroma .m { color: #009999; } /* LiteralNumber */ -.chroma .mb { color: #009999; } /* LiteralNumberBin */ -.chroma .mf { color: #009999; } /* LiteralNumberFloat */ -.chroma .mh { color: #009999; } /* LiteralNumberHex */ -.chroma .mi { color: #009999; } /* LiteralNumberInteger */ -.chroma .mo { color: #009999; } /* LiteralNumberOct */ -.chroma .n {} /* Name */ -.chroma .na { color: #d73a49; } /* NameAttribute */ -.chroma .nb { color: #005cc5; } /* NameBuiltin */ -.chroma .nc { color: #445588; } /* NameClass */ -.chroma .nd { color: #3c5d5d; } /* NameDecorator */ -.chroma .ne { color: #990000; } /* NameException */ -.chroma .nf { color: #005cc5; } /* NameFunction */ -.chroma .ni { color: #6f42c1; } /* NameEntity */ -.chroma .nl { color: #990000; } /* NameLabel */ -.chroma .nn { color: #555555; } /* NameNamespace */ -.chroma .no { color: #008080; } /* NameConstant */ -.chroma .nt { color: #22863a; } /* NameTag */ -.chroma .nv { color: #008080; } /* NameVariable */ -.chroma .nx { color: #24292e; } /* NameOther */ -.chroma .o { color: #d73a49; } /* Operator */ -.chroma .ow { color: #d73a49; } /* OperatorWord */ -.chroma .p {} /* Punctuation */ -.chroma .py {} /* NameProperty */ -.chroma .s { color: #106303; } /* LiteralString */ -.chroma .s1 { color: #cc7a00; } /* LiteralStringSingle */ -.chroma .s2 { color: #106303; } /* LiteralStringDouble */ -.chroma .sa { color: #106303; } /* LiteralStringAffix */ -.chroma .sb { color: #106303; } /* LiteralStringBacktick */ -.chroma .sc { color: #106303; } /* LiteralStringChar */ -.chroma .sd { color: #106303; } /* LiteralStringDoc */ -.chroma .se { color: #106303; } /* LiteralStringEscape */ -.chroma .sh { color: #106303; } /* LiteralStringHeredoc */ -.chroma .si { color: #106303; } /* LiteralStringInterpol */ -.chroma .sr { color: #22863a; } /* LiteralStringRegex */ -.chroma .ss { color: #106303; } /* LiteralStringSymbol */ -.chroma .sx { color: #106303; } /* LiteralStringOther */ -.chroma .vc { color: #008080; } /* NameVariableClass */ -.chroma .vg { color: #008080; } /* NameVariableGlobal */ -.chroma .vi { color: #008080; } /* NameVariableInstance */ -.chroma .vm {} /* NameVariableMagic */ -.chroma .w { color: #bbbbbb; } /* TextWhitespace */ |