`chroma` is an [[MIT License]] licensed command line syntax highlighter written in [[Go]].
- [Source](https://github.com/alecthomas/chroma)
> Chroma takes source code and other structured text and converts it into syntax highlighted HTML, ANSI-coloured text, etc.
# Notability
# Philosophy
Based on [[Pygments]] but ported from [[Python]] into [[Go]].
# OS Support
- [[Linux]]
- [[MacOS]]
- [[Windows]]
# Features
- Can be used as a library
- like Pygments, has the concepts of [lexers](https://github.com/alecthomas/chroma/tree/master/lexers), [formatters](https://github.com/alecthomas/chroma/tree/master/formatters) and [styles](https://github.com/alecthomas/chroma/tree/master/styles).
## Languages Supported
|Prefix|Language|
|:-:|---|
|A|ABAP, ABNF, ActionScript, ActionScript 3, Ada, Agda, AL, Alloy, Angular2, ANTLR, ApacheConf, APL, AppleScript, ArangoDB AQL, Arduino, ArmAsm, AutoHotkey, AutoIt, Awk|
|B|Ballerina, Bash, Bash Session, Batchfile, BibTeX, Bicep, BlitzBasic, BNF, BQN, Brainfuck|
|C|C, C#, C++, Caddyfile, Caddyfile Directives, Cap'n Proto, Cassandra CQL, Ceylon, CFEngine3, cfstatement, ChaiScript, Chapel, Cheetah, Clojure, CMake, COBOL, CoffeeScript, Common Lisp, Coq, Crystal, CSS, Cython|
|D|D, Dart, Dax, Desktop Entry, Diff, Django/Jinja, dns, Docker, DTD, Dylan|
|E|EBNF, Elixir, Elm, EmacsLisp, Erlang|
|F|Factor, Fennel, Fish, Forth, Fortran, FortranFixed, FSharp|
|G|GAS, GDScript, Genshi, Genshi HTML, Genshi Text, Gherkin, GLSL, Gnuplot, Go, Go HTML Template, Go Text Template, GraphQL, Groff, Groovy|
|H|Handlebars, Hare, Haskell, Haxe, HCL, Hexdump, HLB, HLSL, HolyC, HTML, HTTP, Hy|
|I|Idris, Igor, INI, Io, ISCdhcpd|
|J|J, Java, JavaScript, JSON, Julia, Jungle|
|K|Kotlin|
|L|Lighttpd configuration file, LLVM, Lua|
|M|Makefile, Mako, markdown, Mason, Materialize SQL dialect, Mathematica, Matlab, mcfunction, Meson, Metal, MiniZinc, MLIR, Modula-2, MonkeyC, MorrowindScript, Myghty, MySQL|
|N|NASM, Natural, Newspeak, Nginx configuration file, Nim, Nix|
|O|Objective-C, OCaml, Octave, Odin, OnesEnterprise, OpenEdge ABL, OpenSCAD, Org Mode|
|P|PacmanConf, Perl, PHP, PHTML, Pig, PkgConfig, PL/pgSQL, plaintext, Plutus Core, Pony, PostgreSQL SQL dialect, PostScript, POVRay, PowerQuery, PowerShell, Prolog, PromQL, properties, Protocol Buffer, PRQL, PSL, Puppet, Python, Python 2|
|Q|QBasic, QML|
|R|R, Racket, Ragel, Raku, react, ReasonML, reg, reStructuredText, Rexx, Ruby, Rust|
|S|SAS, Sass, Scala, Scheme, Scilab, SCSS, Sed, Sieve, Smali, Smalltalk, Smarty, Snobol, Solidity, SourcePawn, SPARQL, SQL, SquidConf, Standard ML, stas, Stylus, Svelte, Swift, SYSTEMD, systemverilog|
|T|TableGen, Tal, TASM, Tcl, Tcsh, Termcap, Terminfo, Terraform, TeX, Thrift, TOML, TradingView, Transact-SQL, Turing, Turtle, Twig, TypeScript, TypoScript, TypoScriptCssData, TypoScriptHtmlData|
|V|V, V shell, Vala, VB.net, verilog, VHDL, VHS, VimL, vue|
|W|WDTE, WebGPU Shading Language, Whiley|
|X|XML, Xorg|
|Y|YAML, YANG|
|Z|Z80 Assembly, Zed, Zig|
## Missing Features
Lacks some features compared to [[Pygments]].
- Quite a few lexers, for various reasons (pull-requests welcome):
- Pygments lexers for complex languages often include custom code to handle certain aspects, such as Raku's ability to nest code inside regular expressions. These require time and effort to convert.
- I mostly only converted languages I had heard of, to reduce the porting cost.
- Some more esoteric features of Pygments are omitted for simplicity.
- Though the Chroma API supports content detection, very few languages support them. I have plans to implement a statistical analyser at some point, but not enough time.
# Tips
# References