Skip to content

Commit

Permalink
feat: selenized
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmx03 committed Dec 22, 2023
1 parent a43e75d commit c04e4e5
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 7 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ designed for use with terminal and gui applications.
- Customizability: styles, colors and highlights can all be modified
- Plugin compatibility
- Provides users with the option to enable or disable highlight groups
- Selenized color palette

## Requirements

Expand All @@ -43,7 +44,7 @@ Download using your preferred package manager.
config = function()
vim.o.background = 'dark' -- or 'light'

vim.cmd.colorscheme 'solarized'
vim.cmd.colorscheme 'solarized' -- or 'selenized'
end,
},
```
Expand All @@ -56,7 +57,7 @@ use {
config = function()
vim.o.background = 'dark' -- or 'light'

vim.cmd.colorscheme 'solarized'
vim.cmd.colorscheme 'solarized' -- or 'selenized'
end
}
```
Expand Down Expand Up @@ -128,7 +129,7 @@ require('solarized').setup({
autocmd = true,
})

vim.cmd.colorscheme = 'solarized'
vim.cmd.colorscheme = 'solarized' -- or selenized
```

## Config Themes
Expand Down Expand Up @@ -252,7 +253,7 @@ This option enhances highlighting by enabling Solarized's autocmd feature.
```lua
require('lualine').setup {
options = {
theme = 'solarized',
theme = 'solarized', -- or 'selenized'
disabled_filetypes = {
'NvimTree',
},
Expand Down Expand Up @@ -287,8 +288,9 @@ You can utilize useful functions to customize your Neovim plugins.
### Get Colors

```lua
local solarized_palette = require('solarized.palette')
local colors = solarized_palette.get_colors()
local palette = require('solarized.palette')
local colors = palette.get_colors()
local colors = palette.get_selenized_colors()
```

### Colorhelper
Expand Down
1 change: 1 addition & 0 deletions colors/selenized.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('solarized.config').load_selenized()
25 changes: 25 additions & 0 deletions lua/lualine/themes/selenized.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
local solarized_palette = require('solarized.palette')
local colors = solarized_palette.get_selenized_colors()

local M = {
normal = {
a = { fg = colors.base03, bg = colors.blue, gui = 'bold' },
b = { fg = colors.base02, bg = colors.base1 },
c = { fg = colors.base1, bg = colors.base02 },
z = { fg = colors.base03, bg = colors.blue },
},
insert = {
a = { fg = colors.base03, bg = colors.green },
},
visual = {
a = { fg = colors.base03, bg = colors.magenta },
},
replace = {
a = { fg = colors.base03, bg = colors.red },
},
command = {
a = { fg = colors.base03, bg = colors.orange },
},
}

return M
10 changes: 9 additions & 1 deletion lua/solarized/command.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ local command = {

local subcommands = {
colors = function(arg)
local colors = require('solarized.palette').get_colors()
local palette = require('solarized.palette')
local colors = {}

if vim.g.colors_name == 'solarized' then
colors = palette.get_colors()
else
colors = palette.get_selenized_colors()
end

local buf = vim.api.nvim_create_buf(true, true)
local max_length = vim.tbl_count(colors)

Expand Down
12 changes: 12 additions & 0 deletions lua/solarized/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ function M.load()
solarized.highlights(M.colors or colors, M.config or M.default_config())
end

function M.load_selenized()
if vim.g.colors_name then vim.cmd('hi clear') end

if vim.fn.exists('syntax_on') then vim.cmd('syntax reset') end

vim.o.termguicolors = true
vim.g.colors_name = 'selenized'

local colors = palette.get_selenized_colors()
solarized.highlights(M.colors or colors, M.config or M.default_config())
end

--- Solarized setup
---
--- @param opts? table The user-provided configuration to be merged.
Expand Down
65 changes: 65 additions & 0 deletions lua/solarized/palette.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,71 @@ function M.get_colors()
return colors[vim.o.background]
end

function M.get_selenized_colors()
local colors = {
dark = {
base04 = '#0d303a', -- background tone darker (column/nvim-tree)
base03 = '#103c48', -- background tone dark (main)
base02 = '#2d5b69', -- background tone (highlight/menu/LineNr)
base01 = '#72898f', -- content tone (comment)
base00 = '#72898f', -- content tone (winseparator)
base0 = '#adbcbc', -- content tone (foreground)
base1 = '#cad8d9', -- content tone (statusline/tabline)
base2 = '#cfcebe', -- background tone light (highlight)
base3 = '#fbf3db', -- background tone lighter (main)
-- accent
yellow = '#dbb32d',
orange = '#ed8649',
red = '#fa5750',
magenta = '#f275be',
violet = '#af88eb',
blue = '#4695f7',
cyan = '#41c7b9',
green = '#75b938',
-- git
add = '#75b938',
change = '#dbb32d',
delete = '#fa5750',
-- diagnostic
info = '#4695f7',
hint = '#75b938',
warning = '#dbb32d',
error = '#fa5750',
},
light = {
base3 = '#103c48', -- background tone darker (main)
base2 = '#2d5b69', -- background tone dark (highlight)
base1 = '#3a4d53', -- content tone (statusline/tabline)
base0 = '#53676d', -- content tone (foreground)
base00 = '#909995', -- content tone (winseparator)
base01 = '#909995', -- content tone (comment)
base02 = '#cfcebe', -- background tone (highlight/menu/LineNr)
base03 = '#fbf3db', -- background tone lighter (main)
base04 = '#f6ebca', -- background tone (column/nvim-tree)
-- accent
yellow = '#ad8900',
orange = '#ed8649',
red = '#dc322f',
magenta = '#ca4898',
violet = '#af88eb',
blue = '#0072d4',
cyan = '#009c8f',
green = '#489100',
-- git
add = '#489100',
change = '#ad8900',
delete = '#d2212d',
-- diagnostic
info = '#0072d4',
hint = '#489100',
warning = '#ad8900',
error = '#d2212d',
},
}

return colors[vim.o.background]
end

--- Filter colors by selecting valid hexadecimal color values.
---
--- @param colors table A table containing color values to be filtered.
Expand Down
10 changes: 10 additions & 0 deletions tests/load_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,14 @@ describe('Initialization', function()

assert.equals(expect, to_hex(output.bg))
end)

test('Selenized is being loaded', function()
vim.cmd.colorscheme('selenized')

local output = vim.api.nvim_get_hl(0, { name = 'Normal' })
local expect = '#fbf3db'

assert.equals(expect, to_hex(output.bg))
assert.equals(vim.g.colors_name, 'selenized')
end)
end)

0 comments on commit c04e4e5

Please sign in to comment.