doc: clarify color option docs

This commit is contained in:
shadmansaleh 2021-11-11 16:12:13 +06:00
parent 3b1a367d76
commit 312343db15
2 changed files with 65 additions and 37 deletions

View File

@ -325,6 +325,8 @@ shown . On the other hand branch will be formatted with global formatter
<details> <details>
<summary><b>Global options</b></summary> <summary><b>Global options</b></summary>
#### Global options
These are `options` that are used in options table. These are `options` that are used in options table.
They set behavior of lualine. They set behavior of lualine.
@ -353,6 +355,8 @@ options = {
<details> <details>
<summary><b>General component options</b></summary> <summary><b>General component options</b></summary>
#### General options
These are options that control behavior at component level These are options that control behavior at component level
and are available for all components. and are available for all components.
@ -373,11 +377,17 @@ sections = {
-- and right will be placed in right side of component -- and right will be placed in right side of component
-- Passing empty string disables that separator -- Passing empty string disables that separator
cond = nil, -- condition function, component is loaded when function returns true cond = nil, -- condition function, component is loaded when function returns true
-- custom color for component in format -- custom color for the component in format
-- color = {fg = '#rrggbb', bg= '#rrggbb', gui='style'} -- here '|' refers to or meaning a different acceptable format for that placeholder
-- 'highlight_group_name' | {fg = '#rrggbb'|cterm_value(0-255)|'color_name(red)', bg= '#rrggbb', gui='style'}
-- Note: all other color options including themes accept like diff_color same color values
-- Example
-- color = {fg = '#ffaa88', bg = 'grey', gui='italic,bold'},
-- color = {fg = 204} -- when fg/bg is skiped they default to themes fg/bg
-- color = 'WarningMsg'
-- or highlight group -- or highlight group
-- color = "WarningMsg" -- color = "WarningMsg"
color = nil, color = nil, -- default is themes color for that section and mode
-- Type option specifies what type a component is. -- Type option specifies what type a component is.
-- When type is omitted lualine will guess it. -- When type is omitted lualine will guess it.
-- Available types [format: type_name(example)] -- Available types [format: type_name(example)]
@ -413,7 +423,7 @@ sections = {
show_filename_only = true, -- shows shortened relative path when false show_filename_only = true, -- shows shortened relative path when false
show_modified_status = true -- shows indicator then bufder is modified show_modified_status = true -- shows indicator then bufder is modified
max_length = vim.o.columns * 2 / 3, -- maximum width of buffers component max_length = vim.o.columns * 2 / 3, -- maximum width of buffers component
-- can also be a function that returns value of max_length dynamicaly -- can also be a function that returns value of max_length dynamicaly
filetype_names = { filetype_names = {
TelescopePrompt = 'Telescope', TelescopePrompt = 'Telescope',
dashboard = 'Dashboard', dashboard = 'Dashboard',
@ -422,8 +432,9 @@ sections = {
alpha = 'Alpha' alpha = 'Alpha'
}, -- shows specific buffer name for that filetype ( { `filetype` = `buffer_name`, ... } ) }, -- shows specific buffer name for that filetype ( { `filetype` = `buffer_name`, ... } )
buffers_color = { buffers_color = {
active = nil, -- color for active buffer -- Same values like general color option can be used here.
inactive = nil, -- color for inactive buffer active = 'lualine_{section}_normal', color for active buffer
inactive = 'lualine_{section}_inactive', -- color for inactive buffer
}, },
} }
} }
@ -444,12 +455,12 @@ sections = {
sources = {'nvim_lsp', 'coc'}, sources = {'nvim_lsp', 'coc'},
-- displays diagnostics from defined severity -- displays diagnostics from defined severity
sections = {'error', 'warn', 'info', 'hint'}, sections = {'error', 'warn', 'info', 'hint'},
-- all colors are in format #rrggbb
diagnostics_color = { diagnostics_color = {
error = nil, -- changes diagnostic's error color -- Same values like general color option can be used here.
warn = nil, -- changes diagnostic's warn color error = 'DiagnosticError', -- changes diagnostic's error color
info = nil, -- Changes diagnostic's info color warn = 'DiagnosticWarn', -- changes diagnostic's warn color
hint = nil, -- Changes diagnostic's hint color info = 'DiagnosticInfo', -- Changes diagnostic's info color
hint = 'DiagnosticHint', -- Changes diagnostic's hint color
} }
symbols = {error = 'E', warn = 'W', info = 'I', hint = 'H'} symbols = {error = 'E', warn = 'W', info = 'I', hint = 'H'}
colored = true, -- displays diagnostics status in color if set to true colored = true, -- displays diagnostics status in color if set to true
@ -470,9 +481,10 @@ sections = {
colored = true, -- displays diff status in color if set to true colored = true, -- displays diff status in color if set to true
-- all colors are in format #rrggbb -- all colors are in format #rrggbb
diff_color = { diff_color = {
added = nil, -- changes diff's added color -- Same values like general color option can be used here.
modified = nil, -- changes diff's modified color added = 'DiffAdd', -- changes diff's added color
removed = nil, -- changes diff's removed color modified = 'DiffChange', -- changes diff's modified color
removed = 'DiffDelete', -- changes diff's removed color you
} }
symbols = {added = '+', modified = '~', removed = '-'} -- changes diff symbols symbols = {added = '+', modified = '~', removed = '-'} -- changes diff symbols
source = nil, -- A function that works as a data source for diff. source = nil, -- A function that works as a data source for diff.
@ -539,13 +551,14 @@ sections = {
{ {
'tabs', 'tabs',
max_length = vim.o.columns / 3, -- maximum width of tabs component max_length = vim.o.columns / 3, -- maximum width of tabs component
-- can also be a function that returns value of max_length dynamicaly -- can also be a function that returns value of max_length dynamicaly
mode = 0, -- 0 shows tab_nr mode = 0, -- 0 shows tab_nr
-- 1 shows tab_name -- 1 shows tab_name
-- 2 shows tab_nr + tab_name -- 2 shows tab_nr + tab_name
tabs_color = { tabs_color = {
active = nil, -- color for active tab -- Same values like general color option can be used here.
inactive = nil, -- color for inactive tab active = 'lualine_{section}_normal', -- color for active tab
inactive = 'lualine_{section}_inactive', -- color for inactive tab
}, },
} }
} }

View File

@ -314,7 +314,9 @@ shown. On the other hand branch will be formatted with global formatter
Global options ~ Global options ~
Available options These are `options` that are used in *lualine-Global-options*
Global options These are `options` that are used in
options table. They set behavior of options table. They set behavior of
lualine. lualine.
@ -342,8 +344,12 @@ in component.
General component options ~ General component options ~
These are options that control behavior at component level and are available *lualine-General-options*
for all components.
General options These are options that control behavior
at component level and are available for
all components.
> >
sections = { sections = {
@ -362,11 +368,17 @@ for all components.
-- and right will be placed in right side of component -- and right will be placed in right side of component
-- Passing empty string disables that separator -- Passing empty string disables that separator
cond = nil, -- condition function, component is loaded when function returns true cond = nil, -- condition function, component is loaded when function returns true
-- custom color for component in format -- custom color for the component in format
-- color = {fg = '#rrggbb', bg= '#rrggbb', gui='style'} -- here '|' refers to or meaning a different acceptable format for that placeholder
-- 'highlight_group_name' | {fg = '#rrggbb'|cterm_value(0-255)|'color_name(red)', bg= '#rrggbb', gui='style'}
-- Note: all other color options including themes accept like diff_color same color values
-- Example
-- color = {fg = '#ffaa88', bg = 'grey', gui='italic,bold'},
-- color = {fg = 204} -- when fg/bg is skiped they default to themes fg/bg
-- color = 'WarningMsg'
-- or highlight group -- or highlight group
-- color = "WarningMsg" -- color = "WarningMsg"
color = nil, color = nil, -- default is themes color for that section and mode
-- Type option specifies what type a component is. -- Type option specifies what type a component is.
-- When type is omitted lualine will guess it. -- When type is omitted lualine will guess it.
-- Available types [format: type_name(example)] -- Available types [format: type_name(example)]
@ -400,7 +412,7 @@ will be.
show_filename_only = true, -- shows shortened relative path when false show_filename_only = true, -- shows shortened relative path when false
show_modified_status = true -- shows indicator then bufder is modified show_modified_status = true -- shows indicator then bufder is modified
max_length = vim.o.columns * 2 / 3, -- maximum width of buffers component max_length = vim.o.columns * 2 / 3, -- maximum width of buffers component
-- can also be a function that returns value of max_length dynamicaly -- can also be a function that returns value of max_length dynamicaly
filetype_names = { filetype_names = {
TelescopePrompt = 'Telescope', TelescopePrompt = 'Telescope',
dashboard = 'Dashboard', dashboard = 'Dashboard',
@ -409,8 +421,9 @@ will be.
alpha = 'Alpha' alpha = 'Alpha'
}, -- shows specific buffer name for that filetype ( { `filetype` = `buffer_name`, ... } ) }, -- shows specific buffer name for that filetype ( { `filetype` = `buffer_name`, ... } )
buffers_color = { buffers_color = {
active = nil, -- color for active buffer -- Same values like general color option can be used here.
inactive = nil, -- color for inactive buffer active = 'lualine_{section}_normal', color for active buffer
inactive = 'lualine_{section}_inactive', -- color for inactive buffer
}, },
} }
} }
@ -432,12 +445,12 @@ will be.
sources = {'nvim_lsp', 'coc'}, sources = {'nvim_lsp', 'coc'},
-- displays diagnostics from defined severity -- displays diagnostics from defined severity
sections = {'error', 'warn', 'info', 'hint'}, sections = {'error', 'warn', 'info', 'hint'},
-- all colors are in format #rrggbb
diagnostics_color = { diagnostics_color = {
error = nil, -- changes diagnostic's error color -- Same values like general color option can be used here.
warn = nil, -- changes diagnostic's warn color error = 'DiagnosticError', -- changes diagnostic's error color
info = nil, -- Changes diagnostic's info color warn = 'DiagnosticWarn', -- changes diagnostic's warn color
hint = nil, -- Changes diagnostic's hint color info = 'DiagnosticInfo', -- Changes diagnostic's info color
hint = 'DiagnosticHint', -- Changes diagnostic's hint color
} }
symbols = {error = 'E', warn = 'W', info = 'I', hint = 'H'} symbols = {error = 'E', warn = 'W', info = 'I', hint = 'H'}
colored = true, -- displays diagnostics status in color if set to true colored = true, -- displays diagnostics status in color if set to true
@ -459,9 +472,10 @@ will be.
colored = true, -- displays diff status in color if set to true colored = true, -- displays diff status in color if set to true
-- all colors are in format #rrggbb -- all colors are in format #rrggbb
diff_color = { diff_color = {
added = nil, -- changes diff's added color -- Same values like general color option can be used here.
modified = nil, -- changes diff's modified color added = 'DiffAdd', -- changes diff's added color
removed = nil, -- changes diff's removed color modified = 'DiffChange', -- changes diff's modified color
removed = 'DiffDelete', -- changes diff's removed color you
} }
symbols = {added = '+', modified = '~', removed = '-'} -- changes diff symbols symbols = {added = '+', modified = '~', removed = '-'} -- changes diff symbols
source = nil, -- A function that works as a data source for diff. source = nil, -- A function that works as a data source for diff.
@ -532,13 +546,14 @@ will be.
{ {
'tabs', 'tabs',
max_length = vim.o.columns / 3, -- maximum width of tabs component max_length = vim.o.columns / 3, -- maximum width of tabs component
-- can also be a function that returns value of max_length dynamicaly -- can also be a function that returns value of max_length dynamicaly
mode = 0, -- 0 shows tab_nr mode = 0, -- 0 shows tab_nr
-- 1 shows tab_name -- 1 shows tab_name
-- 2 shows tab_nr + tab_name -- 2 shows tab_nr + tab_name
tabs_color = { tabs_color = {
active = nil, -- color for active tab -- Same values like general color option can be used here.
inactive = nil, -- color for inactive tab active = 'lualine_{section}_normal', -- color for active tab
inactive = 'lualine_{section}_inactive', -- color for inactive tab
}, },
} }
} }