Unverified Commit 345cb99e authored by John Welsh's avatar John Welsh Committed by GitHub
Browse files

colorize: add $ZSH_COLORIZE_CHROMA_FORMATTER config env var (#8824)

parent 8755c5f1
...@@ -38,6 +38,14 @@ Pygments offers multiple styles. By default, the `default` style is used, but yo ...@@ -38,6 +38,14 @@ Pygments offers multiple styles. By default, the `default` style is used, but yo
ZSH_COLORIZE_STYLE="colorful" ZSH_COLORIZE_STYLE="colorful"
``` ```
### Chroma Formatter Settings
Chroma supports terminal output in 8 color, 256 color, and true-color. If you need to change the default terminal output style from the standard 8 color output, set the `ZSH_COLORIZE_CHROMA_FORMATTER` environment variable:
```
ZSH_COLORIZE_CHROMA_FORMATTER=terminal256
```
## Usage ## Usage
* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided). * `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided).
......
...@@ -46,7 +46,7 @@ colorize_cat() { ...@@ -46,7 +46,7 @@ colorize_cat() {
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
else else
chroma --style="$ZSH_COLORIZE_STYLE" chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}"
fi fi
return $? return $?
fi fi
...@@ -62,7 +62,7 @@ colorize_cat() { ...@@ -62,7 +62,7 @@ colorize_cat() {
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME" pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
fi fi
else else
chroma --style="$ZSH_COLORIZE_STYLE" "$FNAME" chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" "$FNAME"
fi fi
done done
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment