From 79f096963c75d107cd1f415666fb21a9cfd3cbd6 Mon Sep 17 00:00:00 2001 From: Jakub Bartodziej Date: Wed, 30 Jun 2021 16:24:30 +0200 Subject: 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 Co-authored-by: DrZingo --- book/src/themes.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'book') 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. -- cgit v1.2.3-70-g09d2