1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-10-30 23:57:49 +02:00

68 Commits

Author SHA1 Message Date
Johan Walles
b05fcfb98f tango: Don't underline whitespace (#1146) 2025-09-22 08:05:08 +10:00
uncenter
02ff9d4820 Sync Catppuccin styles (#1111)
Follow up to https://github.com/alecthomas/chroma/pull/1094; if we
update one of the four Catppuccin flavors we should update the other
three at the same time for consistency sake.
2025-07-24 00:18:13 +10:00
ioflow
908d2a3117 sync catppuccin-mocha.xml with upstream (#1094)
pulls in latest style updates from
https://github.com/catppuccin/chroma/blob/main/dist/mocha-chroma-style.xml
2025-07-03 08:35:53 +10:00
Thomas Sayen
2c20473d3d Various lexer & style fixes for RPGLE (#1086) 2025-06-07 08:49:31 +10:00
Thomas Sayen
79dde77402 Added IBM RPG lexer (#1078)
Hi !

Here's a lexer for IBM RPG !
You can learn about this language here :
- https://en.wikipedia.org/wiki/IBM_RPG
- https://www.ibm.com/docs/en/i/7.6.0?topic=languages-rpg

For legacy purposes, the language can be written in two different forms,
the fixed format (looks like a punched card, expects specific characters
to be at certain columns in source code) and the free format (gets rid
of fixed format, and looks like modern languages as Python).
This lexer only handles the free format, I may open a pull request later
to implement the fixed format syntax.

There are some RPG repositories available on GitHub, you can search
using "language:RPGLE" to see them.

The language is old but still maintained and even continues to evolve
nowadays.
The lexer is based on the latest version at this day, RPG 7.6.

Are the MIME types in the XML files important ? I don't think this
language has one (and I didn't know there were MIME types for
programming languages), so I made one which looks like what I saw in
other lexers XML files.

And the language can have embedded SQL statements in the source code, so
I reused the SQL lexer. Please tell me if there's a better way to do it.

The language is rather tied to IBM environment, so if you're interested,
here's how to try it :
- https://pub400.com/ provides free accounts to an IBM machine to try
and discover it
-
https://www.nicklitten.com/use-a-5250-green-screen-terminal-in-visual-studio/
to get a terminal to access pub400 machine and run code
-
https://www.nicklitten.com/connecting-to-pub400-with-vs-code-for-ibm-i/
shows how to code RPG in VSCode and compile it
2025-05-12 12:00:25 +10:00
Nuc1eoN
3df29af80a styles: add proper diff styling to rrt (fix #603) (#1064)
This will **at the very least** enable proper styling of `diff` files:

Before:

![image](https://github.com/user-attachments/assets/a87a2130-7fa9-4229-a164-d6b5b74cbb79)


After:

![image](https://github.com/user-attachments/assets/3e48679a-fcb9-46d3-be61-bd3cb74f2a91)

Also added GenericStrong and GenericEmph tokens since they seem to be
universal (but were missing).

The styling has been kept true to the rrt theme.

Fixes #603
2025-04-17 08:47:25 +10:00
Konrad Reiche
ebd6894926 Update GitHub light color palette (#998)
I noticed that the current syntax highlighting generator uses an older
color palette that doesn’t reflect GitHub’s latest light theme, which
now features lighter, pastel tones for improved readability and
accessibility. I’ve updated the color scheme to match the newer colors.

I was wondering if it makes sense to adopt these changes or, if
maintaining the current color scheme is essential, whether it would be
better to publish this as a separate variant under a different name.

## Example

### Before 

![before](https://github.com/user-attachments/assets/7cb6f80b-f7c5-4071-8531-5aa7c338bcf4)

### After

![after](https://github.com/user-attachments/assets/dfb7930d-4ef5-4797-bf6c-2a35ae23d43e)
2024-09-16 10:40:14 +10:00
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