Repository: alecthomas/chroma
Pull request #413 (2020-10-23 07:54:19)

Add base16-snazzy style
I use the fantastic Cheat project (https://github.com/cheat/cheat) which utilizes this library. I would like to kindly submit this Base16 style to match my current terminal colorscheme, as per [this](https://github.com/cheat/cheat/issues/558) issue.




Patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644
index 0000000..7a6a7f1
--- /dev/null
+++ b/.circleci/config.yml
@@ -0,0 +1,42 @@
+version: 2.1
+workflows:
+  main:
+    jobs:
+      - build
+      - release:
+          # Only run this job on git tag pushes
+          filters:
+            branches:
+              ignore: /.*/
+            tags:
+              only: /v[0-9]+(\.[0-9]+)*(-.*)*/
+jobs:
+  build:
+    environment:
+      GO111MODULE: "on"
+    docker:
+      - image: circleci/golang:1.15
+    working_directory: /go/src/github.com/alecthomas/chroma
+    steps:
+      - checkout
+      - run:
+          name: Prepare
+          command: |
+            curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s v1.26.0
+            mkdir ~/report
+          when: always
+      - run:
+          name: Test
+          command: |
+            go test -v ./...
+      - run:
+          name: Lint
+          command: |
+            go build ./...
+            ./bin/golangci-lint run
+  release:
+    docker:
+      - image: circleci/golang:1.15
+    steps:
+      - checkout
+      - run: curl -sL https://git.io/goreleaser | bash
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 9a1bf1f..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-sudo: false
-arch:
-  - ppc64le
-  - amd64
-language: go
-go:
-  - "1.13.x"
-script:
-  - go test -v ./...
-  - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s v1.26.0
-  - ./bin/golangci-lint run
-  - git clean -fdx .
-after_success:
-  curl -sL https://git.io/goreleaser | bash && goreleaser
-
diff --git a/README.md b/README.md
index 490adea..fc33a2e 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Chroma — A general purpose syntax highlighter in pure Go [![Golang Documentation](https://godoc.org/github.com/alecthomas/chroma?status.svg)](https://godoc.org/github.com/alecthomas/chroma) [![Build Status](https://travis-ci.org/alecthomas/chroma.svg)](https://travis-ci.org/alecthomas/chroma) [![Gitter chat](https://badges.gitter.im/alecthomas.svg)](https://gitter.im/alecthomas/Lobby)
+# Chroma — A general purpose syntax highlighter in pure Go [![Golang Documentation](https://godoc.org/github.com/alecthomas/chroma?status.svg)](https://godoc.org/github.com/alecthomas/chroma) [![CircleCI](https://img.shields.io/circleci/project/github/alecthomas/chroma.svg)](https://circleci.com/gh/alecthomas/chroma) [![Go Report Card](https://goreportcard.com/badge/github.com/alecthomas/chroma)](https://goreportcard.com/report/github.com/alecthomas/chroma) [![Slack chat](https://img.shields.io/static/v1?logo=slack&style=flat&label=slack&color=green&message=gophers)](https://gophers.slack.com/messages/CN9DS8YF3)
 
 > **NOTE:** As Chroma has just been released, its API is still in flux. That said, the high-level interface should not change significantly.
 
diff --git a/lexers/j/javascript.go b/lexers/j/javascript.go
index a50cb24..ffa20c3 100644
--- a/lexers/j/javascript.go
+++ b/lexers/j/javascript.go
@@ -49,6 +49,7 @@ var JavascriptRules = Rules{
 		{"`", LiteralStringBacktick, Pop(1)},
 		{`\\\\`, LiteralStringBacktick, nil},
 		{"\\\\`", LiteralStringBacktick, nil},
+		{"\\\\[^`\\\\]", LiteralStringBacktick, nil},
 		{`\$\{`, LiteralStringInterpol, Push("interp-inside")},
 		{`\$`, LiteralStringBacktick, nil},
 		{"[^`\\\\$]+", LiteralStringBacktick, nil},
diff --git a/styles/base16-snazzy.go b/styles/base16-snazzy.go
new file mode 100644
index 0000000..160c75b
--- /dev/null
+++ b/styles/base16-snazzy.go
@@ -0,0 +1,81 @@
+package styles
+
+import (
+	"github.com/alecthomas/chroma"
+)
+
+// Base16Snazzy style
+var Base16Snazzy = Register(chroma.MustNewStyle("base16-snazzy", chroma.StyleEntries{
+	chroma.Comment:                  "#78787e",
+	chroma.CommentHashbang:          "#78787e",
+	chroma.CommentMultiline:         "#78787e",
+	chroma.CommentPreproc:           "#78787e",
+	chroma.CommentSingle:            "#78787e",
+	chroma.CommentSpecial:           "#78787e",
+	chroma.Generic:                  "#e2e4e5",
+	chroma.GenericDeleted:           "#ff5c57",
+	chroma.GenericEmph:              "#e2e4e5 underline",
+	chroma.GenericError:             "#ff5c57",
+	chroma.GenericHeading:           "#e2e4e5 bold",
+	chroma.GenericInserted:          "#e2e4e5 bold",
+	chroma.GenericOutput:            "#43454f",
+	chroma.GenericPrompt:            "#e2e4e5",
+	chroma.GenericStrong:            "#e2e4e5 italic",
+	chroma.GenericSubheading:        "#e2e4e5 bold",
+	chroma.GenericTraceback:         "#e2e4e5",
+	chroma.GenericUnderline:         "underline",
+	chroma.Error:                    "#ff5c57",
+	chroma.Keyword:                  "#ff6ac1",
+	chroma.KeywordConstant:          "#ff6ac1",
+	chroma.KeywordDeclaration:       "#ff5c57",
+	chroma.KeywordNamespace:         "#ff6ac1",
+	chroma.KeywordPseudo:            "#ff6ac1",
+	chroma.KeywordReserved:          "#ff6ac1",
+	chroma.KeywordType:              "#9aedfe",
+	chroma.Literal:                  "#e2e4e5",
+	chroma.LiteralDate:              "#e2e4e5",
+	chroma.Name:                     "#e2e4e5",
+	chroma.NameAttribute:            "#57c7ff",
+	chroma.NameBuiltin:              "#ff5c57",
+	chroma.NameBuiltinPseudo:        "#e2e4e5",
+	chroma.NameClass:                "#f3f99d",
+	chroma.NameConstant:             "#ff9f43",
+	chroma.NameDecorator:            "#ff9f43",
+	chroma.NameEntity:               "#e2e4e5",
+	chroma.NameException:            "#e2e4e5",
+	chroma.NameFunction:             "#57c7ff",
+	chroma.NameLabel:                "#ff5c57",
+	chroma.NameNamespace:            "#e2e4e5",
+	chroma.NameOther:                "#e2e4e5",
+	chroma.NameTag:                  "#ff6ac1",
+	chroma.NameVariable:             "#ff5c57",
+	chroma.NameVariableClass:        "#ff5c57",
+	chroma.NameVariableGlobal:       "#ff5c57",
+	chroma.NameVariableInstance:     "#ff5c57",
+	chroma.LiteralNumber:            "#ff9f43",
+	chroma.LiteralNumberBin:         "#ff9f43",
+	chroma.LiteralNumberFloat:       "#ff9f43",
+	chroma.LiteralNumberHex:         "#ff9f43",
+	chroma.LiteralNumberInteger:     "#ff9f43",
+	chroma.LiteralNumberIntegerLong: "#ff9f43",
+	chroma.LiteralNumberOct:         "#ff9f43",
+	chroma.Operator:                 "#ff6ac1",
+	chroma.OperatorWord:             "#ff6ac1",
+	chroma.Other:                    "#e2e4e5",
+	chroma.Punctuation:              "#e2e4e5",
+	chroma.LiteralString:            "#5af78e",
+	chroma.LiteralStringBacktick:    "#5af78e",
+	chroma.LiteralStringChar:        "#5af78e",
+	chroma.LiteralStringDoc:         "#5af78e",
+	chroma.LiteralStringDouble:      "#5af78e",
+	chroma.LiteralStringEscape:      "#5af78e",
+	chroma.LiteralStringHeredoc:     "#5af78e",
+	chroma.LiteralStringInterpol:    "#5af78e",
+	chroma.LiteralStringOther:       "#5af78e",
+	chroma.LiteralStringRegex:       "#5af78e",
+	chroma.LiteralStringSingle:      "#5af78e",
+	chroma.LiteralStringSymbol:      "#5af78e",
+	chroma.Text:                     "#e2e4e5",
+	chroma.TextWhitespace:           "#e2e4e5",
+	chroma.Background:               " bg:#282a36",
+}))


Test patch:
diff --git a/lexers/testdata/javascript.actual b/lexers/testdata/javascript.actual
index d0eac9a..0506772 100644
--- a/lexers/testdata/javascript.actual
+++ b/lexers/testdata/javascript.actual
@@ -1,2 +1,3 @@
 sum = parseInt(num1) + parseInt(num2) // "+" means "add"
-alert("Sum = " + sum)  // "+" means combine into a string
\ No newline at end of file
+alert("Sum = " + sum)  // "+" means combine into a string
+const filePath = String.raw`C:\Development\profile\aboutme.html`;
diff --git a/lexers/testdata/javascript.expected b/lexers/testdata/javascript.expected
index 094b337..04c4264 100644
--- a/lexers/testdata/javascript.expected
+++ b/lexers/testdata/javascript.expected
@@ -25,5 +25,17 @@
   {"type":"NameOther","value":"sum"},
   {"type":"Punctuation","value":")"},
   {"type":"Text","value":"  "},
-  {"type":"CommentSingle","value":"// \"+\" means combine into a string\n"}
+  {"type":"CommentSingle","value":"// \"+\" means combine into a string\n"},
+  {"type":"KeywordReserved","value":"const"},
+  {"type":"Text","value":" "},
+  {"type":"NameOther","value":"filePath"},
+  {"type":"Text","value":" "},
+  {"type":"Operator","value":"="},
+  {"type":"Text","value":" "},
+  {"type":"NameBuiltin","value":"String"},
+  {"type":"Punctuation","value":"."},
+  {"type":"NameOther","value":"raw"},
+  {"type":"LiteralStringBacktick","value":"`C:\\Development\\profile\\aboutme.html`"},
+  {"type":"Punctuation","value":";"},
+  {"type":"Text","value":"\n"}
 ]