Skip to content

Commit

Permalink
feat: zen-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmx03 committed Dec 18, 2023
1 parent 6db8939 commit 70a571c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Use `:h solarized.nvim.txt` to get some help
## Commands

`:Solarized colors` - Display the Solarized palette in a new buffer
`:Solarized zen`- Removes highlight colors, emphasizing important code segments.

## Default Config

Expand Down
2 changes: 0 additions & 2 deletions colors/solarized.vim → colors/solarized.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
lua << EOF
require('solarized.config').load()
EOF
33 changes: 32 additions & 1 deletion lua/solarized/command.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
local command = {}
local command = {
zen_mode = false,
}

local subcommands = {
colors = function(arg)
Expand Down Expand Up @@ -50,6 +52,35 @@ local subcommands = {
vim.api.nvim_buf_set_name(buf, 'Solarized Colors')
vim.api.nvim_win_set_buf(0, buf)
end,
zen = function()
local colors = require('solarized.palette').get_colors()
local solarized = require('solarized.highlights')

if not command.zen_mode then
local highlights = {
Keyword = { fg = colors.base01 },
['@keyword.return'] = { fg = colors.base01 },
Statement = { fg = colors.base01 },
['@field'] = { fg = colors.base01 },
['@property'] = { fg = colors.base01 },
['@lsp.type.property'] = { fg = colors.base01 },
Delimiter = { fg = colors.base01 },
['@constructor'] = { fg = colors.base01 },
['@tag'] = { fg = colors.base01 },
['@tag.attribute'] = { fg = colors.base01 },
['Type'] = { fg = colors.base01 },
['@type'] = { fg = colors.base01 },
['@include'] = { fg = colors.base01 },
}

solarized.custom_hl(highlights)
command.zen_mode = true
else
local config = require('solarized.config')
solarized.highlights(colors, config.config or config.default_config())
command.zen_mode = false
end
end,
}

function command.list()
Expand Down
3 changes: 1 addition & 2 deletions lua/solarized/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ function M.default_config()
}
end

function M.load(background)
background = background or 'dark'
function M.load()
if vim.g.colors_name then
vim.cmd('hi clear')
end
Expand Down

0 comments on commit 70a571c

Please sign in to comment.