Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/puttehi/chroma-styler
https://github.com/alecthomas/chroma/ style generator, viewer and dumper
https://github.com/puttehi/chroma-styler
chroma code css highlights hugo style xml
Last synced: 20 days ago
JSON representation
https://github.com/alecthomas/chroma/ style generator, viewer and dumper
- Host: GitHub
- URL: https://github.com/puttehi/chroma-styler
- Owner: puttehi
- License: mit
- Created: 2024-07-18T19:56:00.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-18T20:04:37.000Z (6 months ago)
- Last Synced: 2024-10-29T23:04:39.557Z (2 months ago)
- Topics: chroma, code, css, highlights, hugo, style, xml
- Language: Go
- Homepage:
- Size: 126 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Chroma code renderer custom style helper
Did you want to customize your [Hugo](https://gohugo.io/) blogs code highlighting outside of the pre-made themes?
Did you notice that it's hard to know what class you should be using for what language to get the desired results?
Did you find out there's a bunch of Chroma token names that map to who-knows-what CSS class names?
Did you manage to write some sort of XML already but have no idea how to map it into CSS?
Try `chroma-styler` to
- Render every supported language in a single HTML page to see what your styles look like
- (as well as getting every possible class you can even encounter in the single page)
- Dump all the Chroma XML entry->CSS class name entries
- Generate a CSS file ready to ship## Usage
### Style viewer
```sh
go run cmd/chroma-styler/main.go -viewer -css data/syntax.catppuccin-machiato.example.css
open localhost:3000 # In web browser or through xdg-open :)
```Replace the `-css` with your custom file.
### Chroma token -> CSS dumper
```sh
go run cmd/chroma-styler/main.go -dump-types
```### Chroma XML -> CSS converter
```sh
go run cmd/chroma-styler/main.go -input data/catppuccin-machiato.xml > syntax.css
```Replace `-input` with your Chroma-compatible XML file.
> If you want to get your Neovim highlights into an XML file, you can get [inspiration from my config tool](https://github.com/puttehi/nvim-puttehi-dark/tree/main?tab=readme-ov-file#chroma-xml-generator).
### Updating generated samples
Bump the submodule commit and:
```sh
go generate ./...
```Generator picks the first found sample.