refactor: applied lua-format to all files

This commit is contained in:
hoob3rt 2021-03-16 00:37:46 +01:00
parent aec3bb9195
commit b31b66fa79
50 changed files with 887 additions and 936 deletions

View File

@ -2,18 +2,14 @@ local M = {}
function M:new(args) function M:new(args)
args = args or {} args = args or {}
for index, arg in pairs(args) do for index, arg in pairs(args) do self[index] = arg end
self[index] = arg
end
setmetatable(args, self) setmetatable(args, self)
self.__index = self self.__index = self
return args return args
end end
local function close_pipe(pipe) local function close_pipe(pipe)
if pipe ~= nil and not pipe:is_closing() then if pipe ~= nil and not pipe:is_closing() then pipe:close() end
pipe:close()
end
end end
function M.close_all() function M.close_all()
@ -31,44 +27,24 @@ function M.init_options()
M.stderr = vim.loop.new_pipe(false) M.stderr = vim.loop.new_pipe(false)
options.command = table.remove(args, 1) options.command = table.remove(args, 1)
options.args = args options.args = args
options.stdio = { options.stdio = {M.stdin, M.stdout, M.stderr}
M.stdin, if M.cwd then options.cwd = M.cwd end
M.stdout, if M.env then options.env = M.env end
M.stderr if M.detach then options.detach = M.detach end
}
if M.cwd then
options.cwd = M.cwd
end
if M.env then
options.env = M.env
end
if M.detach then
options.detach = M.detach
end
return options return options
end end
function M.start() function M.start()
local options = M.init_options() local options = M.init_options()
M.handle = vim.loop.spawn(options.command, options, vim.schedule_wrap(M.stop)) M.handle = vim.loop.spawn(options.command, options, vim.schedule_wrap(M.stop))
if M.on_stdout then if M.on_stdout then M.stdout:read_start(vim.schedule_wrap(M.on_stdout)) end
M.stdout:read_start(vim.schedule_wrap(M.on_stdout)) if M.on_stderr then M.stderr:read_start(vim.schedule_wrap(M.on_stderr)) end
end
if M.on_stderr then
M.stderr:read_start(vim.schedule_wrap(M.on_stderr))
end
end end
function M.stop(code, signal) function M.stop(code, signal)
if M.on_exit then if M.on_exit then M.on_exit(code, signal) end
M.on_exit(code, signal) if M.on_stdout and M.stdout then M.stdout:read_stop() end
end if M.on_stderr and M.stderr then M.stderr:read_stop() end
if M.on_stdout and M.stdout then
M.stdout:read_stop()
end
if M.on_stderr and M.stderr then
M.stderr:read_stop()
end
M.close_all() M.close_all()
end end

View File

@ -1,10 +1,9 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local git_branch local git_branch
-- os specific path separator -- os specific path separator
local sep = package.config:sub(1,1) local sep = package.config:sub(1, 1)
-- returns full path to git directory for current directory -- returns full path to git directory for current directory
local function find_git_dir() local function find_git_dir()
@ -21,11 +20,11 @@ local function find_git_dir()
-- separate git-dir or submodule is used -- separate git-dir or submodule is used
local file = io.open(git_file) local file = io.open(git_file)
git_dir = file:read() git_dir = file:read()
git_dir = git_dir:match("gitdir: (.+)$") git_dir = git_dir:match('gitdir: (.+)$')
file:close() file:close()
-- submodule / relative file path -- submodule / relative file path
if git_dir:sub(1,1) ~= sep and not git_dir:match('^%a:.*$') then if git_dir:sub(1, 1) ~= sep and not git_dir:match('^%a:.*$') then
git_dir = git_file:match('(.*).git')..git_dir git_dir = git_file:match('(.*).git') .. git_dir
end end
end end
return git_dir return git_dir
@ -38,8 +37,11 @@ local function get_git_head(head_file)
local HEAD = f_head:read() local HEAD = f_head:read()
f_head:close() f_head:close()
local branch = HEAD:match('ref: refs/heads/(.+)$') local branch = HEAD:match('ref: refs/heads/(.+)$')
if branch then git_branch = branch if branch then
else git_branch = HEAD:sub(1,6) end git_branch = branch
else
git_branch = HEAD:sub(1, 6)
end
end end
return nil return nil
end end
@ -50,9 +52,10 @@ local function watch_head()
file_changed:stop() file_changed:stop()
local git_dir = find_git_dir() local git_dir = find_git_dir()
if #git_dir > 0 then if #git_dir > 0 then
local head_file = git_dir..sep..'HEAD' local head_file = git_dir .. sep .. 'HEAD'
get_git_head(head_file) get_git_head(head_file)
file_changed:start(head_file, {}, vim.schedule_wrap(function() file_changed:start(head_file, {}, vim.schedule_wrap(
function()
-- reset file-watch -- reset file-watch
watch_head() watch_head()
end)) end))
@ -77,9 +80,9 @@ end
watch_head() watch_head()
-- update branch state of BufEnter as different Buffer may be on different repos -- update branch state of BufEnter as different Buffer may be on different repos
vim.cmd[[autocmd BufEnter * lua require'lualine.components.branch'.lualine_branch_update()]] vim.cmd [[autocmd BufEnter * lua require'lualine.components.branch'.lualine_branch_update()]]
return { return {
init = function(options) return branch(options) end, init = function(options) return branch(options) end,
lualine_branch_update = watch_head lualine_branch_update = watch_head
} }

View File

@ -3,9 +3,11 @@
local highlight = require('lualine.highlight') local highlight = require('lualine.highlight')
local utils = require('lualine.utils.utils') local utils = require('lualine.utils.utils')
-- LuaFormatter off
local default_color_error = '#e32636' local default_color_error = '#e32636'
local default_color_warn = '#ffdf00' local default_color_warn = '#ffdf00'
local default_color_info = '#ffffff' local default_color_info = '#ffffff'
-- LuaFormatter on
local diagnostic_sources = { local diagnostic_sources = {
nvim_lsp = function() nvim_lsp = function()
@ -30,14 +32,18 @@ local diagnostic_sources = {
else else
return 0, 0, 0 return 0, 0, 0
end end
end, end
} }
local function get_diagnostics(sources) local function get_diagnostics(sources)
local result = {} local result = {}
for index, source in ipairs(sources) do for index, source in ipairs(sources) do
local error_count, warning_count, info_count = diagnostic_sources[source]() local error_count, warning_count, info_count = diagnostic_sources[source]()
result[index] = {error = error_count, warn = warning_count, info = info_count} result[index] = {
error = error_count,
warn = warning_count,
info = info_count
}
end end
return result return result
end end
@ -46,13 +52,10 @@ local function diagnostics(options)
local default_symbols = options.icons_enabled and { local default_symbols = options.icons_enabled and {
error = '', -- xf659 error = '', -- xf659
warn = '', -- xf529 warn = '', -- xf529
info = '', -- xf7fc info = '' -- xf7fc
} or { } or {error = 'E:', warn = 'W:', info = 'I:'}
error = 'E:', options.symbols = vim.tbl_extend('force', default_symbols,
warn = 'W:', options.symbols or {})
info = 'I:'
}
options.symbols = vim.tbl_extend('force', default_symbols, options.symbols or {})
if options.sources == nil then if options.sources == nil then
print('no sources for diagnostics configured') print('no sources for diagnostics configured')
return '' return ''
@ -61,21 +64,30 @@ local function diagnostics(options)
if options.colored == nil then options.colored = true end if options.colored == nil then options.colored = true end
-- apply colors -- apply colors
if not options.color_error then if not options.color_error then
options.color_error = utils.extract_highlight_colors('DiffDelete', 'foreground') or default_color_error options.color_error = utils.extract_highlight_colors('DiffDelete',
'foreground') or
default_color_error
end end
if not options.color_warn then if not options.color_warn then
options.color_warn = utils.extract_highlight_colors('DiffText', 'foreground') or default_color_warn options.color_warn =
utils.extract_highlight_colors('DiffText', 'foreground') or
default_color_warn
end end
if not options.color_info then if not options.color_info then
options.color_info = utils.extract_highlight_colors('Normal', 'foreground') or default_color_info options.color_info =
utils.extract_highlight_colors('Normal', 'foreground') or
default_color_info
end end
local highlight_groups = {} local highlight_groups = {}
local function add_highlights() local function add_highlights()
highlight_groups = { highlight_groups = {
error = highlight.create_component_highlight_group({ fg = options.color_error }, 'diagnostics_error', options), error = highlight.create_component_highlight_group(
warn = highlight.create_component_highlight_group({ fg = options.color_warn }, 'diagnostics_warn', options), {fg = options.color_error}, 'diagnostics_error', options),
info = highlight.create_component_highlight_group({ fg = options.color_info }, 'diagnostics_info', options), warn = highlight.create_component_highlight_group(
{fg = options.color_warn}, 'diagnostics_warn', options),
info = highlight.create_component_highlight_group(
{fg = options.color_info}, 'diagnostics_info', options)
} }
end end
@ -85,7 +97,7 @@ local function diagnostics(options)
end end
return function() return function()
local error_count, warning_count, info_count = 0,0,0 local error_count, warning_count, info_count = 0, 0, 0
local diagnostic_data = get_diagnostics(options.sources) local diagnostic_data = get_diagnostics(options.sources)
for _, data in pairs(diagnostic_data) do for _, data in pairs(diagnostic_data) do
error_count = error_count + data.error error_count = error_count + data.error
@ -93,11 +105,7 @@ local function diagnostics(options)
info_count = info_count + data.info info_count = info_count + data.info
end end
local result = {} local result = {}
local data = { local data = {error = error_count, warn = warning_count, info = info_count}
error = error_count,
warn = warning_count,
info = info_count,
}
if options.colored then if options.colored then
local colors = {} local colors = {}
for name, hl in pairs(highlight_groups) do for name, hl in pairs(highlight_groups) do
@ -105,13 +113,14 @@ local function diagnostics(options)
end end
for _, section in ipairs(options.sections) do for _, section in ipairs(options.sections) do
if data[section] ~= nil and data[section] > 0 then if data[section] ~= nil and data[section] > 0 then
table.insert(result, colors[section]..options.symbols[section]..data[section]) table.insert(result, colors[section] .. options.symbols[section] ..
data[section])
end end
end end
else else
for _, section in ipairs(options.sections) do for _, section in ipairs(options.sections) do
if data[section] ~= nil and data[section] > 0 then if data[section] ~= nil and data[section] > 0 then
table.insert(result,options.symbols[section]..data[section]) table.insert(result, options.symbols[section] .. data[section])
end end
end end
end end
@ -125,5 +134,5 @@ end
return { return {
init = function(options) return diagnostics(options) end, init = function(options) return diagnostics(options) end,
get_diagnostics = get_diagnostics, get_diagnostics = get_diagnostics
} }

View File

@ -1,9 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local async = require 'lualine.async'
local async = require'lualine.async' local utils = require 'lualine.utils.utils'
local utils = require'lualine.utils.utils' local highlight = require 'lualine.highlight'
local highlight = require"lualine.highlight"
-- variable to store git diff stats -- variable to store git diff stats
local git_diff = nil local git_diff = nil
@ -16,7 +15,8 @@ local function process_diff(data)
local added, removed, modified = 0, 0, 0 local added, removed, modified = 0, 0, 0
for line in vim.gsplit(data, '\n') do for line in vim.gsplit(data, '\n') do
if string.find(line, [[^@@ ]]) then if string.find(line, [[^@@ ]]) then
local tokens = vim.fn.matchlist(line, [[^@@ -\v(\d+),?(\d*) \+(\d+),?(\d*)]]) local tokens = vim.fn.matchlist(line,
[[^@@ -\v(\d+),?(\d*) \+(\d+),?(\d*)]])
local line_stats = { local line_stats = {
mod_count = tokens[3] == '' and 1 or tonumber(tokens[3]), mod_count = tokens[3] == '' and 1 or tonumber(tokens[3]),
new_count = tokens[5] == '' and 1 or tonumber(tokens[5]) new_count = tokens[5] == '' and 1 or tonumber(tokens[5])
@ -34,7 +34,7 @@ local function process_diff(data)
end end
end end
end end
git_diff = { added = added, modified = modified, removed = removed } git_diff = {added = added, modified = modified, removed = removed}
end end
-- variable to store git_diff getter async function -- variable to store git_diff getter async function
@ -45,16 +45,19 @@ local function update_git_diff_getter()
-- stop older function properly before overwritting it -- stop older function properly before overwritting it
if get_git_diff then get_git_diff:stop() end if get_git_diff then get_git_diff:stop() end
-- Donn't show git diff when current buffer doesn't have a filename -- Donn't show git diff when current buffer doesn't have a filename
if #vim.fn.expand('%') == 0 then get_git_diff = nil; git_diff=nil; return end if #vim.fn.expand('%') == 0 then
get_git_diff = async:new({ get_git_diff = nil;
cmd = string.format([[git -C %s --no-pager diff --no-color --no-ext-diff -U0 -- %s]] git_diff = nil;
,vim.fn.expand('%:h'), vim.fn.expand('%:t')), return
on_stdout = function(_, data)
if data then
diff_data = diff_data .. data
end end
get_git_diff = async:new({
cmd = string.format(
[[git -C %s --no-pager diff --no-color --no-ext-diff -U0 -- %s]],
vim.fn.expand('%:h'), vim.fn.expand('%:t')),
on_stdout = function(_, data)
if data then diff_data = diff_data .. data end
end, end,
on_stderr = function (_, data) on_stderr = function(_, data)
if data then if data then
git_diff = nil git_diff = nil
diff_data = '' diff_data = ''
@ -64,7 +67,7 @@ local function update_git_diff_getter()
if diff_data ~= '' then if diff_data ~= '' then
process_diff(diff_data) process_diff(diff_data)
else else
git_diff = { added = 0, modified = 0, removed = 0} git_diff = {added = 0, modified = 0, removed = 0}
end end
end end
}) })
@ -80,21 +83,26 @@ local function update_git_diff()
end)() end)()
end end
local default_color_added = "#f0e130" local default_color_added = '#f0e130'
local default_color_removed = "#90ee90" local default_color_removed = '#90ee90'
local default_color_modified = "#ff0038" local default_color_modified = '#ff0038'
local function diff(options) local function diff(options)
if options.colored == nil then options.colored = true end if options.colored == nil then options.colored = true end
-- apply colors -- apply colors
if not options.color_added then if not options.color_added then
options.color_added = utils.extract_highlight_colors('DiffAdd', 'guifg') or default_color_added options.color_added = utils.extract_highlight_colors('DiffAdd', 'guifg') or
default_color_added
end end
if not options.color_modified then if not options.color_modified then
options.color_modified = utils.extract_highlight_colors('DiffChange', 'guifg') or default_color_modified options.color_modified = utils.extract_highlight_colors('DiffChange',
'guifg') or
default_color_modified
end end
if not options.color_removed then if not options.color_removed then
options.color_removed = utils.extract_highlight_colors('DiffDelete', 'guifg') or default_color_removed options.color_removed =
utils.extract_highlight_colors('DiffDelete', 'guifg') or
default_color_removed
end end
local highlights = {} local highlights = {}
@ -102,9 +110,12 @@ local function diff(options)
-- create highlights and save highlight_name in highlights table -- create highlights and save highlight_name in highlights table
local function create_highlights() local function create_highlights()
highlights = { highlights = {
added = highlight.create_component_highlight_group({fg = options.color_added}, 'diff_added', options), added = highlight.create_component_highlight_group(
modified = highlight.create_component_highlight_group({fg = options.color_modified}, 'diff_modified', options), {fg = options.color_added}, 'diff_added', options),
removed = highlight.create_component_highlight_group({fg = options.color_removed}, 'diff_removed', options), modified = highlight.create_component_highlight_group(
{fg = options.color_modified}, 'diff_modified', options),
removed = highlight.create_component_highlight_group(
{fg = options.color_removed}, 'diff_removed', options)
} }
end end
@ -124,12 +135,9 @@ local function diff(options)
return function() return function()
if git_diff == nil then return '' end if git_diff == nil then return '' end
local default_symbols = { local default_symbols = {added = '+', modified = '~', removed = '-'}
added = '+', options.symbols = vim.tbl_extend('force', default_symbols,
modified = '~', options.symbols or {})
removed = '-',
}
options.symbols = vim.tbl_extend('force', default_symbols, options.symbols or {})
local colors = {} local colors = {}
if options.colored then if options.colored then
-- load the highlights and store them in colors table -- load the highlights and store them in colors table
@ -140,12 +148,13 @@ local function diff(options)
local result = {} local result = {}
-- loop though data and load available sections in result table -- loop though data and load available sections in result table
for _, name in ipairs{'added', 'modified', 'removed'} do for _, name in ipairs {'added', 'modified', 'removed'} do
if git_diff[name] and git_diff[name] > 0 then if git_diff[name] and git_diff[name] > 0 then
if options.colored then if options.colored then
table.insert(result,colors[name]..options.symbols[name]..git_diff[name]) table.insert(result,
colors[name] .. options.symbols[name] .. git_diff[name])
else else
table.insert(result,options.symbols[name]..git_diff[name]) table.insert(result, options.symbols[name] .. git_diff[name])
end end
end end
end end
@ -168,12 +177,12 @@ end
local function get_sign_count() local function get_sign_count()
update_git_diff_getter() update_git_diff_getter()
update_git_diff() update_git_diff()
return git_diff or { added = -1, modified = -1, removed = -1 } return git_diff or {added = -1, modified = -1, removed = -1}
end end
return { return {
init = function(options) return diff(options) end, init = function(options) return diff(options) end,
update_git_diff = update_git_diff, update_git_diff = update_git_diff,
update_git_diff_getter = update_git_diff_getter, update_git_diff_getter = update_git_diff_getter,
get_sign_count = get_sign_count, get_sign_count = get_sign_count
} }

View File

@ -1,6 +1,5 @@
-- Copyright (c) 2020-2021 hoob3rt -- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local function encoding() local function encoding()
local data = [[%{strlen(&fenc)?&fenc:&enc}]] local data = [[%{strlen(&fenc)?&fenc:&enc}]]
return data return data

View File

@ -1,19 +1,22 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local function fileformat(options) local function fileformat(options)
local icon_linux = "" -- e712 local icon_linux = '' -- e712
local icon_windos = "" -- e70f local icon_windos = '' -- e70f
local icon_mac = "" -- e711 local icon_mac = '' -- e711
return function() return function()
if options.icons_enabled and not options.icon then if options.icons_enabled and not options.icon then
local format = vim.bo.fileformat local format = vim.bo.fileformat
if format == 'unix' then return icon_linux if format == 'unix' then
elseif format == 'dos' then return icon_windos return icon_linux
elseif format == 'mac' then return icon_mac end elseif format == 'dos' then
return icon_windos
elseif format == 'mac' then
return icon_mac
end
end end
return vim.bo.fileformat return vim.bo.fileformat
end end
end end
return { init = function(options) return fileformat(options) end } return {init = function(options) return fileformat(options) end}

View File

@ -1,6 +1,5 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local function filename(options) local function filename(options)
-- setting defaults -- setting defaults
if options.file_status == nil then options.file_status = true end if options.file_status == nil then options.file_status = true end
@ -23,11 +22,14 @@ local function filename(options)
end end
if options.file_status then if options.file_status then
if vim.bo.modified then data = data .. "[+]" if vim.bo.modified then
elseif vim.bo.modifiable == false then data = data .. "[-]" end data = data .. '[+]'
elseif vim.bo.modifiable == false then
data = data .. '[-]'
end
end end
return data return data
end end
end end
return { init = function(options) return filename(options) end } return {init = function(options) return filename(options) end}

View File

@ -1,16 +1,15 @@
-- Copyright (c) 2020-2021 hoob3rt -- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local function filetype(options) local function filetype(options)
return function() return function()
local data = vim.bo.filetype local data = vim.bo.filetype
if #data > 0 then if #data > 0 then
local ok, devicons = pcall(require,'nvim-web-devicons') local ok, devicons = pcall(require, 'nvim-web-devicons')
if ok then if ok then
local f_name,f_extension = vim.fn.expand('%:t'),vim.fn.expand('%:e') local f_name, f_extension = vim.fn.expand('%:t'), vim.fn.expand('%:e')
options.icon = devicons.get_icon(f_name,f_extension) options.icon = devicons.get_icon(f_name, f_extension)
else else
ok = vim.fn.exists("*WebDevIconsGetFileTypeSymbol") ok = vim.fn.exists('*WebDevIconsGetFileTypeSymbol')
if ok ~= 0 then if ok ~= 0 then
options.icon = vim.fn.WebDevIconsGetFileTypeSymbol() options.icon = vim.fn.WebDevIconsGetFileTypeSymbol()
end end
@ -21,4 +20,4 @@ local function filetype(options)
end end
end end
return { init = function(options) return filetype(options) end } return {init = function(options) return filetype(options) end}

View File

@ -1,6 +1,5 @@
-- Copyright (c) 2020-2021 hoob3rt -- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local function location() local function location()
local data = [[%3l:%-2c]] local data = [[%3l:%-2c]]
return data return data

View File

@ -1,6 +1,6 @@
-- Copyright (c) 2020-2021 hoob3rt -- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- LuaFormatter off
local mode_map = { local mode_map = {
['n'] = 'NORMAL', ['n'] = 'NORMAL',
['no'] = 'O-PENDING', ['no'] = 'O-PENDING',
@ -32,6 +32,7 @@ local mode_map = {
['!'] = 'SHELL', ['!'] = 'SHELL',
['t'] = 'TERMINAL', ['t'] = 'TERMINAL',
} }
-- LuaFormatter on
local function mode() local function mode()
local mode_code = vim.api.nvim_get_mode().mode local mode_code = vim.api.nvim_get_mode().mode
if mode_map[mode_code] == nil then return mode_code end if mode_map[mode_code] == nil then return mode_code end

View File

@ -1,6 +1,5 @@
-- Copyright (c) 2020-2021 hoob3rt -- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local function progress() local function progress()
local data = [[%3P]] local data = [[%3P]]
return data return data

View File

@ -1,15 +1,11 @@
-- Copyright (c) 2020-2021 hoob3rt -- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local M = {} local M = {}
M.sections = { M.sections = {lualine_a = {'FugitiveHead'}, lualine_z = {'location'}}
lualine_a = { 'FugitiveHead' },
lualine_z = { 'location' },
}
M.inactive_sections = M.sections M.inactive_sections = M.sections
M.filetypes = { 'fugitive' } M.filetypes = {'fugitive'}
return M return M

View File

@ -1,18 +1,13 @@
-- Copyright (c) 2020-2021 hoob3rt -- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local function fzf_statusline() return 'FZF' end
local function fzf_statusline()
return 'FZF'
end
local M = {} local M = {}
M.sections = { M.sections = {lualine_a = {fzf_statusline}}
lualine_a = { fzf_statusline },
}
M.inactive_sections = M.sections M.inactive_sections = M.sections
M.filetypes = { 'fzf' } M.filetypes = {'fzf'}
return M return M

View File

@ -1,14 +1,11 @@
-- Copyright (c) 2020-2021 hoob3rt -- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local M = {} local M = {}
M.sections = { M.sections = {lualine_a = {vim.fn.getcwd}}
lualine_a = { vim.fn.getcwd },
}
M.inactive_sections = M.sections M.inactive_sections = M.sections
M.filetypes = { 'nerdtree' } M.filetypes = {'nerdtree'}
return M return M

View File

@ -1,13 +1,12 @@
-- Copyright (c) 2020-2021 hoob3rt -- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local M = {}
local M = { } local utils_colors = require 'lualine.utils.cterm_colors'
local utils_colors = require "lualine.utils.cterm_colors"
local utils = require 'lualine.utils.utils' local utils = require 'lualine.utils.utils'
local section_highlight_map = {x = 'c', y = 'b', z = 'a'} local section_highlight_map = {x = 'c', y = 'b', z = 'a'}
local function highlight (name, foreground, background, gui) local function highlight(name, foreground, background, gui)
local command = { 'highlight', name, } local command = {'highlight', name}
if foreground and foreground ~= 'none' then if foreground and foreground ~= 'none' then
table.insert(command, 'ctermfg=' .. utils_colors.get_cterm_color(foreground)) table.insert(command, 'ctermfg=' .. utils_colors.get_cterm_color(foreground))
table.insert(command, 'guifg=' .. foreground) table.insert(command, 'guifg=' .. foreground)
@ -17,8 +16,8 @@ local function highlight (name, foreground, background, gui)
table.insert(command, 'guibg=' .. background) table.insert(command, 'guibg=' .. background)
end end
if gui then if gui then
table.insert(command, 'cterm=' .. gui ) table.insert(command, 'cterm=' .. gui)
table.insert(command, 'gui=' .. gui ) table.insert(command, 'gui=' .. gui)
end end
vim.cmd(table.concat(command, ' ')) vim.cmd(table.concat(command, ' '))
utils.save_highlight(name) utils.save_highlight(name)
@ -27,8 +26,9 @@ end
function M.create_highlight_groups(theme) function M.create_highlight_groups(theme)
for mode, sections in pairs(theme) do for mode, sections in pairs(theme) do
for section, colorscheme in pairs(sections) do for section, colorscheme in pairs(sections) do
local highlight_group_name = { 'lualine', section, mode } local highlight_group_name = {'lualine', section, mode}
highlight(table.concat(highlight_group_name, '_'), colorscheme.fg, colorscheme.bg, colorscheme.gui) highlight(table.concat(highlight_group_name, '_'), colorscheme.fg,
colorscheme.bg, colorscheme.gui)
end end
end end
end end
@ -38,14 +38,15 @@ end
-- @return: (string) highlight group name with mode -- @return: (string) highlight group name with mode
local function append_mode(highlight_group) local function append_mode(highlight_group)
local mode = require('lualine.components.mode')() local mode = require('lualine.components.mode')()
if mode == 'VISUAL' or mode == 'V-BLOCK' or mode == 'V-LINE' if mode == 'VISUAL' or mode == 'V-BLOCK' or mode == 'V-LINE' or mode ==
or mode == 'SELECT' or mode == 'S-LINE' or mode == 'S-BLOCK'then 'SELECT' or mode == 'S-LINE' or mode == 'S-BLOCK' then
highlight_group = highlight_group .. '_visual' highlight_group = highlight_group .. '_visual'
elseif mode == 'REPLACE' or mode == 'V-REPLACE' then elseif mode == 'REPLACE' or mode == 'V-REPLACE' then
highlight_group = highlight_group .. '_replace' highlight_group = highlight_group .. '_replace'
elseif mode == 'INSERT' then elseif mode == 'INSERT' then
highlight_group = highlight_group .. '_insert' highlight_group = highlight_group .. '_insert'
elseif mode == 'COMMAND' or mode == 'EX' or mode == 'MORE' or mode == 'CONFIRM'then elseif mode == 'COMMAND' or mode == 'EX' or mode == 'MORE' or mode ==
'CONFIRM' then
highlight_group = highlight_group .. '_command' highlight_group = highlight_group .. '_command'
elseif mode == 'TERMINAL' then elseif mode == 'TERMINAL' then
highlight_group = highlight_group .. '_terminal' highlight_group = highlight_group .. '_terminal'
@ -65,26 +66,28 @@ end
-- @@options is parameter of component.init() function -- @@options is parameter of component.init() function
-- @return: (string) unique name that can be used by component_format_highlight -- @return: (string) unique name that can be used by component_format_highlight
-- to retrive highlight group -- to retrive highlight group
function M.create_component_highlight_group(color , highlight_tag, options) function M.create_component_highlight_group(color, highlight_tag, options)
if color.bg and color.fg then if color.bg and color.fg then
-- When bg and fg are both present we donn't need to set highlighs for -- When bg and fg are both present we donn't need to set highlighs for
-- each mode as they will surely look the same. So we can work without options -- each mode as they will surely look the same. So we can work without options
local highlight_group_name = table.concat({ 'lualine', highlight_tag, 'no_mode'}, '_') local highlight_group_name = table.concat(
{'lualine', highlight_tag, 'no_mode'}, '_')
highlight(highlight_group_name, color.fg, color.bg, color.gui) highlight(highlight_group_name, color.fg, color.bg, color.gui)
return highlight_group_name return highlight_group_name
end end
local modes = {'normal', 'insert', 'visual', 'replace', 'command', 'terminal', 'inactive'} local modes = {
'normal', 'insert', 'visual', 'replace', 'command', 'terminal', 'inactive'
}
local normal_hl local normal_hl
-- convert lualine_a -> a before setting section -- convert lualine_a -> a before setting section
local section = options.self.section:match('lualine_(.*)') local section = options.self.section:match('lualine_(.*)')
if section > 'c' then if section > 'c' then section = section_highlight_map[section] end
section = section_highlight_map[section]
end
for _, mode in ipairs(modes) do for _, mode in ipairs(modes) do
local highlight_group_name = { options.self.section, highlight_tag, mode } local highlight_group_name = {options.self.section, highlight_tag, mode}
local default_color_table = options.theme[mode] and local default_color_table = options.theme[mode] and
options.theme[mode][section] or options.theme.normal[section] options.theme[mode][section] or
options.theme.normal[section]
local bg = (color.bg or default_color_table.bg) local bg = (color.bg or default_color_table.bg)
local fg = (color.fg or default_color_table.fg) local fg = (color.fg or default_color_table.fg)
-- Check if it's same as normal mode if it is no need to create aditional highlight -- Check if it's same as normal mode if it is no need to create aditional highlight
@ -97,7 +100,7 @@ function M.create_component_highlight_group(color , highlight_tag, options)
highlight(table.concat(highlight_group_name, '_'), fg, bg, color.gui) highlight(table.concat(highlight_group_name, '_'), fg, bg, color.gui)
end end
end end
return options.self.section..'_'..highlight_tag return options.self.section .. '_' .. highlight_tag
end end
-- @description: retrieve highlight_groups for components -- @description: retrieve highlight_groups for components
@ -108,23 +111,25 @@ end
function M.component_format_highlight(highlight_name) function M.component_format_highlight(highlight_name)
local highlight_group = highlight_name local highlight_group = highlight_name
if highlight_name:find('no_mode') == #highlight_name - #'no_mode' + 1 then if highlight_name:find('no_mode') == #highlight_name - #'no_mode' + 1 then
return '%#'..highlight_group..'#' return '%#' .. highlight_group .. '#'
end end
if vim.g.statusline_winid == vim.fn.win_getid() then if vim.g.statusline_winid == vim.fn.win_getid() then
highlight_group = append_mode(highlight_group) highlight_group = append_mode(highlight_group)
else else
highlight_group = highlight_group..'_inactive' highlight_group = highlight_group .. '_inactive'
end end
if utils.highlight_exists(highlight_group)then if utils.highlight_exists(highlight_group) then
return '%#'..highlight_group..'#' return '%#' .. highlight_group .. '#'
else else
return '%#'..highlight_name..'_normal#' return '%#' .. highlight_name .. '_normal#'
end end
end end
function M.format_highlight(is_focused, highlight_group) function M.format_highlight(is_focused, highlight_group)
if highlight_group > 'lualine_c' then if highlight_group > 'lualine_c' then
highlight_group = 'lualine_' .. section_highlight_map[highlight_group:match('lualine_(.)')] highlight_group = 'lualine_' ..
section_highlight_map[highlight_group:match(
'lualine_(.)')]
end end
local highlight_name = highlight_group local highlight_name = highlight_group
if not is_focused then if not is_focused then
@ -135,7 +140,7 @@ function M.format_highlight(is_focused, highlight_group)
if utils.highlight_exists(highlight_name) then if utils.highlight_exists(highlight_name) then
return '%#' .. highlight_name .. '#' return '%#' .. highlight_name .. '#'
end end
return '%#' .. highlight_group ..'_normal#' return '%#' .. highlight_group .. '_normal#'
end end
-- @description : Provides transitional highlights for section separators. -- @description : Provides transitional highlights for section separators.
@ -144,7 +149,8 @@ end
-- @param reverse :(string) Whether it's a left separator or right separator -- @param reverse :(string) Whether it's a left separator or right separator
-- '▶️' and '◀️' needs reverse colors so this parameter needs to be set true. -- '▶️' and '◀️' needs reverse colors so this parameter needs to be set true.
-- @return: (string) formated highlight group name -- @return: (string) formated highlight group name
function M.get_transitional_highlights(left_section_data, right_section_data, reverse ) function M.get_transitional_highlights(left_section_data, right_section_data,
reverse)
local left_highlight_name, right_highlight_name local left_highlight_name, right_highlight_name
-- Grab the last highlighter of left section -- Grab the last highlighter of left section
if left_section_data then if left_section_data then
@ -160,7 +166,8 @@ function M.get_transitional_highlights(left_section_data, right_section_data, re
if right_section_data then if right_section_data then
-- using vim-regex cause lua-paterns don't have non-greedy matching -- using vim-regex cause lua-paterns don't have non-greedy matching
-- extract highlight_name from %#highlight_name#.... -- extract highlight_name from %#highlight_name#....
right_highlight_name = vim.fn.matchlist(right_section_data, [[%#\(.\{-\}\)#]])[2] right_highlight_name = vim.fn.matchlist(right_section_data,
[[%#\(.\{-\}\)#]])[2]
else else
-- When right section us unavailable default to lualine_c -- When right section us unavailable default to lualine_c
right_highlight_name = append_mode('lualine_c') right_highlight_name = append_mode('lualine_c')
@ -176,7 +183,8 @@ function M.get_transitional_highlights(left_section_data, right_section_data, re
if left_highlight_name:find('lualine_') == 1 then if left_highlight_name:find('lualine_') == 1 then
highlight_name = left_highlight_name .. '_to_' .. right_highlight_name highlight_name = left_highlight_name .. '_to_' .. right_highlight_name
else else
highlight_name = 'lualine_' .. left_highlight_name .. '_to_' .. right_highlight_name highlight_name = 'lualine_' .. left_highlight_name .. '_to_' ..
right_highlight_name
end end
if not utils.highlight_exists(highlight_name) then if not utils.highlight_exists(highlight_name) then

View File

@ -1,35 +1,34 @@
-- Copyright (c) 2020-2021 hoob3rt -- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local utils_component = require('lualine.utils.component') local utils_component = require('lualine.utils.component')
local utils = require('lualine.utils.utils') local utils = require('lualine.utils.utils')
local highlight = require('lualine.highlight') local highlight = require('lualine.highlight')
local M = { } local M = {}
M.options = { M.options = {
icons_enabled = true, icons_enabled = true,
theme = 'gruvbox', theme = 'gruvbox',
component_separators = {'', ''}, component_separators = {'', ''},
section_separators = {'', ''}, section_separators = {'', ''}
} }
M.sections = { M.sections = {
lualine_a = { 'mode' }, lualine_a = {'mode'},
lualine_b = { 'branch' }, lualine_b = {'branch'},
lualine_c = { 'filename' }, lualine_c = {'filename'},
lualine_x = { 'encoding', 'fileformat', 'filetype' }, lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = { 'progress' }, lualine_y = {'progress'},
lualine_z = { 'location' }, lualine_z = {'location'}
} }
M.inactive_sections = { M.inactive_sections = {
lualine_a = { }, lualine_a = {},
lualine_b = { }, lualine_b = {},
lualine_c = { 'filename' }, lualine_c = {'filename'},
lualine_x = { 'location' }, lualine_x = {'location'},
lualine_y = { }, lualine_y = {},
lualine_z = { } lualine_z = {}
} }
M.tabline = {} M.tabline = {}
@ -41,15 +40,14 @@ local function apply_configuration(config_table)
local function parse_sections(section_group_name) local function parse_sections(section_group_name)
if not config_table[section_group_name] then return end if not config_table[section_group_name] then return end
for section_name, section in pairs(config_table[section_group_name]) do for section_name, section in pairs(config_table[section_group_name]) do
M[section_group_name][section_name] = config_table[section_group_name][section_name] M[section_group_name][section_name] =
config_table[section_group_name][section_name]
if type(section) == 'table' then if type(section) == 'table' then
for _, component in pairs(section) do for _, component in pairs(section) do
if type(component) == 'table' and type(component[2]) == 'table' then if type(component) == 'table' and type(component[2]) == 'table' then
local options = component[2] local options = component[2]
component[2] = nil component[2] = nil
for key, val in pairs(options) do for key, val in pairs(options) do component[key] = val end
component[key] = val
end
end end
end end
end end
@ -65,18 +63,24 @@ end
local function check_single_separator() local function check_single_separator()
local compoennt_separator = M.options.component_separators local compoennt_separator = M.options.component_separators
local section_separator = M.options.section_separators local section_separator = M.options.section_separators
if M.options.component_separators ~=nil then if M.options.component_separators ~= nil then
if type(M.options.component_separators) == 'string' then if type(M.options.component_separators) == 'string' then
M.options.component_separators = {compoennt_separator, compoennt_separator} M.options.component_separators = {
compoennt_separator, compoennt_separator
}
elseif #M.options.component_separators == 1 then elseif #M.options.component_separators == 1 then
M.options.component_separators = {M.options.component_separators[1], M.options.component_separators[1]} M.options.component_separators = {
M.options.component_separators[1], M.options.component_separators[1]
}
end end
end end
if M.options.section_separators ~=nil then if M.options.section_separators ~= nil then
if type(M.options.section_separators) == 'string' then if type(M.options.section_separators) == 'string' then
M.options.section_separators = {section_separator, section_separator} M.options.section_separators = {section_separator, section_separator}
elseif #M.options.section_separators == 1 then elseif #M.options.section_separators == 1 then
M.options.section_separators = {M.options.section_separators[1], M.options.section_separators[1]} M.options.section_separators = {
M.options.section_separators[1], M.options.section_separators[1]
}
end end
end end
end end
@ -112,7 +116,11 @@ local function load_special_components(component)
local ok, return_val = pcall(vim.fn[component]) local ok, return_val = pcall(vim.fn[component])
if not ok then return '' end -- function call failed if not ok then return '' end -- function call failed
ok, return_val = pcall(tostring, return_val) ok, return_val = pcall(tostring, return_val)
if ok then return return_val else return '' end if ok then
return return_val
else
return ''
end
end end
end end
end end
@ -125,12 +133,11 @@ local function component_loader(component)
component.component_name = component[1] component.component_name = component[1]
-- apply default args -- apply default args
for opt_name, opt_val in pairs(M.options) do for opt_name, opt_val in pairs(M.options) do
if component[opt_name] == nil then if component[opt_name] == nil then component[opt_name] = opt_val end
component[opt_name] = opt_val
end
end end
-- load the component -- load the component
local ok, loaded_component = pcall(require, 'lualine.components.' .. component.component_name) local ok, loaded_component = pcall(require, 'lualine.components.' ..
component.component_name)
if not ok then if not ok then
loaded_component = load_special_components(component.component_name) loaded_component = load_special_components(component.component_name)
end end
@ -142,7 +149,8 @@ local function component_loader(component)
if component.color then if component.color then
local function update_color() local function update_color()
component.color_highlight = highlight.create_component_highlight_group( component.color_highlight = highlight.create_component_highlight_group(
component.color, component.component_name, component) component.color,
component.component_name, component)
end end
update_color() update_color()
utils.expand_set_theme(update_color) utils.expand_set_theme(update_color)
@ -181,11 +189,11 @@ end
local function lualine_set_theme() local function lualine_set_theme()
if type(M.options.theme) == 'string' then if type(M.options.theme) == 'string' then
M.options.theme = require('lualine.themes.'.. M.options.theme) M.options.theme = require('lualine.themes.' .. M.options.theme)
-- change the theme table in component so their custom -- change the theme table in component so their custom
-- highlights can reflect theme change -- highlights can reflect theme change
local function reset_component_theme(sections) local function reset_component_theme(sections)
for _, section in pairs(sections)do for _, section in pairs(sections) do
for _, component in pairs(section) do for _, component in pairs(section) do
if type(component) == 'table' then if type(component) == 'table' then
component.theme = M.options.theme component.theme = M.options.theme
@ -200,20 +208,23 @@ local function lualine_set_theme()
highlight.create_highlight_groups(M.options.theme) highlight.create_highlight_groups(M.options.theme)
end end
local function statusline(sections, is_focused) local function statusline(sections, is_focused)
local function create_status_builder() local function create_status_builder()
-- The sequence sections should maintain -- The sequence sections should maintain
local section_sequence = {'a', 'b', 'c', 'x', 'y', 'z'} local section_sequence = {'a', 'b', 'c', 'x', 'y', 'z'}
local status_builder = {} local status_builder = {}
for _, section_name in ipairs(section_sequence) do for _, section_name in ipairs(section_sequence) do
if sections['lualine_'..section_name] then if sections['lualine_' .. section_name] then
-- insert highlight+components of this section to status_builder -- insert highlight+components of this section to status_builder
local section_highlight = highlight.format_highlight(is_focused, local section_highlight = highlight.format_highlight(is_focused,
'lualine_'..section_name) 'lualine_' ..
local section_data = utils_component.draw_section(sections['lualine_'..section_name], section_highlight) section_name)
local section_data = utils_component.draw_section(
sections['lualine_' .. section_name],
section_highlight)
if #section_data > 0 then if #section_data > 0 then
table.insert(status_builder, {name = section_name, data = section_data,}) table.insert(status_builder,
{name = section_name, data = section_data})
end end
end end
end end
@ -225,24 +236,29 @@ local function statusline(sections, is_focused)
-- Actual statusline -- Actual statusline
local status = {} local status = {}
local half_passed = false local half_passed = false
for i=1,#status_builder do for i = 1, #status_builder do
-- midsection divider -- midsection divider
if not half_passed and status_builder[i].name > 'c' then if not half_passed and status_builder[i].name > 'c' then
table.insert(status, highlight.format_highlight(is_focused, 'lualine_c') .. '%=') table.insert(status,
highlight.format_highlight(is_focused, 'lualine_c') .. '%=')
half_passed = true half_passed = true
end end
-- provide section_separators when statusline is in focus -- provide section_separators when statusline is in focus
if is_focused then if is_focused then
-- component separator needs to have fg = current_section.bg -- component separator needs to have fg = current_section.bg
-- and bg = adjacent_section.bg -- and bg = adjacent_section.bg
local previous_section = status_builder[i-1] or {} local previous_section = status_builder[i - 1] or {}
local current_section = status_builder[i] local current_section = status_builder[i]
local next_section = status_builder[i+1] or {} local next_section = status_builder[i + 1] or {}
-- For 2nd half we need to show separator before section -- For 2nd half we need to show separator before section
if current_section.name > 'x' then if current_section.name > 'x' then
local transitional_highlight = highlight.get_transitional_highlights(previous_section.data, current_section.data, true) local transitional_highlight = highlight.get_transitional_highlights(
if transitional_highlight and M.options.section_separators and M.options.section_separators[2] then previous_section.data,
table.insert(status, transitional_highlight .. M.options.section_separators[2]) current_section.data, true)
if transitional_highlight and M.options.section_separators and
M.options.section_separators[2] then
table.insert(status, transitional_highlight ..
M.options.section_separators[2])
end end
end end
@ -251,9 +267,13 @@ local function statusline(sections, is_focused)
-- For 1st half we need to show separator after section -- For 1st half we need to show separator after section
if current_section.name < 'c' then if current_section.name < 'c' then
local transitional_highlight = highlight.get_transitional_highlights(current_section.data, next_section.data) local transitional_highlight = highlight.get_transitional_highlights(
if transitional_highlight and M.options.section_separators and M.options.section_separators[1] then current_section.data,
table.insert(status, transitional_highlight .. M.options.section_separators[1]) next_section.data)
if transitional_highlight and M.options.section_separators and
M.options.section_separators[1] then
table.insert(status, transitional_highlight ..
M.options.section_separators[1])
end end
end end
else -- when not in focus else -- when not in focus
@ -262,7 +282,8 @@ local function statusline(sections, is_focused)
end end
-- incase none of x,y,z was configured lets not fill whole statusline with a,b,c section -- incase none of x,y,z was configured lets not fill whole statusline with a,b,c section
if not half_passed then if not half_passed then
table.insert(status, highlight.format_highlight(is_focused,'lualine_c').."%=") table.insert(status,
highlight.format_highlight(is_focused, 'lualine_c') .. '%=')
end end
return table.concat(status) return table.concat(status)
end end
@ -286,22 +307,16 @@ local function status_dispatch()
local extension_sections = get_extension_sections() local extension_sections = get_extension_sections()
if vim.g.statusline_winid == vim.fn.win_getid() then if vim.g.statusline_winid == vim.fn.win_getid() then
local sections = extension_sections.sections local sections = extension_sections.sections
if sections == nil then if sections == nil then sections = M.sections end
sections = M.sections
end
return statusline(sections, true) return statusline(sections, true)
else else
local inactive_sections = extension_sections.inactive_sections local inactive_sections = extension_sections.inactive_sections
if inactive_sections == nil then if inactive_sections == nil then inactive_sections = M.inactive_sections end
inactive_sections = M.inactive_sections
end
return statusline(inactive_sections, false) return statusline(inactive_sections, false)
end end
end end
local function tabline() local function tabline() return statusline(M.tabline, true) end
return statusline(M.tabline, true)
end
local function setup_theme() local function setup_theme()
lualine_set_theme() lualine_set_theme()

View File

@ -1,9 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Credit itchyny, jackno (lightline) -- Credit itchyny, jackno (lightline)
local M = {} local M = {}
-- LuaFormatter off
local colors = { local colors = {
black = '#000000', black = '#000000',
maroon = '#800000', maroon = '#800000',
@ -22,29 +21,24 @@ local colors = {
aqua = '#00ffff', aqua = '#00ffff',
white = '#ffffff', white = '#ffffff',
} }
-- LuaFormatter on
M.normal = { M.normal = {
a = { fg = colors.white, bg = colors.blue , gui = 'bold', }, a = {fg = colors.white, bg = colors.blue, gui = 'bold'},
b = { fg = colors.white, bg = colors.gray , }, b = {fg = colors.white, bg = colors.gray},
c = { fg = colors.silver, bg = colors.black , } c = {fg = colors.silver, bg = colors.black}
} }
M.insert = { M.insert = {a = {fg = colors.white, bg = colors.green, gui = 'bold'}}
a = { fg = colors.white, bg = colors.green , gui = 'bold', },
}
M.visual = { M.visual = {a = {fg = colors.white, bg = colors.purple, gui = 'bold'}}
a = { fg = colors.white, bg = colors.purple , gui = 'bold', },
}
M.replace = { M.replace = {a = {fg = colors.white, bg = colors.red, gui = 'bold'}}
a = { fg = colors.white, bg = colors.red , gui = 'bold', },
}
M.inactive = { M.inactive = {
a = { fg = colors.silver, bg = colors.gray , gui = 'bold', }, a = {fg = colors.silver, bg = colors.gray, gui = 'bold'},
b = { fg = colors.gray, bg = colors.black , }, b = {fg = colors.gray, bg = colors.black},
c = { fg = colors.silver, bg = colors.black , }, c = {fg = colors.silver, bg = colors.black}
} }
return M return M

View File

@ -1,4 +1,4 @@
local utils = require'lualine.utils.utils' local utils = require 'lualine.utils.utils'
--------------- ---------------
-- Constents -- -- Constents --
@ -10,12 +10,16 @@ local brightness_modifier_parameter = 10
-- retrives color value from highlight group name in syntax_list -- retrives color value from highlight group name in syntax_list
-- first present highlight is returned -- first present highlight is returned
local function getHi( scope, syntaxlist ) local function getHi(scope, syntaxlist)
for _ , highlight_name in pairs( syntaxlist ) do for _, highlight_name in pairs(syntaxlist) do
if vim.fn.hlexists(highlight_name) ~= 0 then if vim.fn.hlexists(highlight_name) ~= 0 then
local color = utils.extract_highlight_colors(highlight_name) local color = utils.extract_highlight_colors(highlight_name)
if color.reverse then if color.reverse then
if scope == 'guibg' then scope = 'guifg' else scope = 'guibg' end if scope == 'guibg' then
scope = 'guifg'
else
scope = 'guibg'
end
end end
if color[scope] then return color[scope] end if color[scope] then return color[scope] end
end end
@ -25,11 +29,13 @@ end
-- truns #rrggbb -> { red, green, blue } -- truns #rrggbb -> { red, green, blue }
local function rgb_str2num(rgb_color_str) local function rgb_str2num(rgb_color_str)
if rgb_color_str:find('#') == 1 then rgb_color_str = rgb_color_str:sub(2, #rgb_color_str) end if rgb_color_str:find('#') == 1 then
local red = tonumber(rgb_color_str:sub(1,2), 16) rgb_color_str = rgb_color_str:sub(2, #rgb_color_str)
local green = tonumber(rgb_color_str:sub(3,4), 16) end
local blue = tonumber(rgb_color_str:sub(5,6), 16) local red = tonumber(rgb_color_str:sub(1, 2), 16)
return { red = red, green = green, blue = blue, } local green = tonumber(rgb_color_str:sub(3, 4), 16)
local blue = tonumber(rgb_color_str:sub(5, 6), 16)
return {red = red, green = green, blue = blue}
end end
-- turns { red, green, blue } -> #rrggbb -- turns { red, green, blue } -> #rrggbb
@ -85,13 +91,12 @@ local function apply_contrast(highlight)
local hightlight_bg_avg = get_color_avg(highlight.bg) local hightlight_bg_avg = get_color_avg(highlight.bg)
local contrast_threshold_config = clamp(contrast_threshold, 0, 0.5) local contrast_threshold_config = clamp(contrast_threshold, 0, 0.5)
local contranst_change_step = 5 local contranst_change_step = 5
if hightlight_bg_avg > .5 then if hightlight_bg_avg > .5 then contranst_change_step = -contranst_change_step end
contranst_change_step = -contranst_change_step
end
-- donn't waste too much time here max 25 interation should be more than enough -- donn't waste too much time here max 25 interation should be more than enough
local iteration_count = 1 local iteration_count = 1
while (math.abs(get_color_avg(highlight.fg) - hightlight_bg_avg) < contrast_threshold_config and iteration_count < 25) do while (math.abs(get_color_avg(highlight.fg) - hightlight_bg_avg) <
contrast_threshold_config and iteration_count < 25) do
highlight.fg = contrast_modifier(highlight.fg, contranst_change_step) highlight.fg = contrast_modifier(highlight.fg, contranst_change_step)
iteration_count = iteration_count + 1 iteration_count = iteration_count + 1
end end
@ -99,17 +104,16 @@ end
-- Get the colors to create theme -- Get the colors to create theme
local colors = { local colors = {
normal = getHi( 'guibg', {'PmenuSel', 'PmenuThumb', 'TabLineSel' } ), normal = getHi('guibg', {'PmenuSel', 'PmenuThumb', 'TabLineSel'}),
insert = getHi( 'guifg', {'String', 'MoreMsg' } ), insert = getHi('guifg', {'String', 'MoreMsg'}),
replace = getHi( 'guifg', {'Number', 'Type' } ), replace = getHi('guifg', {'Number', 'Type'}),
visual = getHi( 'guifg', {'Special', 'Boolean', 'Constant' } ), visual = getHi('guifg', {'Special', 'Boolean', 'Constant'}),
command = getHi( 'guifg', {'Identifier' } ), command = getHi('guifg', {'Identifier'}),
back1 = getHi( 'guibg', {'Normal', 'StatusLineNC' } ), back1 = getHi('guibg', {'Normal', 'StatusLineNC'}),
fore = getHi( 'guifg', {'Normal', 'StatusLine' } ), fore = getHi('guifg', {'Normal', 'StatusLine'}),
back2 = getHi( 'guibg', {'StatusLine' } ), back2 = getHi('guibg', {'StatusLine'})
} }
-- Change brightness of colors -- Change brightness of colors
-- darken incase of light theme lighten incase of dark theme -- darken incase of light theme lighten incase of dark theme
@ -124,30 +128,30 @@ end
-- basic theme defination -- basic theme defination
local M = { local M = {
normal = { normal = {
a = { bg = colors.normal, fg = colors.back1, gui='bold' }, a = {bg = colors.normal, fg = colors.back1, gui = 'bold'},
b = { bg = colors.back1, fg = colors.normal }, b = {bg = colors.back1, fg = colors.normal},
c = { bg = colors.back2, fg = colors.fore }, c = {bg = colors.back2, fg = colors.fore}
}, },
insert = { insert = {
a = { bg = colors.insert, fg = colors.back1, gui='bold' }, a = {bg = colors.insert, fg = colors.back1, gui = 'bold'},
b = { bg = colors.back1, fg = colors.insert }, b = {bg = colors.back1, fg = colors.insert},
c = { bg = colors.back2, fg = colors.fore }, c = {bg = colors.back2, fg = colors.fore}
}, },
replace = { replace = {
a = { bg = colors.replace, fg= colors.back1, gui='bold' }, a = {bg = colors.replace, fg = colors.back1, gui = 'bold'},
b = { bg = colors.back1, fg= colors.replace }, b = {bg = colors.back1, fg = colors.replace},
c = { bg = colors.back2, fg= colors.fore }, c = {bg = colors.back2, fg = colors.fore}
}, },
visual = { visual = {
a = { bg = colors.visual, fg= colors.back1, gui='bold' }, a = {bg = colors.visual, fg = colors.back1, gui = 'bold'},
b = { bg = colors.back1, fg= colors.visual }, b = {bg = colors.back1, fg = colors.visual},
c = { bg = colors.back2, fg= colors.fore }, c = {bg = colors.back2, fg = colors.fore}
}, },
command = { command = {
a = { bg = colors.command, fg = colors.back1, gui='bold' }, a = {bg = colors.command, fg = colors.back1, gui = 'bold'},
b = { bg = colors.back1, fg = colors.command }, b = {bg = colors.back1, fg = colors.command},
c = { bg = colors.back2, fg = colors.fore }, c = {bg = colors.back2, fg = colors.fore}
}, }
} }
M.terminal = M.command M.terminal = M.command
@ -155,9 +159,7 @@ M.inactive = M.normal
-- Apply prpper contrast so text is readable -- Apply prpper contrast so text is readable
for _, section in pairs(M) do for _, section in pairs(M) do
for _, highlight in pairs(section) do for _, highlight in pairs(section) do apply_contrast(highlight) end
apply_contrast(highlight)
end
end end
return M return M

View File

@ -2,41 +2,42 @@
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Genarated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- LuaFormatter off
local colors = { local colors = {
color2 = "#0f1419", color2 = '#0f1419',
color3 = "#ffee99", color3 = '#ffee99',
color4 = "#e6e1cf", color4 = '#e6e1cf',
color5 = "#14191f", color5 = '#14191f',
color13 = "#b8cc52", color13 = '#b8cc52',
color10 = "#36a3d9", color10 = '#36a3d9',
color8 = "#f07178", color8 = '#f07178',
color9 = "#3e4b59", color9 = '#3e4b59',
} }
-- LuaFormatter on
local ayu_dark = { local ayu_dark = {
visual = { visual = {
a = { fg = colors.color2, bg = colors.color3 , "bold", }, a = {fg = colors.color2, bg = colors.color3, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
replace = { replace = {
a = { fg = colors.color2, bg = colors.color8 , "bold", }, a = {fg = colors.color2, bg = colors.color8, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
inactive = { inactive = {
c = { fg = colors.color4, bg = colors.color2 }, c = {fg = colors.color4, bg = colors.color2},
a = { fg = colors.color4, bg = colors.color5 , "bold", }, a = {fg = colors.color4, bg = colors.color5, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
normal = { normal = {
c = { fg = colors.color9, bg = colors.color2 }, c = {fg = colors.color9, bg = colors.color2},
a = { fg = colors.color2, bg = colors.color10 , "bold", }, a = {fg = colors.color2, bg = colors.color10, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
insert = { insert = {
a = { fg = colors.color2, bg = colors.color13 , "bold", }, a = {fg = colors.color2, bg = colors.color13, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, }
} }
return ayu_dark return ayu_dark

View File

@ -2,41 +2,42 @@
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Genarated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- LuaFormatter off
local colors = { local colors = {
color2 = "#f3f3f3", color2 = '#f3f3f3',
color3 = "#A37ACC", color3 = '#A37ACC',
color4 = "#5C6773", color4 = '#5C6773',
color5 = "#d3d3d3", color5 = '#d3d3d3',
color13 = "#86B300", color13 = '#86B300',
color10 = "#59c2ff", color10 = '#59c2ff',
color8 = "#f07178", color8 = '#f07178',
color9 = "#828C99", color9 = '#828C99',
} }
-- LuaFormatter on
local ayu_light = { local ayu_light = {
visual = { visual = {
a = { fg = colors.color2, bg = colors.color3 , "bold", }, a = {fg = colors.color2, bg = colors.color3, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
replace = { replace = {
a = { fg = colors.color2, bg = colors.color8 , "bold", }, a = {fg = colors.color2, bg = colors.color8, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
inactive = { inactive = {
c = { fg = colors.color4, bg = colors.color2 }, c = {fg = colors.color4, bg = colors.color2},
a = { fg = colors.color4, bg = colors.color5 , "bold", }, a = {fg = colors.color4, bg = colors.color5, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
normal = { normal = {
c = { fg = colors.color9, bg = colors.color2 }, c = {fg = colors.color9, bg = colors.color2},
a = { fg = colors.color2, bg = colors.color10 , "bold", }, a = {fg = colors.color2, bg = colors.color10, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
insert = { insert = {
a = { fg = colors.color2, bg = colors.color13 , "bold", }, a = {fg = colors.color2, bg = colors.color13, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, }
} }
return ayu_light return ayu_light

View File

@ -2,41 +2,42 @@
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Genarated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- LuaFormatter off
local colors = { local colors = {
color2 = "#242b38", color2 = '#242b38',
color3 = "#d4bfff", color3 = '#d4bfff',
color4 = "#d9d7ce", color4 = '#d9d7ce',
color5 = "#272d38", color5 = '#272d38',
color13 = "#bbe67e", color13 = '#bbe67e',
color10 = "#59c2ff", color10 = '#59c2ff',
color8 = "#f07178", color8 = '#f07178',
color9 = "#607080", color9 = '#607080',
} }
-- LuaFormatter on
local ayu_mirage = { local ayu_mirage = {
visual = { visual = {
a = { fg = colors.color2, bg = colors.color3 , "bold", }, a = {fg = colors.color2, bg = colors.color3, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
replace = { replace = {
a = { fg = colors.color2, bg = colors.color8 , "bold", }, a = {fg = colors.color2, bg = colors.color8, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
inactive = { inactive = {
c = { fg = colors.color4, bg = colors.color2 }, c = {fg = colors.color4, bg = colors.color2},
a = { fg = colors.color4, bg = colors.color5 , "bold", }, a = {fg = colors.color4, bg = colors.color5, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
normal = { normal = {
c = { fg = colors.color9, bg = colors.color2 }, c = {fg = colors.color9, bg = colors.color2},
a = { fg = colors.color2, bg = colors.color10 , "bold", }, a = {fg = colors.color2, bg = colors.color10, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
insert = { insert = {
a = { fg = colors.color2, bg = colors.color13 , "bold", }, a = {fg = colors.color2, bg = colors.color13, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, }
} }
return ayu_mirage return ayu_mirage

View File

@ -1,45 +1,44 @@
-- Copyright (c) 2020-2021 Shatur95 -- Copyright (c) 2020-2021 Shatur95
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local codedark = {} local codedark = {}
-- LuaFormatter off
local colors = { local colors = {
gray = "#3C3C3C", gray = '#3C3C3C',
lightred = "#D16969", lightred = '#D16969',
blue = "#569CD6", blue = '#569CD6',
pink = "#C586C0", pink = '#C586C0',
black = "#262626", black = '#262626',
white = "#D4D4D4", white = '#D4D4D4',
green = "#608B4E", green = '#608B4E',
} }
-- LuaFormatter on
codedark.normal = { codedark.normal = {
b = { fg = colors.green, bg = colors.black }, b = {fg = colors.green, bg = colors.black},
a = { fg = colors.black, bg = colors.green , "bold", }, a = {fg = colors.black, bg = colors.green, 'bold'},
c = { fg = colors.white, bg = colors.black }, c = {fg = colors.white, bg = colors.black}
} }
codedark.visual = { codedark.visual = {
b = { fg = colors.pink, bg = colors.black }, b = {fg = colors.pink, bg = colors.black},
a = { fg = colors.black, bg = colors.pink , "bold", }, a = {fg = colors.black, bg = colors.pink, 'bold'}
} }
codedark.inactive = { codedark.inactive = {
b = { fg = colors.black, bg = colors.blue }, b = {fg = colors.black, bg = colors.blue},
a = { fg = colors.white, bg = colors.gray , "bold", }, a = {fg = colors.white, bg = colors.gray, 'bold'}
} }
codedark.replace = { codedark.replace = {
b = { fg = colors.lightred, bg = colors.black }, b = {fg = colors.lightred, bg = colors.black},
a = { fg = colors.black, bg = colors.lightred , "bold", }, a = {fg = colors.black, bg = colors.lightred, 'bold'},
c = { fg = colors.white, bg = colors.black }, c = {fg = colors.white, bg = colors.black}
} }
codedark.insert = { codedark.insert = {
b = { fg = colors.blue, bg = colors.black }, b = {fg = colors.blue, bg = colors.black},
a = { fg = colors.black, bg = colors.blue , "bold", }, a = {fg = colors.black, bg = colors.blue, 'bold'},
c = { fg = colors.white, bg = colors.black }, c = {fg = colors.white, bg = colors.black}
} }
return codedark return codedark

View File

@ -1,56 +1,55 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Credit itchyny, jackno (lightline) -- Credit itchyny, jackno (lightline)
local dracula = {} local dracula = {}
-- LuaFormatter off
local colors = { local colors = {
gray = "#44475a", gray = '#44475a',
lightgray = "#5f6a8e", lightgray = '#5f6a8e',
orange = "#ffb86c", orange = '#ffb86c',
purple = "#bd93f9", purple = '#bd93f9',
red = "#ff5555", red = '#ff5555',
yellow = "#f1fa8c", yellow = '#f1fa8c',
green = "#50fa7b", green = '#50fa7b',
white = "#f8f8f2", white = '#f8f8f2',
black = "#282a36", black = '#282a36',
} }
-- LuaFormatter on
dracula.normal = { dracula.normal = {
a = { bg = colors.purple, fg = colors.black, gui = 'bold', }, a = {bg = colors.purple, fg = colors.black, gui = 'bold'},
b = { bg = colors.lightgray, fg = colors.white, }, b = {bg = colors.lightgray, fg = colors.white},
c = { bg = colors.gray, fg = colors.white } c = {bg = colors.gray, fg = colors.white}
} }
dracula.insert = { dracula.insert = {
a = { bg = colors.green, fg = colors.black, gui = 'bold', }, a = {bg = colors.green, fg = colors.black, gui = 'bold'},
b = { bg = colors.lightgray, fg = colors.white, }, b = {bg = colors.lightgray, fg = colors.white},
c = { bg = colors.gray, fg = colors.white } c = {bg = colors.gray, fg = colors.white}
} }
dracula.visual = { dracula.visual = {
a = { bg = colors.yellow, fg = colors.black, gui = 'bold', }, a = {bg = colors.yellow, fg = colors.black, gui = 'bold'},
b = { bg = colors.lightgray, fg = colors.white, }, b = {bg = colors.lightgray, fg = colors.white},
c = { bg = colors.gray, fg = colors.white }, c = {bg = colors.gray, fg = colors.white}
} }
dracula.replace = { dracula.replace = {
a = { bg = colors.red, fg = colors.black, gui = 'bold', }, a = {bg = colors.red, fg = colors.black, gui = 'bold'},
b = { bg = colors.lightgray, fg = colors.white, }, b = {bg = colors.lightgray, fg = colors.white},
c = { bg = colors.gray, fg = colors.white }, c = {bg = colors.gray, fg = colors.white}
} }
dracula.command = { dracula.command = {
a = { bg = colors.orange, fg = colors.black, gui = 'bold', }, a = {bg = colors.orange, fg = colors.black, gui = 'bold'},
b = { bg = colors.lightgray, fg = colors.white, }, b = {bg = colors.lightgray, fg = colors.white},
c = { bg = colors.gray, fg = colors.white }, c = {bg = colors.gray, fg = colors.white}
} }
dracula.inactive = { dracula.inactive = {
a = { bg = colors.gray, fg = colors.white, gui = 'bold', }, a = {bg = colors.gray, fg = colors.white, gui = 'bold'},
b = { bg = colors.lightgray, fg = colors.white, }, b = {bg = colors.lightgray, fg = colors.white},
c = { bg = colors.gray, fg = colors.white }, c = {bg = colors.gray, fg = colors.white}
} }
return dracula return dracula

View File

@ -1,61 +1,61 @@
-- Copyright (c) 2020-2021 gnuyent -- Copyright (c) 2020-2021 gnuyent
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local forest_night = {} local forest_night = {}
-- LuaFormatter off
local colors = { local colors = {
bg0 = "#323d43", bg0 = '#323d43',
bg1 = "#3c474d", bg1 = '#3c474d',
bg3 = "#505a60", bg3 = '#505a60',
fg = "#d8caac", fg = '#d8caac',
aqua = "#87c095", aqua = '#87c095',
green = "#a7c080", green = '#a7c080',
orange = "#e39b7b", orange = '#e39b7b',
purple = "#d39bb6", purple = '#d39bb6',
red = "#e68183", red = '#e68183',
grey1 = "#868d80", grey1 = '#868d80',
} }
-- LuaFormatter on
forest_night.normal = { forest_night.normal = {
a = { bg = colors.green, fg = colors.bg0, gui = 'bold', }, a = {bg = colors.green, fg = colors.bg0, gui = 'bold'},
b = { bg = colors.bg3, fg = colors.fg, }, b = {bg = colors.bg3, fg = colors.fg},
c = { bg = colors.bg1, fg = colors.fg, }, c = {bg = colors.bg1, fg = colors.fg}
} }
forest_night.insert = { forest_night.insert = {
a = { bg = colors.fg, fg = colors.bg0, gui = 'bold', }, a = {bg = colors.fg, fg = colors.bg0, gui = 'bold'},
b = { bg = colors.bg3, fg = colors.fg, }, b = {bg = colors.bg3, fg = colors.fg},
c = { bg = colors.bg1, fg = colors.fg, }, c = {bg = colors.bg1, fg = colors.fg}
} }
forest_night.visual = { forest_night.visual = {
a = { bg = colors.red, fg = colors.bg0, gui = 'bold', }, a = {bg = colors.red, fg = colors.bg0, gui = 'bold'},
b = { bg = colors.bg3, fg = colors.fg, }, b = {bg = colors.bg3, fg = colors.fg},
c = { bg = colors.bg1, fg = colors.fg, }, c = {bg = colors.bg1, fg = colors.fg}
} }
forest_night.replace = { forest_night.replace = {
a = { bg = colors.orange, fg = colors.bg0, gui = 'bold', }, a = {bg = colors.orange, fg = colors.bg0, gui = 'bold'},
b = { bg = colors.bg3, fg = colors.fg, }, b = {bg = colors.bg3, fg = colors.fg},
c = { bg = colors.bg1, fg = colors.fg, }, c = {bg = colors.bg1, fg = colors.fg}
} }
forest_night.command = { forest_night.command = {
a = { bg = colors.aqua, fg = colors.bg0, gui = 'bold', }, a = {bg = colors.aqua, fg = colors.bg0, gui = 'bold'},
b = { bg = colors.bg3, fg = colors.fg, }, b = {bg = colors.bg3, fg = colors.fg},
c = { bg = colors.bg1, fg = colors.fg, }, c = {bg = colors.bg1, fg = colors.fg}
} }
forest_night.terminal = { forest_night.terminal = {
a = { bg = colors.purple, fg = colors.bg0, gui = 'bold', }, a = {bg = colors.purple, fg = colors.bg0, gui = 'bold'},
b = { bg = colors.bg3, fg = colors.fg, }, b = {bg = colors.bg3, fg = colors.fg},
c = { bg = colors.bg1, fg = colors.fg, }, c = {bg = colors.bg1, fg = colors.fg}
} }
forest_night.inactive = { forest_night.inactive = {
a = { bg = colors.bg1, fg = colors.grey1, gui = 'bold', }, a = {bg = colors.bg1, fg = colors.grey1, gui = 'bold'},
b = { bg = colors.bg1, fg = colors.grey1, }, b = {bg = colors.bg1, fg = colors.grey1},
c = { bg = colors.bg1, fg = colors.grey1, }, c = {bg = colors.bg1, fg = colors.grey1}
} }
return forest_night return forest_night

View File

@ -1,10 +1,9 @@
-- Copyright (c) 2020-2021 hoob3rt -- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local gruvbox = {} local gruvbox = {}
-- LuaFormatter off
local colors = { local colors = {
black = "#282828", black = '#282828',
white = '#ebdbb2', white = '#ebdbb2',
red = '#fb4934', red = '#fb4934',
green = '#b8bb26', green = '#b8bb26',
@ -15,42 +14,42 @@ local colors = {
lightgray = '#504945', lightgray = '#504945',
inactivegray = '#7c6f64', inactivegray = '#7c6f64',
} }
-- LuaFormatter on
gruvbox.normal = { gruvbox.normal = {
a = { bg = colors.gray, fg = colors.black, gui = 'bold', }, a = {bg = colors.gray, fg = colors.black, gui = 'bold'},
b = { bg = colors.lightgray, fg = colors.white, }, b = {bg = colors.lightgray, fg = colors.white},
c = { bg = colors.darkgray, fg = colors.gray } c = {bg = colors.darkgray, fg = colors.gray}
} }
gruvbox.insert = { gruvbox.insert = {
a = { bg = colors.blue, fg = colors.black, gui = 'bold', }, a = {bg = colors.blue, fg = colors.black, gui = 'bold'},
b = { bg = colors.lightgray, fg = colors.white, }, b = {bg = colors.lightgray, fg = colors.white},
c = { bg = colors.lightgray, fg = colors.white } c = {bg = colors.lightgray, fg = colors.white}
} }
gruvbox.visual = { gruvbox.visual = {
a = { bg = colors.yellow, fg = colors.black, gui = 'bold', }, a = {bg = colors.yellow, fg = colors.black, gui = 'bold'},
b = { bg = colors.lightgray, fg = colors.white, }, b = {bg = colors.lightgray, fg = colors.white},
c = { bg = colors.inactivegray, fg = colors.black }, c = {bg = colors.inactivegray, fg = colors.black}
} }
gruvbox.replace = { gruvbox.replace = {
a = { bg = colors.red, fg = colors.black, gui = 'bold', }, a = {bg = colors.red, fg = colors.black, gui = 'bold'},
b = { bg = colors.lightgray, fg = colors.white, }, b = {bg = colors.lightgray, fg = colors.white},
c = { bg = colors.black, fg = colors.white }, c = {bg = colors.black, fg = colors.white}
} }
gruvbox.command = { gruvbox.command = {
a = { bg = colors.green, fg = colors.black, gui = 'bold', }, a = {bg = colors.green, fg = colors.black, gui = 'bold'},
b = { bg = colors.lightgray, fg = colors.white, }, b = {bg = colors.lightgray, fg = colors.white},
c = { bg = colors.inactivegray, fg = colors.black }, c = {bg = colors.inactivegray, fg = colors.black}
} }
gruvbox.inactive = { gruvbox.inactive = {
a = { bg = colors.darkgray, fg = colors.gray, gui = 'bold', }, a = {bg = colors.darkgray, fg = colors.gray, gui = 'bold'},
b = { bg = colors.darkgray, fg = colors.gray, }, b = {bg = colors.darkgray, fg = colors.gray},
c = { bg = colors.darkgray, fg = colors.gray }, c = {bg = colors.darkgray, fg = colors.gray}
} }
return gruvbox return gruvbox

View File

@ -1,42 +1,31 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- LuaFormatter off
local colors = { local colors = {
fg1 = "#282828", fg1 = '#282828',
color2 = "#504945", color2 = '#504945',
fg2 = "#ddc7a1", fg2 = '#ddc7a1',
color3 = "#32302f", color3 = '#32302f',
color4 = "#a89984", color4 = '#a89984',
color5 = "#7daea3", color5 = '#7daea3',
color6 = "#a9b665", color6 = '#a9b665',
color7 = "#d8a657", color7 = '#d8a657',
color8 = "#d3869b", color8 = '#d3869b',
color9 = "#ea6962", color9 = '#ea6962',
} }
-- LuaFormatter on
local M = { local M = {
normal = { normal = {
a = { fg = colors.fg1, bg = colors.color4, "bold" }, a = {fg = colors.fg1, bg = colors.color4, 'bold'},
b = { fg = colors.fg2, bg = colors.color2, }, b = {fg = colors.fg2, bg = colors.color2},
c = { fg = colors.fg2, bg = colors.color3, }, c = {fg = colors.fg2, bg = colors.color3}
},
command = {
a = { fg = colors.fg1, bg = colors.color5, "bold" },
},
inactive = {
a = { fg = colors.fg2, bg = colors.color2, },
},
insert = {
a = { fg = colors.fg1, bg = colors.color6, "bold" },
},
replace = {
a = { fg = colors.fg1, bg = colors.color7, "bold" },
},
terminal = {
a = { fg = colors.fg1, bg = colors.color8, "bold" },
},
visual = {
a = { fg = colors.fg1, bg = colors.color9, "bold" },
}, },
command = {a = {fg = colors.fg1, bg = colors.color5, 'bold'}},
inactive = {a = {fg = colors.fg2, bg = colors.color2}},
insert = {a = {fg = colors.fg1, bg = colors.color6, 'bold'}},
replace = {a = {fg = colors.fg1, bg = colors.color7, 'bold'}},
terminal = {a = {fg = colors.fg1, bg = colors.color8, 'bold'}},
visual = {a = {fg = colors.fg1, bg = colors.color9, 'bold'}}
} }
return M return M

View File

@ -2,43 +2,44 @@
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Genarated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- LuaFormatter off
local colors = { local colors = {
color2 = "#161821", color2 = '#161821',
color3 = "#b4be82", color3 = '#b4be82',
color4 = "#6b7089", color4 = '#6b7089',
color5 = "#2e313f", color5 = '#2e313f',
color8 = "#e2a478", color8 = '#e2a478',
color9 = "#3e445e", color9 = '#3e445e',
color10 = "#0f1117", color10 = '#0f1117',
color11 = "#17171b", color11 = '#17171b',
color12 = "#818596", color12 = '#818596',
color15 = "#84a0c6", color15 = '#84a0c6',
} }
-- LuaFormatter on
local iceberg = { local iceberg = {
visual = { visual = {
a = { fg = colors.color2, bg = colors.color3 , "bold", }, a = {fg = colors.color2, bg = colors.color3, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
replace = { replace = {
a = { fg = colors.color2, bg = colors.color8 , "bold", }, a = {fg = colors.color2, bg = colors.color8, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
inactive = { inactive = {
c = { fg = colors.color9, bg = colors.color10 }, c = {fg = colors.color9, bg = colors.color10},
a = { fg = colors.color9, bg = colors.color10 , "bold", }, a = {fg = colors.color9, bg = colors.color10, 'bold'},
b = { fg = colors.color9, bg = colors.color10 }, b = {fg = colors.color9, bg = colors.color10}
}, },
normal = { normal = {
c = { fg = colors.color9, bg = colors.color10 }, c = {fg = colors.color9, bg = colors.color10},
a = { fg = colors.color11, bg = colors.color12 , "bold", }, a = {fg = colors.color11, bg = colors.color12, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
insert = { insert = {
a = { fg = colors.color2, bg = colors.color15 , "bold", }, a = {fg = colors.color2, bg = colors.color15, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, }
} }
return iceberg return iceberg

View File

@ -2,41 +2,42 @@
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Genarated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- LuaFormatter off
local colors = { local colors = {
color5 = "#668e3d", color5 = '#668e3d',
color8 = "#757ca3", color8 = '#757ca3',
color9 = "#8b98b6", color9 = '#8b98b6',
color10 = "#cad0de", color10 = '#cad0de',
color11 = "#2d539e", color11 = '#2d539e',
color0 = "#e8e9ec", color0 = '#e8e9ec',
color1 = "#9fa6c0", color1 = '#9fa6c0',
color2 = "#c57339", color2 = '#c57339',
} }
-- LuaFormatter on
local iceberg = { local iceberg = {
replace = { replace = {
b = { fg = colors.color0, bg = colors.color1 }, b = {fg = colors.color0, bg = colors.color1},
a = { fg = colors.color0, bg = colors.color2 , "bold", }, a = {fg = colors.color0, bg = colors.color2, 'bold'}
}, },
visual = { visual = {
b = { fg = colors.color0, bg = colors.color1 }, b = {fg = colors.color0, bg = colors.color1},
a = { fg = colors.color0, bg = colors.color5 , "bold", }, a = {fg = colors.color0, bg = colors.color5, 'bold'}
}, },
normal = { normal = {
b = { fg = colors.color0, bg = colors.color1 }, b = {fg = colors.color0, bg = colors.color1},
a = { fg = colors.color0, bg = colors.color8 , "bold", }, a = {fg = colors.color0, bg = colors.color8, 'bold'},
c = { fg = colors.color9, bg = colors.color10 }, c = {fg = colors.color9, bg = colors.color10}
}, },
inactive = { inactive = {
b = { fg = colors.color9, bg = colors.color10 }, b = {fg = colors.color9, bg = colors.color10},
a = { fg = colors.color9, bg = colors.color10 , "bold", }, a = {fg = colors.color9, bg = colors.color10, 'bold'},
c = { fg = colors.color9, bg = colors.color10 }, c = {fg = colors.color9, bg = colors.color10}
}, },
insert = { insert = {
b = { fg = colors.color0, bg = colors.color1 }, b = {fg = colors.color0, bg = colors.color1},
a = { fg = colors.color0, bg = colors.color11 , "bold", }, a = {fg = colors.color0, bg = colors.color11, 'bold'}
}, }
} }
return iceberg return iceberg

View File

@ -2,42 +2,43 @@
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Genarated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- LuaFormatter off
local colors = { local colors = {
color2 = "#30302c", color2 = '#30302c',
color3 = "#f0a0c0", color3 = '#f0a0c0',
color4 = "#e8e8d3", color4 = '#e8e8d3',
color5 = "#4e4e43", color5 = '#4e4e43',
color8 = "#cf6a4c", color8 = '#cf6a4c',
color9 = "#666656", color9 = '#666656',
color10 = "#808070", color10 = '#808070',
color11 = "#8197bf", color11 = '#8197bf',
color14 = "#99ad6a", color14 = '#99ad6a',
} }
-- LuaFormatter on
local jellybeans = { local jellybeans = {
visual = { visual = {
a = { fg = colors.color2, bg = colors.color3 , "bold", }, a = {fg = colors.color2, bg = colors.color3, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
replace = { replace = {
a = { fg = colors.color2, bg = colors.color8 , "bold", }, a = {fg = colors.color2, bg = colors.color8, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
inactive = { inactive = {
c = { fg = colors.color9, bg = colors.color2 }, c = {fg = colors.color9, bg = colors.color2},
a = { fg = colors.color10, bg = colors.color2 , "bold", }, a = {fg = colors.color10, bg = colors.color2, 'bold'},
b = { fg = colors.color9, bg = colors.color2 }, b = {fg = colors.color9, bg = colors.color2}
}, },
normal = { normal = {
c = { fg = colors.color10, bg = colors.color2 }, c = {fg = colors.color10, bg = colors.color2},
a = { fg = colors.color2, bg = colors.color11 , "bold", }, a = {fg = colors.color2, bg = colors.color11, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, },
insert = { insert = {
a = { fg = colors.color2, bg = colors.color14 , "bold", }, a = {fg = colors.color2, bg = colors.color14, 'bold'},
b = { fg = colors.color4, bg = colors.color5 }, b = {fg = colors.color4, bg = colors.color5}
}, }
} }
return jellybeans return jellybeans

View File

@ -1,9 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Credit: Lokesh Krishna(lightline) -- Credit: Lokesh Krishna(lightline)
local M = {} local M = {}
-- LuaFormatter off
local colors = { local colors = {
fg = '#eeffff', fg = '#eeffff',
bg = '#263238', bg = '#263238',
@ -17,32 +16,33 @@ local colors = {
gray2 = '#2E3C43', gray2 = '#2E3C43',
gray3 = '#515559', gray3 = '#515559',
} }
-- LuaFormatter on
M.normal = { M.normal = {
a = { fg = colors.bg, bg = colors.blue , gui = 'bold', }, a = {fg = colors.bg, bg = colors.blue, gui = 'bold'},
b = { fg = colors.fg, bg = colors.gray3 , }, b = {fg = colors.fg, bg = colors.gray3},
c = { fg = colors.fg, bg = colors.gray2 , } c = {fg = colors.fg, bg = colors.gray2}
} }
M.insert = { M.insert = {
a = { fg = colors.bg, bg = colors.green, 'bold' , gui = 'bold', }, a = {fg = colors.bg, bg = colors.green, 'bold', gui = 'bold'},
b = { fg = colors.fg, bg = colors.gray3 , }, b = {fg = colors.fg, bg = colors.gray3}
} }
M.visual = { M.visual = {
a = { fg = colors.bg, bg = colors.purple, 'bold' , gui = 'bold', }, a = {fg = colors.bg, bg = colors.purple, 'bold', gui = 'bold'},
b = { fg = colors.fg, bg = colors.gray3 , }, b = {fg = colors.fg, bg = colors.gray3}
} }
M.replace = { M.replace = {
a = { fg = colors.bg, bg = colors.red1 , gui = 'bold', }, a = {fg = colors.bg, bg = colors.red1, gui = 'bold'},
b = { fg = colors.fg, bg = colors.gray3 , }, b = {fg = colors.fg, bg = colors.gray3}
} }
M.inactive = { M.inactive = {
a = { fg = colors.fg, bg = colors.bg , gui = 'bold', }, a = {fg = colors.fg, bg = colors.bg, gui = 'bold'},
b = { fg = colors.fg, bg = colors.bg , }, b = {fg = colors.fg, bg = colors.bg},
c = { fg = colors.fg, bg = colors.gray2 , }, c = {fg = colors.fg, bg = colors.gray2}
} }
return M return M

View File

@ -1,9 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Credit: challsted(lightline) -- Credit: challsted(lightline)
local molokai = {} local molokai = {}
-- LuaFormatter off
local colors = { local colors = {
black = '#232526', black = '#232526',
gray = '#808080', gray = '#808080',
@ -15,29 +14,24 @@ local colors = {
red = '#ff0000', red = '#ff0000',
yellow = '#e6db74', yellow = '#e6db74',
} }
-- LuaFormatter on
molokai.normal = { molokai.normal = {
a = { fg = colors.black, bg = colors.cyan , gui = 'bold', }, a = {fg = colors.black, bg = colors.cyan, gui = 'bold'},
b = { fg = colors.black, bg = colors.pink , }, b = {fg = colors.black, bg = colors.pink},
c = { fg = colors.orange, bg = colors.black , } c = {fg = colors.orange, bg = colors.black}
} }
molokai.insert = { molokai.insert = {a = {fg = colors.black, bg = colors.green, gui = 'bold'}}
a = { fg = colors.black, bg = colors.green , gui = 'bold', },
}
molokai.visual = { molokai.visual = {a = {fg = colors.black, bg = colors.yellow, gui = 'bold'}}
a = { fg = colors.black, bg = colors.yellow , gui = 'bold', },
}
molokai.replace = { molokai.replace = {a = {fg = colors.black, bg = colors.red, gui = 'bold'}}
a = { fg = colors.black, bg = colors.red , gui = 'bold', },
}
molokai.inactive = { molokai.inactive = {
a = { fg = colors.pink, bg = colors.black , gui = 'bold', }, a = {fg = colors.pink, bg = colors.black, gui = 'bold'},
b = { fg = colors.white, bg = colors.pink , }, b = {fg = colors.white, bg = colors.pink},
c = { fg = colors.gray, bg = colors.black , }, c = {fg = colors.gray, bg = colors.black}
} }
return molokai return molokai

View File

@ -1,39 +1,40 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- LuaFormatter off
local colors = { local colors = {
color3 = "#2c3043", color3 = '#2c3043',
color6 = "#a1aab8", color6 = '#a1aab8',
color7 = "#82aaff", color7 = '#82aaff',
color8 = "#ae81ff", color8 = '#ae81ff',
color0 = "#092236", color0 = '#092236',
color1 = "#ff5874", color1 = '#ff5874',
color2 = "#c3ccdc", color2 = '#c3ccdc',
} }
-- LuaFormatter on
local nightfly = { local nightfly = {
replace = { replace = {
a = { fg = colors.color0, bg = colors.color1 , "bold", }, a = {fg = colors.color0, bg = colors.color1, 'bold'},
b = { fg = colors.color2, bg = colors.color3 }, b = {fg = colors.color2, bg = colors.color3}
}, },
inactive = { inactive = {
a = { fg = colors.color6, bg = colors.color3 , "bold", }, a = {fg = colors.color6, bg = colors.color3, 'bold'},
b = { fg = colors.color6, bg = colors.color3 }, b = {fg = colors.color6, bg = colors.color3},
c = { fg = colors.color6, bg = colors.color3 }, c = {fg = colors.color6, bg = colors.color3}
}, },
normal = { normal = {
a = { fg = colors.color0, bg = colors.color7 , "bold", }, a = {fg = colors.color0, bg = colors.color7, 'bold'},
b = { fg = colors.color2, bg = colors.color3 }, b = {fg = colors.color2, bg = colors.color3},
c = { fg = colors.color2, bg = colors.color3 }, c = {fg = colors.color2, bg = colors.color3}
}, },
visual = { visual = {
a = { fg = colors.color0, bg = colors.color8 , "bold", }, a = {fg = colors.color0, bg = colors.color8, 'bold'},
b = { fg = colors.color2, bg = colors.color3 }, b = {fg = colors.color2, bg = colors.color3}
}, },
insert = { insert = {
a = { fg = colors.color0, bg = colors.color2 , "bold", }, a = {fg = colors.color0, bg = colors.color2, 'bold'},
b = { fg = colors.color2, bg = colors.color3 }, b = {fg = colors.color2, bg = colors.color3}
}, }
} }
return nightfly return nightfly

View File

@ -1,40 +1,34 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local nord = {} local nord = {}
-- LuaFormatter off
local colors = { local colors = {
nord1 = "#3B4252", nord1 = '#3B4252',
nord3 = "#4C566A", nord3 = '#4C566A',
nord5 = "#E5E9F0", nord5 = '#E5E9F0',
nord6 = "#ECEFF4", nord6 = '#ECEFF4',
nord7 = "#8FBCBB", nord7 = '#8FBCBB',
nord8 = "#88C0D0", nord8 = '#88C0D0',
nord13 = "#EBCB8B", nord13 = '#EBCB8B',
} }
-- LuaFormatter on
nord.normal = { nord.normal = {
a = { fg = colors.nord1, bg = colors.nord8, gui = 'bold', }, a = {fg = colors.nord1, bg = colors.nord8, gui = 'bold'},
b = { fg = colors.nord5, bg = colors.nord1, }, b = {fg = colors.nord5, bg = colors.nord1},
c = { fg = colors.nord5, bg = colors.nord3, } c = {fg = colors.nord5, bg = colors.nord3}
} }
nord.insert = { nord.insert = {a = {fg = colors.nord1, bg = colors.nord6, gui = 'bold'}}
a = { fg = colors.nord1, bg = colors.nord6, gui = 'bold', },
}
nord.visual = { nord.visual = {a = {fg = colors.nord1, bg = colors.nord7, gui = 'bold'}}
a = { fg = colors.nord1, bg = colors.nord7, gui = 'bold', },
}
nord.replace = { nord.replace = {a = {fg = colors.nord1, bg = colors.nord13, gui = 'bold'}}
a = { fg = colors.nord1, bg = colors.nord13, gui = 'bold', },
}
nord.inactive = { nord.inactive = {
a = { fg = colors.nord1, bg = colors.nord8, gui = 'bold', }, a = {fg = colors.nord1, bg = colors.nord8, gui = 'bold'},
b = { fg = colors.nord5, bg = colors.nord1, }, b = {fg = colors.nord5, bg = colors.nord1},
c = { fg = colors.nord5, bg = colors.nord1, }, c = {fg = colors.nord5, bg = colors.nord1}
} }
return nord return nord

View File

@ -2,44 +2,45 @@
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Genarated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- LuaFormatter off
local colors = { local colors = {
color0 = "#ffffff", color0 = '#ffffff',
color1 = "#99c794", color1 = '#99c794',
color2 = "#65737e", color2 = '#65737e',
color3 = "#343d46", color3 = '#343d46',
color4 = "#6699cc", color4 = '#6699cc',
color5 = "#d8dee9", color5 = '#d8dee9',
color6 = "#f99157", color6 = '#f99157',
color7 = "#ec5f67", color7 = '#ec5f67',
} }
-- LuaFormatter on
local oceanicnext = { local oceanicnext = {
insert = { insert = {
a = { fg = colors.color0, bg = colors.color1 , "bold", }, a = {fg = colors.color0, bg = colors.color1, 'bold'},
b = { fg = colors.color0, bg = colors.color2 }, b = {fg = colors.color0, bg = colors.color2},
c = { fg = colors.color0, bg = colors.color3 }, c = {fg = colors.color0, bg = colors.color3}
}, },
normal = { normal = {
a = { fg = colors.color0, bg = colors.color4 , "bold", }, a = {fg = colors.color0, bg = colors.color4, 'bold'},
b = { fg = colors.color0, bg = colors.color2 }, b = {fg = colors.color0, bg = colors.color2},
c = { fg = colors.color0, bg = colors.color3 }, c = {fg = colors.color0, bg = colors.color3}
}, },
inactive = { inactive = {
a = { fg = colors.color5, bg = colors.color2 , "bold", }, a = {fg = colors.color5, bg = colors.color2, 'bold'},
b = { fg = colors.color5, bg = colors.color3 }, b = {fg = colors.color5, bg = colors.color3},
c = { fg = colors.color2, bg = colors.color3 }, c = {fg = colors.color2, bg = colors.color3}
}, },
visual = { visual = {
a = { fg = colors.color0, bg = colors.color6 , "bold", }, a = {fg = colors.color0, bg = colors.color6, 'bold'},
b = { fg = colors.color0, bg = colors.color2 }, b = {fg = colors.color0, bg = colors.color2},
c = { fg = colors.color0, bg = colors.color3 }, c = {fg = colors.color0, bg = colors.color3}
}, },
replace = { replace = {
a = { fg = colors.color0, bg = colors.color7 , "bold", }, a = {fg = colors.color0, bg = colors.color7, 'bold'},
b = { fg = colors.color0, bg = colors.color2 }, b = {fg = colors.color0, bg = colors.color2},
c = { fg = colors.color0, bg = colors.color3 }, c = {fg = colors.color0, bg = colors.color3}
}, }
} }
return oceanicnext return oceanicnext

View File

@ -1,9 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Credit: Zoltan Dalmadi(lightline) -- Credit: Zoltan Dalmadi(lightline)
local M = {} local M = {}
-- LuaFormatter off
local colors = { local colors = {
blue = '#61afef', blue = '#61afef',
green = '#98c379', green = '#98c379',
@ -17,29 +16,24 @@ local colors = {
gray2 = '#2c323d', gray2 = '#2c323d',
gray3 = '#3e4452', gray3 = '#3e4452',
} }
-- LuaFormatter on
M.normal = { M.normal = {
a = { fg = colors.bg, bg = colors.green , gui = 'bold', }, a = {fg = colors.bg, bg = colors.green, gui = 'bold'},
b = { fg = colors.fg, bg = colors.gray3 , }, b = {fg = colors.fg, bg = colors.gray3},
c = { fg = colors.fg, bg = colors.gray2 , } c = {fg = colors.fg, bg = colors.gray2}
} }
M.insert = { M.insert = {a = {fg = colors.bg, bg = colors.blue, gui = 'bold'}}
a = { fg = colors.bg, bg = colors.blue , gui = 'bold', },
}
M.visual = { M.visual = {a = {fg = colors.bg, bg = colors.purple, gui = 'bold'}}
a = { fg = colors.bg, bg = colors.purple , gui = 'bold', },
}
M.replace = { M.replace = {a = {fg = colors.bg, bg = colors.red1, gui = 'bold'}}
a = { fg = colors.bg, bg = colors.red1 , gui = 'bold', },
}
M.inactive = { M.inactive = {
a = { fg = colors.gray1, bg = colors.bg , gui = 'bold', }, a = {fg = colors.gray1, bg = colors.bg, gui = 'bold'},
b = { fg = colors.gray1, bg = colors.bg , }, b = {fg = colors.gray1, bg = colors.bg},
c = { fg = colors.gray1, bg = colors.gray2 , }, c = {fg = colors.gray1, bg = colors.gray2}
} }
return M return M

View File

@ -1,9 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Credit: Zoltan Dalmadi(lightline) -- Credit: Zoltan Dalmadi(lightline)
local M = {} local M = {}
-- LuaFormatter off
local colors = { local colors = {
blue = '#61afef', blue = '#61afef',
green = '#98c379', green = '#98c379',
@ -17,29 +16,24 @@ local colors = {
gray2 = '#f0f0f0', gray2 = '#f0f0f0',
gray3 = '#d0d0d0', gray3 = '#d0d0d0',
} }
-- LuaFormatter on
M.normal = { M.normal = {
a = { fg = colors.bg, bg = colors.green , gui = 'bold', }, a = {fg = colors.bg, bg = colors.green, gui = 'bold'},
b = { fg = colors.fg, bg = colors.gray3 , }, b = {fg = colors.fg, bg = colors.gray3},
c = { fg = colors.fg, bg = colors.gray2 , } c = {fg = colors.fg, bg = colors.gray2}
} }
M.insert = { M.insert = {a = {fg = colors.bg, bg = colors.blue, gui = 'bold'}}
a = { fg = colors.bg, bg = colors.blue , gui = 'bold', },
}
M.visual = { M.visual = {a = {fg = colors.bg, bg = colors.purple, gui = 'bold'}}
a = { fg = colors.bg, bg = colors.purple , gui = 'bold', },
}
M.replace = { M.replace = {a = {fg = colors.bg, bg = colors.red1, gui = 'bold'}}
a = { fg = colors.bg, bg = colors.red1 , gui = 'bold', },
}
M.inactive = { M.inactive = {
a = { fg = colors.bg, bg = colors.gray3 , gui = 'bold', }, a = {fg = colors.bg, bg = colors.gray3, gui = 'bold'},
b = { fg = colors.bg, bg = colors.gray3 , }, b = {fg = colors.bg, bg = colors.gray3},
c = { fg = colors.gray3, bg = colors.gray2 , }, c = {fg = colors.gray3, bg = colors.gray2}
} }
return M return M

View File

@ -1,44 +1,48 @@
-- Copyright (c) 2020-2021 IGI-111
-- MIT license, see LICENSE for more details.
-- LuaFormatter off
local colors = { local colors = {
vertsplit = "#181A1F", vertsplit = '#181A1F',
special_grey = "#3B4048", special_grey = '#3B4048',
menu_grey = "#3E4452", menu_grey = '#3E4452',
cursor_grey = "#2C323C", cursor_grey = '#2C323C',
gutter_fg_grey = "#4B5263", gutter_fg_grey = '#4B5263',
blue = "#82b1ff", blue = '#82b1ff',
dark_red = "#BE5046", dark_red = '#BE5046',
white = "#bfc7d5", white = '#bfc7d5',
green = "#C3E88D", green = '#C3E88D',
purple = "#c792ea", purple = '#c792ea',
yellow = "#ffcb6b", yellow = '#ffcb6b',
light_red = "#ff869a", light_red = '#ff869a',
red = "#ff5370", red = '#ff5370',
dark_yellow = "#F78C6C", dark_yellow = '#F78C6C',
cyan = "#89DDFF", cyan = '#89DDFF',
comment_grey = "#697098", comment_grey = '#697098',
black = "#292D3E", black = '#292D3E',
} }
-- LuaFormatter on
return { return {
normal = { normal = {
a = { fg = colors.black, bg = colors.purple, "bold" }, a = {fg = colors.black, bg = colors.purple, 'bold'},
b = { fg = colors.purple, bg = colors.menu_grey }, b = {fg = colors.purple, bg = colors.menu_grey},
c = { fg = colors.comment_grey, bg = colors.black }, c = {fg = colors.comment_grey, bg = colors.black}
}, },
insert = { insert = {
a = { fg = colors.black, bg = colors.blue, "bold" }, a = {fg = colors.black, bg = colors.blue, 'bold'},
b = { fg = colors.blue, bg = colors.menu_grey }, b = {fg = colors.blue, bg = colors.menu_grey}
}, },
visual = { visual = {
a = { fg = colors.black, bg = colors.cyan, "bold", }, a = {fg = colors.black, bg = colors.cyan, 'bold'},
b = { fg = colors.cyan, bg = colors.menu_grey }, b = {fg = colors.cyan, bg = colors.menu_grey}
}, },
replace = { replace = {
a = { fg = colors.black, bg = colors.green, "bold" }, a = {fg = colors.black, bg = colors.green, 'bold'},
b = { fg = colors.green, bg = colors.menu_grey }, b = {fg = colors.green, bg = colors.menu_grey}
}, },
inactive = { inactive = {
a = { fg = colors.black, bg = colors.menu_grey, "bold" }, a = {fg = colors.black, bg = colors.menu_grey, 'bold'},
b = { fg = colors.black, bg = colors.menu_grey }, b = {fg = colors.black, bg = colors.menu_grey},
c = { fg = colors.black, bg = colors.menu_grey }, c = {fg = colors.black, bg = colors.menu_grey}
}, }
} }

View File

@ -1,7 +1,6 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Credit: itchyny(lightline) -- Credit: itchyny(lightline)
local background = vim.o.background local background = vim.o.background
return require("lualine.themes.papercolor_"..background) return require('lualine.themes.papercolor_' .. background)

View File

@ -1,9 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Credit: TKNGUE(lightline) -- Credit: TKNGUE(lightline)
local M = {} local M = {}
-- LuaFormatter off
local colors = { local colors = {
red = '#df0000', red = '#df0000',
green = '#008700', green = '#008700',
@ -26,29 +25,24 @@ local colors = {
visual_fg = '#000000', visual_fg = '#000000',
visual_bg = '#8787af', visual_bg = '#8787af',
} }
-- LuaFormatter on
M.normal = { M.normal = {
a = { fg = colors.foreground, bg = colors.background , gui = 'bold', }, a = {fg = colors.foreground, bg = colors.background, gui = 'bold'},
b = { fg = colors.statusline_active_fg, bg = colors.status , }, b = {fg = colors.statusline_active_fg, bg = colors.status},
c = { fg = colors.statusline_active_fg, bg = colors.statusline_active_bg , } c = {fg = colors.statusline_active_fg, bg = colors.statusline_active_bg}
} }
M.insert = { M.insert = {a = {fg = colors.background, bg = colors.blue, gui = 'bold'}}
a = { fg = colors.background, bg = colors.blue, gui = 'bold', },
}
M.visual = { M.visual = {a = {fg = colors.visual_fg, bg = colors.visual_bg, gui = 'bold'}}
a = { fg = colors.visual_fg, bg = colors.visual_bg , gui = 'bold', },
}
M.replace = { M.replace = {a = {fg = colors.background, bg = colors.pink, gui = 'bold'}}
a = { fg = colors.background, bg = colors.pink , gui = 'bold', },
}
M.inactive = { M.inactive = {
a = { fg = colors.foreground, bg = colors.background , gui = 'bold', }, a = {fg = colors.foreground, bg = colors.background, gui = 'bold'},
b = { fg = colors.foreground, bg = colors.background , }, b = {fg = colors.foreground, bg = colors.background},
c = { fg = colors.foreground, bg = colors.background , }, c = {fg = colors.foreground, bg = colors.background}
} }
return M return M

View File

@ -1,9 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Credit: TKNGUE(lightline) -- Credit: TKNGUE(lightline)
local M = {} local M = {}
-- LuaFormatter off
local colors = { local colors = {
red = '#df0000', red = '#df0000',
green = '#008700', green = '#008700',
@ -24,29 +23,24 @@ local colors = {
statusline_inactive_fg = '#4d4d4c', statusline_inactive_fg = '#4d4d4c',
statusline_inactive_bg = '#dadada', statusline_inactive_bg = '#dadada',
} }
-- LuaFormatter on
M.normal = { M.normal = {
a = { fg = colors.foreground, bg = colors.background , gui = 'bold', }, a = {fg = colors.foreground, bg = colors.background, gui = 'bold'},
b = { fg = colors.statusline_active_fg, bg = colors.status , }, b = {fg = colors.statusline_active_fg, bg = colors.status},
c = { fg = colors.statusline_active_fg, bg = colors.statusline_active_bg , } c = {fg = colors.statusline_active_fg, bg = colors.statusline_active_bg}
} }
M.insert = { M.insert = {a = {fg = colors.blue, bg = colors.background, gui = 'bold'}}
a = { fg = colors.blue, bg = colors.background , gui = 'bold', },
}
M.visual = { M.visual = {a = {fg = colors.background, bg = colors.orange, gui = 'bold'}}
a = { fg = colors.background, bg = colors.orange , gui = 'bold', },
}
M.replace = { M.replace = {a = {fg = colors.background, bg = colors.pink, gui = 'bold'}}
a = { fg = colors.background, bg = colors.pink , gui = 'bold', },
}
M.inactive = { M.inactive = {
a = { fg = colors.foreground, bg = colors.background , gui = 'bold', }, a = {fg = colors.foreground, bg = colors.background, gui = 'bold'},
b = { fg = colors.foreground, bg = colors.background , }, b = {fg = colors.foreground, bg = colors.background},
c = { fg = colors.foreground, bg = colors.background , }, c = {fg = colors.foreground, bg = colors.background}
} }
return M return M

View File

@ -1,8 +1,7 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local powerline = {}
local powerline = { } -- LuaFormatter off
local Colors = { local Colors = {
white = '#ffffff', white = '#ffffff',
darkestgreen = '#005f00', darkestgreen = '#005f00',
@ -20,32 +19,32 @@ local Colors = {
gray7 = '#9e9e9e', gray7 = '#9e9e9e',
gray10 = '#f0f0f0', gray10 = '#f0f0f0',
} }
-- LuaFormatter on
powerline.normal = { powerline.normal = {
a = { fg = Colors.darkestgreen, bg = Colors.brightgreen, gui = 'bold', }, a = {fg = Colors.darkestgreen, bg = Colors.brightgreen, gui = 'bold'},
b = { fg = Colors.gray10, bg = Colors.gray5, }, b = {fg = Colors.gray10, bg = Colors.gray5},
c = { fg = Colors.gray7, bg = Colors.gray2, }, c = {fg = Colors.gray7, bg = Colors.gray2}
} }
powerline.insert = { powerline.insert = {
a = { fg = Colors.darkestcyan, bg = Colors.white, gui = 'bold', }, a = {fg = Colors.darkestcyan, bg = Colors.white, gui = 'bold'},
b = { fg = Colors.darkestcyan, bg = Colors.mediumcyan, }, b = {fg = Colors.darkestcyan, bg = Colors.mediumcyan},
c = { fg = Colors.mediumcyan, bg = Colors.darkestblue, }, c = {fg = Colors.mediumcyan, bg = Colors.darkestblue}
} }
powerline.visual = { powerline.visual = {
a = { fg = Colors.darkred, bg = Colors.brightorange, gui = 'bold', }, a = {fg = Colors.darkred, bg = Colors.brightorange, gui = 'bold'}
} }
powerline.replace = { powerline.replace = {
a = { fg = Colors.white, bg = Colors.brightred, gui = 'bold', }, a = {fg = Colors.white, bg = Colors.brightred, gui = 'bold'}
} }
powerline.inactive = { powerline.inactive = {
a = { fg = Colors.gray1, bg = Colors.gray5, gui = 'bold', }, a = {fg = Colors.gray1, bg = Colors.gray5, gui = 'bold'},
b = { fg = Colors.gray1, bg = Colors.gray5, }, b = {fg = Colors.gray1, bg = Colors.gray5},
c = { bg = Colors.gray1, fg = Colors.gray5, }, c = {bg = Colors.gray1, fg = Colors.gray5}
} }
return powerline return powerline

View File

@ -2,42 +2,43 @@
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Genarated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- LuaFormatter off
local colors = { local colors = {
color5 = "#d7afaf", color5 = '#d7afaf',
color6 = "#666656", color6 = '#666656',
color7 = "#808070", color7 = '#808070',
color10 = "#87af87", color10 = '#87af87',
color13 = "#df5f87", color13 = '#df5f87',
color14 = "#87afaf", color14 = '#87afaf',
color0 = "#e8e8d3", color0 = '#e8e8d3',
color1 = "#4e4e43", color1 = '#4e4e43',
color4 = "#30302c", color4 = '#30302c',
} }
-- LuaFormatter on
local seoul256 = { local seoul256 = {
visual = { visual = {
b = { fg = colors.color0, bg = colors.color1 }, b = {fg = colors.color0, bg = colors.color1},
a = { fg = colors.color4, bg = colors.color5 , "bold", }, a = {fg = colors.color4, bg = colors.color5, 'bold'}
}, },
inactive = { inactive = {
b = { fg = colors.color6, bg = colors.color4 }, b = {fg = colors.color6, bg = colors.color4},
c = { fg = colors.color6, bg = colors.color4 }, c = {fg = colors.color6, bg = colors.color4},
a = { fg = colors.color7, bg = colors.color4 , "bold", }, a = {fg = colors.color7, bg = colors.color4, 'bold'}
}, },
insert = { insert = {
b = { fg = colors.color0, bg = colors.color1 }, b = {fg = colors.color0, bg = colors.color1},
a = { fg = colors.color4, bg = colors.color10 , "bold", }, a = {fg = colors.color4, bg = colors.color10, 'bold'}
}, },
replace = { replace = {
b = { fg = colors.color0, bg = colors.color1 }, b = {fg = colors.color0, bg = colors.color1},
a = { fg = colors.color4, bg = colors.color13 , "bold", }, a = {fg = colors.color4, bg = colors.color13, 'bold'}
}, },
normal = { normal = {
b = { fg = colors.color0, bg = colors.color1 }, b = {fg = colors.color0, bg = colors.color1},
c = { fg = colors.color7, bg = colors.color4 }, c = {fg = colors.color7, bg = colors.color4},
a = { fg = colors.color4, bg = colors.color14 , "bold", }, a = {fg = colors.color4, bg = colors.color14, 'bold'}
}, }
} }
return seoul256 return seoul256

View File

@ -2,7 +2,6 @@
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Credit: itchyny(lightline) -- Credit: itchyny(lightline)
-- License: MIT License -- License: MIT License
local background = vim.o.background local background = vim.o.background
return require("lualine.themes.solarized_"..background) return require('lualine.themes.solarized_' .. background)

View File

@ -1,9 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Credit: itchyny(lightline) -- Credit: itchyny(lightline)
local M = {} local M = {}
-- LuaFormatter off
local colors = { local colors = {
base03 = '#002b36', base03 = '#002b36',
base02 = '#073642', base02 = '#073642',
@ -22,29 +21,24 @@ local colors = {
cyan = '#2aa198', cyan = '#2aa198',
green = '#859900', green = '#859900',
} }
-- LuaFormatter on
M.normal = { M.normal = {
a = { fg = colors.base03, bg = colors.blue , gui = 'bold', }, a = {fg = colors.base03, bg = colors.blue, gui = 'bold'},
b = { fg = colors.base03, bg = colors.base1 , }, b = {fg = colors.base03, bg = colors.base1},
c = { fg = colors.base1, bg = colors.base02 , } c = {fg = colors.base1, bg = colors.base02}
} }
M.insert = { M.insert = {a = {fg = colors.base03, bg = colors.green, gui = 'bold'}}
a = { fg = colors.base03, bg = colors.green , gui = 'bold', },
}
M.visual = { M.visual = {a = {fg = colors.base03, bg = colors.magenta, gui = 'bold'}}
a = { fg = colors.base03, bg = colors.magenta , gui = 'bold', },
}
M.replace = { M.replace = {a = {fg = colors.base03, bg = colors.red, gui = 'bold'}}
a = { fg = colors.base03, bg = colors.red , gui = 'bold', },
}
M.inactive = { M.inactive = {
a = { fg = colors.base0, bg = colors.base02 , gui = 'bold', }, a = {fg = colors.base0, bg = colors.base02, gui = 'bold'},
b = { fg = colors.base03, bg = colors.base00 , }, b = {fg = colors.base03, bg = colors.base00},
c = { fg = colors.base01, bg = colors.base02 , }, c = {fg = colors.base01, bg = colors.base02}
} }
return M return M

View File

@ -1,9 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Credit: itchyny(lightline) -- Credit: itchyny(lightline)
local M = {} local M = {}
-- LuaFormatter off
local colors = { local colors = {
base3 = '#002b36', base3 = '#002b36',
base2 = '#073642', base2 = '#073642',
@ -22,29 +21,24 @@ local colors = {
cyan = '#2aa198', cyan = '#2aa198',
green = '#859900', green = '#859900',
} }
-- LuaFormatter on
M.normal = { M.normal = {
a = { fg = colors.base03, bg = colors.blue , gui = 'bold', }, a = {fg = colors.base03, bg = colors.blue, gui = 'bold'},
b = { fg = colors.base03, bg = colors.base1 , }, b = {fg = colors.base03, bg = colors.base1},
c = { fg = colors.base1, bg = colors.base02 , } c = {fg = colors.base1, bg = colors.base02}
} }
M.insert = { M.insert = {a = {fg = colors.base03, bg = colors.green, gui = 'bold'}}
a = { fg = colors.base03, bg = colors.green , gui = 'bold', },
}
M.visual = { M.visual = {a = {fg = colors.base03, bg = colors.magenta, gui = 'bold'}}
a = { fg = colors.base03, bg = colors.magenta , gui = 'bold', },
}
M.replace = { M.replace = {a = {fg = colors.base03, bg = colors.red, gui = 'bold'}}
a = { fg = colors.base03, bg = colors.red , gui = 'bold', },
}
M.inactive = { M.inactive = {
a = { fg = colors.base0, bg = colors.base02 , gui = 'bold', }, a = {fg = colors.base0, bg = colors.base02, gui = 'bold'},
b = { fg = colors.base03, bg = colors.base00 , }, b = {fg = colors.base03, bg = colors.base00},
c = { fg = colors.base01, bg = colors.base02 , }, c = {fg = colors.base01, bg = colors.base02}
} }
return M return M

View File

@ -2,44 +2,45 @@
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Genarated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- LuaFormatter off
local colors = { local colors = {
color14 = "#718c00", color14 = '#718c00',
color0 = "#666666", color0 = '#666666',
color1 = "#c8c8c8", color1 = '#c8c8c8',
color2 = "#808080", color2 = '#808080',
color3 = "#fafafa", color3 = '#fafafa',
color4 = "#4271ae", color4 = '#4271ae',
color5 = "#4d4d4c", color5 = '#4d4d4c',
color6 = "#b4b4b4", color6 = '#b4b4b4',
color7 = "#555555", color7 = '#555555',
color8 = "#8959a8", color8 = '#8959a8',
color11 = "#f5871f", color11 = '#f5871f',
} }
-- LuaFormatter on
local tomorrow = { local tomorrow = {
inactive = { inactive = {
a = { fg = colors.color0, bg = colors.color1, gui = "bold" }, a = {fg = colors.color0, bg = colors.color1, gui = 'bold'},
b = { fg = colors.color2, bg = colors.color3 }, b = {fg = colors.color2, bg = colors.color3},
c = { fg = colors.color0, bg = colors.color1 }, c = {fg = colors.color0, bg = colors.color1}
}, },
normal = { normal = {
a = { fg = colors.color1, bg = colors.color4, gui = "bold" }, a = {fg = colors.color1, bg = colors.color4, gui = 'bold'},
b = { fg = colors.color5, bg = colors.color6 }, b = {fg = colors.color5, bg = colors.color6},
c = { fg = colors.color7, bg = colors.color1 }, c = {fg = colors.color7, bg = colors.color1}
}, },
visual = { visual = {
a = { fg = colors.color1, bg = colors.color8, gui = "bold" }, a = {fg = colors.color1, bg = colors.color8, gui = 'bold'},
b = { fg = colors.color5, bg = colors.color6 }, b = {fg = colors.color5, bg = colors.color6}
}, },
replace = { replace = {
a = { fg = colors.color1, bg = colors.color11, gui = "bold" }, a = {fg = colors.color1, bg = colors.color11, gui = 'bold'},
b = { fg = colors.color5, bg = colors.color6 }, b = {fg = colors.color5, bg = colors.color6}
}, },
insert = { insert = {
a = { fg = colors.color1, bg = colors.color14, gui = "bold" }, a = {fg = colors.color1, bg = colors.color14, gui = 'bold'},
b = { fg = colors.color5, bg = colors.color6 }, b = {fg = colors.color5, bg = colors.color6}
}, }
} }
return tomorrow return tomorrow

View File

@ -1,9 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Credit: itchyny(lightline) -- Credit: itchyny(lightline)
local M = {} local M = {}
-- LuaFormatter off
local colors = { local colors = {
base03 = '#242424', base03 = '#242424',
base023 = '#353535', base023 = '#353535',
@ -22,29 +21,24 @@ local colors = {
cyan = '#8ac6f2', cyan = '#8ac6f2',
green = '#95e454', green = '#95e454',
} }
-- LuaFormatter on
M.normal = { M.normal = {
a = { fg = colors.base02, bg = colors.blue , gui = 'bold', }, a = {fg = colors.base02, bg = colors.blue, gui = 'bold'},
b = { fg = colors.base02, bg = colors.base0 , }, b = {fg = colors.base02, bg = colors.base0},
c = { fg = colors.base2, bg = colors.base02 , } c = {fg = colors.base2, bg = colors.base02}
} }
M.insert = { M.insert = {a = {fg = colors.base02, bg = colors.green, gui = 'bold'}}
a = { fg = colors.base02, bg = colors.green , gui = 'bold', },
}
M.visual = { M.visual = {a = {fg = colors.base02, bg = colors.magenta, gui = 'bold'}}
a = { fg = colors.base02, bg = colors.magenta , gui = 'bold', },
}
M.replace = { M.replace = {a = {fg = colors.base023, bg = colors.red, gui = 'bold'}}
a = { fg = colors.base023, bg = colors.red , gui = 'bold', },
}
M.inactive = { M.inactive = {
a = { fg = colors.base1, bg = colors.base02 , gui = 'bold', }, a = {fg = colors.base1, bg = colors.base02, gui = 'bold'},
b = { fg = colors.base023, bg = colors.base01 , }, b = {fg = colors.base023, bg = colors.base01},
c = { fg = colors.base1, bg = colors.base023 , }, c = {fg = colors.base1, bg = colors.base023}
} }
return M return M

View File

@ -1,9 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local M = {}
local M = { } local highlight = require 'lualine.highlight'
local highlight = require'lualine.highlight'
-- set upper or lower case -- set upper or lower case
local function apply_case(status, options) local function apply_case(status, options)
@ -26,20 +25,21 @@ local function apply_padding(status, options)
-- When component has changed the highlight at begining -- When component has changed the highlight at begining
-- we will add the padding after the highlight -- we will add the padding after the highlight
local pre_highlight = vim.fn.matchlist(status, [[\(%#.\{-\}#\)]])[2] local pre_highlight = vim.fn.matchlist(status, [[\(%#.\{-\}#\)]])[2]
status = pre_highlight .. string.rep(' ', l_padding).. status = pre_highlight .. string.rep(' ', l_padding) ..
status:sub(#pre_highlight + 1, #status) status:sub(#pre_highlight + 1, #status)
else else
status = string.rep(' ', l_padding)..status status = string.rep(' ', l_padding) .. status
end end
end end
if r_padding then status = status..string.rep(' ', r_padding) end if r_padding then status = status .. string.rep(' ', r_padding) end
return status return status
end end
-- Applies custom highlights for component -- Applies custom highlights for component
local function apply_highlights(status, options, default_hl) local function apply_highlights(status, options, default_hl)
if options.color_highlight then if options.color_highlight then
status = highlight.component_format_highlight(options.color_highlight) .. status status = highlight.component_format_highlight(options.color_highlight) ..
status
end end
return status .. default_hl return status .. default_hl
end end
@ -59,8 +59,11 @@ local function apply_spearator(status, options)
if options.separator and #options.separator > 0 then if options.separator and #options.separator > 0 then
separator = options.separator separator = options.separator
elseif options.component_separators then elseif options.component_separators then
if options.self.section < 'lualine_x' then separator = options.component_separators[1] if options.self.section < 'lualine_x' then
else separator = options.component_separators[2] end separator = options.component_separators[1]
else
separator = options.component_separators[2]
end
options.separator = separator options.separator = separator
end end
if separator then status = status .. separator end if separator then status = status .. separator end
@ -83,7 +86,8 @@ function M.draw_section(section, highlight_name)
for _, component in pairs(section) do for _, component in pairs(section) do
local localstatus = component[1]() local localstatus = component[1]()
if #localstatus > 0 then if #localstatus > 0 then
local custom_highlight_at_begining = localstatus:find('%%#.*#') == 1 or component.color ~= nil local custom_highlight_at_begining =
localstatus:find('%%#.*#') == 1 or component.color ~= nil
-- Apply modifier functions for options -- Apply modifier functions for options
if component.format then localstatus = component.format(localstatus) end if component.format then localstatus = component.format(localstatus) end
localstatus = apply_icon(localstatus, component) localstatus = apply_icon(localstatus, component)
@ -91,8 +95,8 @@ function M.draw_section(section, highlight_name)
localstatus = apply_padding(localstatus, component) localstatus = apply_padding(localstatus, component)
localstatus = apply_highlights(localstatus, component, highlight_name) localstatus = apply_highlights(localstatus, component, highlight_name)
localstatus = apply_spearator(localstatus, component) localstatus = apply_spearator(localstatus, component)
if custom_highlight_at_begining or if custom_highlight_at_begining or (#drawn_components > 0 and
(#drawn_components > 0 and not drawn_components[#drawn_components].separator_applied)then not drawn_components[#drawn_components].separator_applied) then
-- Don't prepend with old highlight when the component changes it imidiately -- Don't prepend with old highlight when the component changes it imidiately
-- Or when it was already applied with separator -- Or when it was already applied with separator
table.insert(status, localstatus) table.insert(status, localstatus)
@ -105,9 +109,9 @@ function M.draw_section(section, highlight_name)
-- Draw nothing when all the components were empty -- Draw nothing when all the components were empty
if #status == 0 then return '' end if #status == 0 then return '' end
-- Remove separators sorounding custom highlighted component -- Remove separators sorounding custom highlighted component
for i=1,#status do for i = 1, #status do
if (drawn_components[i].color and drawn_components[i].color.bg) if (drawn_components[i].color and drawn_components[i].color.bg) or
or drawn_components[i].custom_highlight then drawn_components[i].custom_highlight then
status[i] = strip_separator(status[i], drawn_components[i]) status[i] = strip_separator(status[i], drawn_components[i])
if i > 1 then if i > 1 then
status[i - 1] = strip_separator(status[i - 1], drawn_components[i - 1]) status[i - 1] = strip_separator(status[i - 1], drawn_components[i - 1])
@ -118,5 +122,4 @@ function M.draw_section(section, highlight_name)
return table.concat(status) return table.concat(status)
end end
return M return M

View File

@ -1,9 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local M = {} local M = {}
-- LuaFormatter off
-- color conversion -- color conversion
local color_table = { local color_table = {
-- lookup table for cterm colors -- lookup table for cterm colors
@ -273,25 +272,26 @@ local color_table = {
{'254', { 228, 228, 228 }}, {'254', { 228, 228, 228 }},
{'255', { 238, 238, 238 }}, {'255', { 238, 238, 238 }},
} }
-- LuaFormatter on
function M.get_cterm_color(hex_color) function M.get_cterm_color(hex_color)
local function get_color_distance(color1, color2) local function get_color_distance(color1, color2)
-- returns how much color2 deviates from color1 -- returns how much color2 deviates from color1
local dr = math.abs(color1[1] - color2[1]) / (color1[1]+1) * 100 local dr = math.abs(color1[1] - color2[1]) / (color1[1] + 1) * 100
local dg = math.abs(color1[2] - color2[2]) / (color1[2]+1) * 100 local dg = math.abs(color1[2] - color2[2]) / (color1[2] + 1) * 100
local db = math.abs(color1[3] - color2[3]) / (color1[3]+1) * 100 local db = math.abs(color1[3] - color2[3]) / (color1[3] + 1) * 100
return (dr + dg + db) return (dr + dg + db)
end end
local r = tonumber(hex_color:sub(2,3), 16) local r = tonumber(hex_color:sub(2, 3), 16)
local g = tonumber(hex_color:sub(4,5), 16) local g = tonumber(hex_color:sub(4, 5), 16)
local b = tonumber(hex_color:sub(6,7), 16) local b = tonumber(hex_color:sub(6, 7), 16)
-- check which cterm color is closest to hex colors in terms of rgb values -- check which cterm color is closest to hex colors in terms of rgb values
local closest_cterm_color = 0 local closest_cterm_color = 0
local min_distance = 10000 local min_distance = 10000
for _, color in ipairs(color_table) do for _, color in ipairs(color_table) do
local current_distance = get_color_distance(color[2], {r,g,b}) local current_distance = get_color_distance(color[2], {r, g, b})
if current_distance < min_distance then if current_distance < min_distance then
min_distance = current_distance min_distance = current_distance
closest_cterm_color = color[1] closest_cterm_color = color[1]

View File

@ -1,6 +1,5 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
local M = {} local M = {}
-- Works as a decorator to expand set_lualine_theme functions -- Works as a decorator to expand set_lualine_theme functions
@ -21,7 +20,7 @@ function M.extract_highlight_colors(color_group, scope)
local cterm_colors = vim.api.nvim_get_hl_by_name(color_group, false) local cterm_colors = vim.api.nvim_get_hl_by_name(color_group, false)
local color = { local color = {
ctermfg = cterm_colors.foreground, ctermfg = cterm_colors.foreground,
ctermbg = cterm_colors.background, ctermbg = cterm_colors.background
} }
if gui_colors.background then if gui_colors.background then
color.guibg = string.format('#%06x', gui_colors.background) color.guibg = string.format('#%06x', gui_colors.background)
@ -48,7 +47,7 @@ end
-- clears loaded_highlights table and highlights -- clears loaded_highlights table and highlights
function M.clear_highlights() function M.clear_highlights()
for highlight_name, _ in pairs(M.loaded_highlights)do for highlight_name, _ in pairs(M.loaded_highlights) do
vim.cmd('highlight clear ' .. highlight_name) vim.cmd('highlight clear ' .. highlight_name)
M.loaded_highlights[highlight_name] = nil M.loaded_highlights[highlight_name] = nil
end end