From 2c9281be0d10417b9cbed5e353ac8b7672e58b8f Mon Sep 17 00:00:00 2001 From: Iron_E Date: Sun, 6 Sep 2020 14:30:55 -0400 Subject: [PATCH] Add light/dark background handling to main form --- colors/highlite.vim | 52 +++++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/colors/highlite.vim b/colors/highlite.vim index 5305ff8..a30cc7a 100644 --- a/colors/highlite.vim +++ b/colors/highlite.vim @@ -59,8 +59,6 @@ lua << EOF -- This is the name of your colorscheme which will be used as per |g:colors_name|. vim.g.colors_name = 'highlite' --- This is the kind of colorscheme you are creating. Either 'light' or 'dark' -vim.o.background = 'dark' --[[ Step 3: Colors Next you will define all of the colors that you will use for the color scheme. @@ -124,10 +122,11 @@ local purple_light = {'#af60af', 63, 'magenta'} ```lua = { - bg=, -- The color used for background color, or use `NONE`, `FG` or `BG` - fg=, -- The color used for foreground color, or use `NONE`, `FG` or `BG` + bg=, -- The color for the background, `NONE`, `FG` or `BG` + fg=, -- The color for the foreground, `NONE`, `FG` or `BG` blend= -- The |highlight-blend| value, if one is desired. - -- Style can be 'bold', 'italic', and more. See |attr-list| for more information. It can also have a color, and/or multiple s. + -- Style can be 'bold', 'italic', and more. See |attr-list| for more information. + -- It can also have a color, and/or multiple s. style=|{ [, ] [color=]}) } ``` @@ -137,8 +136,10 @@ local purple_light = {'#af60af', 63, 'magenta'} ```lua = '' ``` + ____________________________________________________________________________ - Here is an example to define `SpellBad` and then link some new group `SpellWorse` to it: + Here is an example to define `SpellBad` and then link some new group + `SpellWorse` to it: ```lua SpellBad = { -- ← name of the highlight group @@ -157,7 +158,7 @@ local purple_light = {'#af60af', 63, 'magenta'} ```lua SpellBad = { -- ← name of the highlight group - bg='NONE', -- background color + bg=NONE, -- background color fg=red, -- foureground color style={ -- the style 'undercurl', -- undercurl (squiggly line) @@ -166,20 +167,39 @@ local purple_light = {'#af60af', 63, 'magenta'} } } ``` + ____________________________________________________________________________ - You can add any custom highlight group to the standard list below but you shouldn't - remove any if you want a working colorscheme. Most of them are described under - |highlight-default|, some from |group-name|, and others from common syntax groups. - Both help sections are good reads. + If you want to create a colorscheme that is responsive to the user's + 'background' setting, you can specify special `light` and `dark` keys to + define how each group should be highlighted in each case. + +```lua + SpellBad = { + bg=NONE, + dark={fg=white}, + light={fg=black}, + style={'undercurl', color=red} + } +``` + + Whenever the user changes their 'background' setting, the settings inside of + whichever key is relevant will be loaded. + ____________________________________________________________________________ + + You can add any custom highlight group to the standard list below but you + shouldn't remove any if you want a working colorscheme. Most of them are + described under |highlight-default|, some from |group-name|, and others from + common syntax groups. Both help sections are good reads. NOTE: |Replace-mode| will probably be useful here. - NOTE: /As long as you do not remove any highlight groups or colors/, you can safely - ignore any highlight groups that are `link`ed to others. + NOTE: /As long as you do not remove any highlight groups or colors/, you can + safely ignore any highlight groups that are `link`ed to others. + For example, programming languages almost exclusively link to the 1st - and 2nd sections, so as long as you define everything there you will automatically - be defining the rest of the highlights, which is one of the benefits of using - this template. + and 2nd sections, so as long as you define everything there you will + automatically be defining the rest of the highlights, which is one of + the benefits of using this template. ]] --[[ DO NOT EDIT `BG`, `FG`, or `NONE`.