feat: pywal theme (#35)

* feat: pywal theme
* docs: add pywal screenshots

Co-authored-by: mtoohey31 <mtoohey31@users.noreply.github.com>
This commit is contained in:
Matthew Toohey 2021-09-04 13:17:19 -04:00 committed by GitHub
parent 6e19d4c952
commit 7185c61e9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 69 additions and 3 deletions

View File

@ -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.
</p>
### 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.
<img width='700' src='https://user-images.githubusercontent.com/59497618/131224421-3b175d7a-fb14-424c-ad53-03d2c3b2ab71.png'/>
</p>
### 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`
<img width='700' src='https://user-images.githubusercontent.com/36740602/132101614-8aa90169-a1ed-4911-b09f-31b5bae56cbf.png'/>
#### `wal --theme -l github`
<img width='700' src='https://user-images.githubusercontent.com/36740602/132101617-f3ff65eb-8051-4294-9a55-e6caa9605006.png'/>
#### `wal --theme vscode`
<img width='700' src='https://user-images.githubusercontent.com/36740602/132101619-7d04d748-d478-45a2-983a-f2a93f3c5714.png'/>
#### `wal --theme zenburn`
<img width='700' src='https://user-images.githubusercontent.com/36740602/132101621-505e5bb6-d18a-434c-a0f8-a3904a5c71f2.png'/>
### seoul256
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649194-2c8cd480-74bd-11eb-8fbc-935d7e0fe921.png'/>
@ -285,4 +304,4 @@ them based you your `background` option.
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649411-8db4a800-74bd-11eb-962a-8b73f9fb7124.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649349-6cec5280-74bd-11eb-9ada-8f1cb8b48ec1.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649358-6fe74300-74bd-11eb-9fe2-a955f964e3ce.png'/>
</p
</p>

View File

@ -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}
}
}