aboutsummaryrefslogtreecommitdiff
path: root/book/src
diff options
context:
space:
mode:
authorJakub Bartodziej2021-06-30 14:24:30 +0000
committerGitHub2021-06-30 14:24:30 +0000
commit79f096963c75d107cd1f415666fb21a9cfd3cbd6 (patch)
tree22f117f8e6c1a16a2d22a031335ad2dc650ab0cc /book/src
parent2a92dd8d4d3acbdc55e98217260346622c95250e (diff)
Color palettes (#393)
* Enable using color palettes in theme files. * Add an example theme defined using a gruvbox color palette. * Fix clippy error. * Small style improvement. * Add documentation for the features to themes.md. * Update runtime/themes/gruvbox.toml Fix the value of purple0. Co-authored-by: DrZingo <DrZingo@users.noreply.github.com> Co-authored-by: DrZingo <DrZingo@users.noreply.github.com>
Diffstat (limited to 'book/src')
-rw-r--r--book/src/themes.md18
1 files changed, 18 insertions, 0 deletions
diff --git a/book/src/themes.md b/book/src/themes.md
index 2ece2491..d6ed78ba 100644
--- a/book/src/themes.md
+++ b/book/src/themes.md
@@ -99,3 +99,21 @@ Possible keys:
These keys match [tree-sitter scopes](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#theme). We half-follow the common scopes from [macromates language grammars](https://macromates.com/manual/en/language_grammars) with some differences.
For a given highlight produced, styling will be determined based on the longest matching theme key. So it's enough to provide function to highlight `function.macro` and `function.builtin` as well, but you can use more specific scopes to highlight specific cases differently.
+
+## Color palettes
+
+You can define a palette of named colors, and refer to them from the
+configuration values in your theme. To do this, add a table called
+`palette` to your theme file:
+
+```toml
+ui.background = "white"
+ui.text = "black"
+
+[palette]
+white = "#ffffff"
+black = "#000000"
+```
+
+Remember that the `[palette]` table includes all keys after its header,
+so you should define the palette after normal theme options.