diff runtime/doc/usr_06.txt @ 26057:92c424550367 v8.2.3562

patch 8.2.3562: cannot add color names Commit: https://github.com/vim/vim/commit/e30d10253fa634c4f60daa798d029245f4eed393 Author: Drew Vogel <dvogel@github> Date: Sun Oct 24 20:35:07 2021 +0100 patch 8.2.3562: cannot add color names Problem: Cannot add color names. Solution: Add the v:colornames dictionary. (Drew Vogel, closes https://github.com/vim/vim/issues/8761)
author Bram Moolenaar <Bram@vim.org>
date Sun, 24 Oct 2021 21:45:04 +0200
parents af69c9335223
children babd9f1dbe12
line wrap: on
line diff
--- a/runtime/doc/usr_06.txt
+++ b/runtime/doc/usr_06.txt
@@ -184,7 +184,30 @@ this command: >
 	:runtime syntax/colortest.vim
 
 You will see text in various color combinations.  You can check which ones are
-readable and look nice.
+readable and look nice. These aren't the only colors available to you though.
+You can specify #rrggbb hex colors and you can define new names for hex
+colors in |v:colornames| like so: >
+
+	let v:colornames['mine_red'] = '#aa0000'
+<
+If you are authoring a color scheme for others to use, it is important
+to define these colors only when they do not exist: >
+
+	call extend(v:colornames, {'mine_red': '#aa0000'}, 'keep')
+
+This allows users of the color scheme to override the precise definition of
+that color prior to loading your color scheme. For example, in a |.vimrc|
+file:
+
+	runtime colors/lists/css_colors.vim
+	let v:colornames['your_red'] = v:colornames['css_red']
+	colorscheme yourscheme
+
+As a color scheme author, you should be able to rely on some color names for
+GUI colors. These are defined in `colors/lists/default.vim`. All such files
+found on the |runtimepath| are loaded each time the colorscheme command is
+run. A canonical list is provided by the vim distribution, which should
+include all X11 colors (previously defined in rgb.txt).
 
 ==============================================================================
 *06.4*	With colors or without colors