1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-05 13:05:18 +02:00

61 Commits

Author SHA1 Message Date
Avi Herman
2d94bda8a5
added the nordic theme via chroma/styles/nordic.xml (#977)
I added the "Nordic" theme from
[AlexvZyl's](https://github.com/AlexvZyl) project
[nordic.nvim](https://github.com/AlexvZyl/nordic.nvim).

All colors are cross referenced from the nordic theme and matches 95% of
syntax highlighting exactly.

Thanks!
2024-06-26 06:52:56 +10:00
robin
6f1db96235
chore(styles): add evergarden inspired style (#970) 2024-06-02 18:30:07 +10:00
cloudbridgeuy
6b7ffe10ff
chore(styles): add tokyonight inspired styles (#957)
Add [`tokyonight`](https://github.com/folke/tokyonight.nvim) based
styles.

`tokyonight-storm`

![image](https://github.com/alecthomas/chroma/assets/127410436/0a051a42-2131-4dd1-8927-35630da0529b)
`tokyonight-day`

![image](https://github.com/alecthomas/chroma/assets/127410436/bd6fcfe8-f0c0-4e0d-a53b-29fdc887712b)
`tokyonight-moon`

![image](https://github.com/alecthomas/chroma/assets/127410436/8aca5af6-86c9-4d8e-badd-539aa5399fba)
`tokyonight-night`

![image](https://github.com/alecthomas/chroma/assets/127410436/7b61d34a-e469-4f63-a7cc-fa385c1f6943)

Co-authored-by: Guzmán Monné <guzmonne@hotmail.com>
2024-04-11 10:16:00 +10:00
Aniket Teredesai
23368beae6
styles(catpuccin/gh-dark): LineHighlight grp (#911) 2024-01-07 09:23:23 +11:00
Aniket Teredesai
6ddeee28d9
update fg color to match latest primer style (#781) 2023-09-09 11:38:14 +10:00
Abe Estrada
d37de78b18
feat(styles/onedark): add diff colors (#830) 2023-08-23 07:28:31 +10:00
Aniket Teredesai
0e7ec95a1d
styles/catppuccin-*: update colors (#797) 2023-07-06 07:30:02 +10:00
Alexandru Bucur
bf8d359499 FIX: update nord theme to have a base color for NameProperty
Right now there is no value for NameProperty making .chroma .py to be empty.

Because of that there are cases in which the color is wrongly used because it's not overwritten (for eg: when trying to use a light theme as the main one, and Nord under prefers-color-scheme: dark .

This sets the color to match the one from the theme preview that is applied for the methods
2023-05-02 07:16:31 +10:00
Alexandru Bucur
f720d5a474 FIX: update nord theme to have a base color for NameOther
Right now there is no value for NameOther making .chroma .nx to be empty.

Because of that there are cases in which the color is wrongly used because it's not overwritten (for eg: when trying to use a light theme as the main one, and Nord under prefers-color-scheme: dark .

This MR sets the color to match the one from the theme preview.
2023-05-01 07:17:34 +10:00
Joe Mooring
22f3c60f3a
styles/vulcan: Fix background color (#753) 2023-02-26 10:23:55 +11:00
SerHack
94d785889c
Create Onedark theme (#704) 2022-11-13 00:11:15 -08:00
Kien Nguyen
be6230cf6e Update Rose-pine style 2022-11-03 07:41:31 +11:00
Alec Thomas
ebba7013b3 feat: add MustNewXMLStyle 2022-11-02 15:40:25 +11:00
Alec Thomas
c263f6fa19
feat: XML style definitions (#693)
Fixes #635.
2022-11-01 21:23:14 -07:00
John Olheiser
5e27ea4aaf
Update Catppuccin for all variants (#687) 2022-10-30 16:08:41 -07:00
Kien Nguyen-Tuan
9b9b245fb6
Feat: Add Rosé-Pine variants (#689) 2022-10-22 09:36:21 +11:00
jolheiser
b338844a9a add catppuccin mocha
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2022-10-15 18:51:55 +11:00
xjzi
cbe8b53db7 Add Modus Operandi (light) theme 2022-10-06 09:11:33 +11:00
xjzi
5b957aac0a Add Modus Vivendi (dark) theme 2022-10-06 09:11:33 +11:00
Hemanta Sapkota
3f86ac7554 Add Gruvbox light theme 2022-08-25 21:26:57 +10:00
Aniket Teredesai
c13ff147a3 fix(styles/github-dark): update definitions, reformat 2022-07-28 08:10:02 +10:00
Aniket Teredesai
c714e84613
add(styles/github-dark): github's dark colorscheme for chroma (#653) 2022-07-19 00:37:37 -07:00
Spence Churchill
f7893bced9 add an average rgb scheme 2022-04-20 18:16:07 +10:00
sk-rama
33fa61166f Update friendly.go
Remove italic style for chroma.LiteralStringInterpol. 
Purpose: For python it make a mistake in code style
2022-01-27 15:43:37 +11:00
Alec Thomas
cc2dd5b8ad Version 2 of Chroma
This cleans up the API in general, removing a bunch of deprecated stuff,
cleaning up circular imports, etc.

But the biggest change is switching to an optional XML format for the
regex lexer.

Having lexers defined only in Go is not ideal for a couple of reasons.
Firstly, it impedes a significant portion of contributors who use Chroma
in Hugo, but don't know Go. Secondly, it bloats the binary size of any
project that imports Chroma.

Why XML? YAML is an abomination and JSON is not human editable. XML
also compresses very well (eg. Go template lexer XML compresses from
3239 bytes to 718).

Why a new syntax format? All major existing formats rely on the
Oniguruma regex engine, which is extremely complex and for which there
is no Go port.

Why not earlier? Prior to the existence of fs.FS this was not a viable
option.

Benchmarks:

    $ hyperfine --warmup 3 \
        './chroma.master --version' \
        './chroma.xml-pre-opt --version' \
        './chroma.xml --version'
    Benchmark 1: ./chroma.master --version
      Time (mean ± σ):       5.3 ms ±   0.5 ms    [User: 3.6 ms, System: 1.4 ms]
      Range (min … max):     4.2 ms …   6.6 ms    233 runs

    Benchmark 2: ./chroma.xml-pre-opt --version
      Time (mean ± σ):      50.6 ms ±   0.5 ms    [User: 52.4 ms, System: 3.6 ms]
      Range (min … max):    49.2 ms …  51.5 ms    51 runs

    Benchmark 3: ./chroma.xml --version
      Time (mean ± σ):       6.9 ms ±   1.1 ms    [User: 5.1 ms, System: 1.5 ms]
      Range (min … max):     5.7 ms …  19.9 ms    196 runs

    Summary
      './chroma.master --version' ran
        1.30 ± 0.23 times faster than './chroma.xml --version'
        9.56 ± 0.83 times faster than './chroma.xml-pre-opt --version'

A slight increase in init time, but I think this is okay given the
increase in flexibility.

And binary size difference:

    $ du -h lexers.test*
    $ du -sh chroma*                                                                                                                                                                                                                                                                                                                                                                                                                                                             951371ms
    8.8M	chroma.master
    7.8M	chroma.xml
    7.8M	chroma.xml-pre-opt

Benchmarks:

    $ hyperfine --warmup 3 \
        './chroma.master --version' \
        './chroma.xml-pre-opt --version' \
        './chroma.xml --version'
    Benchmark 1: ./chroma.master --version
      Time (mean ± σ):       5.3 ms ±   0.5 ms    [User: 3.6 ms, System: 1.4 ms]
      Range (min … max):     4.2 ms …   6.6 ms    233 runs

    Benchmark 2: ./chroma.xml-pre-opt --version
      Time (mean ± σ):      50.6 ms ±   0.5 ms    [User: 52.4 ms, System: 3.6 ms]
      Range (min … max):    49.2 ms …  51.5 ms    51 runs

    Benchmark 3: ./chroma.xml --version
      Time (mean ± σ):       6.9 ms ±   1.1 ms    [User: 5.1 ms, System: 1.5 ms]
      Range (min … max):     5.7 ms …  19.9 ms    196 runs

    Summary
      './chroma.master --version' ran
        1.30 ± 0.23 times faster than './chroma.xml --version'
        9.56 ± 0.83 times faster than './chroma.xml-pre-opt --version'

Incompatible changes:

- (*RegexLexer).SetAnalyser: changed from func(func(text string) float32) *RegexLexer to func(func(text string) float32) Lexer
- (*TokenType).UnmarshalJSON: removed
- Lexer.AnalyseText: added
- Lexer.SetAnalyser: added
- Lexer.SetRegistry: added
- MustNewLazyLexer: removed
- MustNewLexer: changed from func(*Config, Rules) *RegexLexer to func(*Config, func() Rules) *RegexLexer
- Mutators: changed from func(...Mutator) MutatorFunc to func(...Mutator) Mutator
- NewLazyLexer: removed
- NewLexer: changed from func(*Config, Rules) (*RegexLexer, error) to func(*Config, func() Rules) (*RegexLexer, error)
- Pop: changed from func(int) MutatorFunc to func(int) Mutator
- Push: changed from func(...string) MutatorFunc to func(...string) Mutator
- TokenType.MarshalJSON: removed
- Using: changed from func(Lexer) Emitter to func(string) Emitter
- UsingByGroup: changed from func(func(string) Lexer, int, int, ...Emitter) Emitter to func(int, int, ...Emitter) Emitter
2022-01-27 15:22:00 +11:00
pu
0b2b5eec0a
Add[styles/gruvbox]: vim gruvbox theme for chroma (#592) 2022-01-14 00:18:06 +11:00
Yang Yang
3f5761f9fe Fix background color of xcode-dark style 2021-11-30 19:03:01 +11:00
Stefan van der Walt
7cefa29980
Add WitchHazel by Thea Flowers (#570)
https://witchhazel.thea.codes/
2021-11-09 19:12:41 +11:00
Dmitry Titov
02951cec42
Implement 1S:Enterprise (#545) 2021-09-04 10:20:45 +10:00
Ville Skyttä
4b989ea3b2 feat(styles/dracula): use official green and red for inserted and deleted
Green and red are the de facto colors used to represent inserted and
deleted lines. This changes the red that was already used for deleted to
use the official Dracula red, getting rid of an unofficial color, and
changes the inserted color from foreground white to green, to make
insertions stand out from headings and such.
2021-05-27 08:55:14 +10:00
Soubik Bhui
8513d9997e
Add new style - "hr" (#513) 2021-05-22 21:49:56 +10:00
Siavash Askari Nasr
2bcdf19ee2 [doom-one] Change style of NameAttribute
it was close to operator's color
2021-05-11 22:51:48 +10:00
Siavash Askari Nasr
f6d1db5fa5 Change some colors, Add a new variation 2021-05-02 17:24:08 +10:00
Siavash Askari Nasr
1231145de8 Add doom-one style 2021-05-02 17:24:08 +10:00
Daichi Hayashi
9dc3c8c529
Add new style called "xcode-dark" (#460) 2021-03-24 07:33:54 +11:00
Govind Gnanakumar
b20de6333c Create new style - "vulcan"
This is a new theme / style, inspired by Doom Emacs's One Doom Theme
2021-02-08 18:25:03 +11:00
Diego Henrique Oliveira
6e272cfd92 Introduce the Nord theme
This commit adds the Nord theme as an option. This theme is fully
documented in the official website: https://www.nordtheme.com
2020-12-06 11:05:56 +11:00
zeitchef
e3a674cca9 Add base16-snazzy style 2020-10-29 19:59:52 +11:00
toshimaru
a5a6d529d0 Use chroma.StyleEntries instead of map 2019-08-15 13:07:48 +10:00
Jos512
abbe00cecd Provide some default styles for RRT (fixes #212) (#219) 2019-01-23 18:48:27 +11:00
Alec Thomas
da5ac60d8c Add golangci-lint and fix all lint issues. 2018-12-31 22:46:59 +11:00
Kaushal Modi
371820dad6 Assign .gl class to GenericUnderline; add CSS rules for the same
'l' in gl is for under(l)ine, as the "gu" class is taken by
GenericSubheading.

- Rules for GenericUnderline are added to all the styles
- Make "Underline" style insert "text-decoration: underline" in CSS.

Fixes https://github.com/alecthomas/chroma/issues/159.
2018-08-01 17:28:52 -04:00
German Lashevich
33cc533118 New styles from solarized styles family 2018-04-21 09:03:12 +10:00
Alec Thomas
cbc3d5b9f0 Implement special name mappings for EmacsLisp.
Fixes #43.
2017-09-27 21:32:45 +10:00
Alec Thomas
bc2d6680e4 Run gofmt -s over the codebase. 2017-09-26 22:05:55 +10:00
Alec Thomas
c39abfb916 Squish the GitHub style a bit. 2017-09-26 22:05:55 +10:00
Abe Estrada
0f9e25c566 Add 'dracula' style
Converted from https://github.com/dracula/pygments
2017-09-25 21:11:21 -06:00
Alec Thomas
bdc1124369 Switch to Pygments-style CSS class names.
Add GitHub theme + CSS to style importer.
2017-09-25 21:46:25 +10:00
Alec Thomas
237eebbe1a A naive YAML lexer.
Does not try to be smart in anyway. Instead, just highlights what it
can. Used this reference: https://learnxinyminutes.com/docs/yaml/

Fixes #13.
2017-09-24 21:47:05 +10:00
Alec Thomas
d5083b3f7c Big changes to the style and colour APIs.
- Styles now use a builder system, to enforce immutability of styles.
- Corrected and cleaned up how style inheritance works.
- Added a brightening function to colours
- HTML formatter will now automatically pick line and highlight colours
  if they are not provided in the style. This is done by slightly
  darkening or lightening.

Fixes #21.
2017-09-23 22:09:46 +10:00