diff --git a/THEMES.md b/THEMES.md index d933bf1..4e68a75 100644 --- a/THEMES.md +++ b/THEMES.md @@ -3,7 +3,7 @@ All available themes are only best effort ports by myself/ other users. If you find a theme to be weird/ wrong please open an issue/ pr. ### auto -auto is a special theme. It will automaticaly load theme for your colorscheme. +auto is a special theme. It will automatically load theme for your colorscheme. If there's no theme available for your colorscheme then it'll try it's best to generate one. @@ -120,7 +120,7 @@ them based you your `background` option.

### iceberg -It's a combination of icrberg_light and icrberg_dark. It loads either of +It's a combination of iceberg_light and iceberg_dark. It loads either of them based you your `background` option. ### jellybeans @@ -247,6 +247,25 @@ them based you your `background` option.

+### pywal +pywal is another special theme. It will load the colors from your current [pywal](https://github.com/dylanaraps/pywal) cache, specifically `~/.cache/wal/colors.sh` and generate a theme. + +#### `wal --theme ashes` + + + +#### `wal --theme -l github` + + + +#### `wal --theme vscode` + + + +#### `wal --theme zenburn` + + + ### seoul256

@@ -285,4 +304,4 @@ them based you your `background` option. -

diff --git a/lua/lualine/themes/pywal.lua b/lua/lualine/themes/pywal.lua new file mode 100644 index 0000000..586a59e --- /dev/null +++ b/lua/lualine/themes/pywal.lua @@ -0,0 +1,47 @@ +local lualine_require = require'lualine_require' +local modules = lualine_require.lazy_require{ + utils_notices = 'lualine.utils.notices' +} +local sep = package.config:sub(1,1) +local wal_colors_path = table.concat({os.getenv("HOME"), ".cache", "wal", "colors.sh"}, sep) +local wal_colors_file = io.open(wal_colors_path, "r") + +if wal_colors_file == nil then + modules.utils_notices.add_notice("lualine.nvim: " .. wal_colors_path .. " not found") + error("") +end + +local ok, wal_colors_text = pcall(wal_colors_file.read, wal_colors_file, '*a') +wal_colors_file:close() + +if not ok then + modules.utils_notices.add_notice("lualine.nvim: " .. wal_colors_path .. " could not be read: " .. wal_colors_text) + error("") +end + +local colors = {} + +for line in vim.gsplit(wal_colors_text, '\n') do + if line:match('^[a-z0-9]+=\'#[a-f0-9]+\'') ~= nil then + local i = line:find('=') + local key = line:sub(0, i - 1) + local value = line:sub(i + 2, #line - 1) + colors[key] = value + end +end + +return { + normal = { + a = {fg = colors.background, bg = colors.color4, gui = 'bold'}, + b = {fg = colors.foreground, bg = colors.color8}, + c = {fg = colors.foreground, bg = colors.background} + }, + insert = {a = {fg = colors.background, bg = colors.color2, gui = 'bold'}}, + visual = {a = {fg = colors.background, bg = colors.color3, gui = 'bold'}}, + replace = {a = {fg = colors.background, bg = colors.color1, gui = 'bold'}}, + inactive = { + a = {fg = colors.foreground, bg = colors.background, gui = 'bold'}, + b = {fg = colors.foreground, bg = colors.background}, + c = {fg = colors.foreground, bg = colors.background} + } +}