1
1
mirror of https://github.com/go-gitea/gitea synced 2024-06-02 01:15:48 +00:00
gitea/vendor/github.com/alecthomas/chroma/styles/murphy.go
mrsdizzie af7ffaa279
Server-side syntax highlighting for all code (#12047)
* Server-side syntax hilighting for all code

This PR does a few things:

* Remove all traces of highlight.js
* Use chroma library to provide fast syntax hilighting directly on the server
* Provide syntax hilighting for diffs
* Re-style both unified and split diffs views
* Add custom syntax hilighting styling for both regular and arc-green

Fixes #7729
Fixes #10157
Fixes #11825
Fixes #7728
Fixes #3872
Fixes #3682

And perhaps gets closer to #9553

* fix line marker

* fix repo search

* Fix single line select

* properly load settings

* npm uninstall highlight.js

* review suggestion

* code review

* forgot to call function

* fix test

* Apply suggestions from code review

suggestions from @silverwind thanks

Co-authored-by: silverwind <me@silverwind.io>

* code review

* copy/paste error

* Use const for highlight size limit

* Update web_src/less/_repository.less

Co-authored-by: Lauris BH <lauris@nix.lv>

* update size limit to 1MB and other styling tweaks

* fix highlighting for certain diff sections

* fix test

* add worker back as suggested

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-07-01 00:34:03 +03:00

60 lines
2.2 KiB
Go
Vendored

package styles
import (
"github.com/alecthomas/chroma"
)
// Murphy style.
var Murphy = Register(chroma.MustNewStyle("murphy", chroma.StyleEntries{
chroma.TextWhitespace: "#bbbbbb",
chroma.Comment: "#666 italic",
chroma.CommentPreproc: "#579 noitalic",
chroma.CommentSpecial: "#c00 bold",
chroma.Keyword: "bold #289",
chroma.KeywordPseudo: "#08f",
chroma.KeywordType: "#66f",
chroma.Operator: "#333",
chroma.OperatorWord: "bold #000",
chroma.NameBuiltin: "#072",
chroma.NameFunction: "bold #5ed",
chroma.NameClass: "bold #e9e",
chroma.NameNamespace: "bold #0e84b5",
chroma.NameException: "bold #F00",
chroma.NameVariable: "#036",
chroma.NameVariableInstance: "#aaf",
chroma.NameVariableClass: "#ccf",
chroma.NameVariableGlobal: "#f84",
chroma.NameConstant: "bold #5ed",
chroma.NameLabel: "bold #970",
chroma.NameEntity: "#800",
chroma.NameAttribute: "#007",
chroma.NameTag: "#070",
chroma.NameDecorator: "bold #555",
chroma.LiteralString: "bg:#e0e0ff",
chroma.LiteralStringChar: "#88F bg:",
chroma.LiteralStringDoc: "#D42 bg:",
chroma.LiteralStringInterpol: "bg:#eee",
chroma.LiteralStringEscape: "bold #666",
chroma.LiteralStringRegex: "bg:#e0e0ff #000",
chroma.LiteralStringSymbol: "#fc8 bg:",
chroma.LiteralStringOther: "#f88",
chroma.LiteralNumber: "bold #60E",
chroma.LiteralNumberInteger: "bold #66f",
chroma.LiteralNumberFloat: "bold #60E",
chroma.LiteralNumberHex: "bold #058",
chroma.LiteralNumberOct: "bold #40E",
chroma.GenericHeading: "bold #000080",
chroma.GenericSubheading: "bold #800080",
chroma.GenericDeleted: "#A00000",
chroma.GenericInserted: "#00A000",
chroma.GenericError: "#FF0000",
chroma.GenericEmph: "italic",
chroma.GenericStrong: "bold",
chroma.GenericPrompt: "bold #c65d09",
chroma.GenericOutput: "#888",
chroma.GenericTraceback: "#04D",
chroma.GenericUnderline: "underline",
chroma.Error: "#F00 bg:#FAA",
chroma.Background: " bg:#ffffff",
}))