Skip to content

Commit

Permalink
fix: colors config, selenized, base04 color
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmx03 committed Dec 22, 2023
1 parent 331e051 commit 5d84b00
Show file tree
Hide file tree
Showing 13 changed files with 212 additions and 209 deletions.
74 changes: 62 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,33 @@ designed for use with terminal and gui applications.

![solarized](https://github.com/maxmx03/solarized.nvim/assets/50273941/3c2ffda7-9efb-46f4-ad82-7dfd257dda39)

<!--toc:start-->

- [Features](#features)
- [Requirements](#requirements)
- [Install from package manager](#install-from-package-manager)
- [Manual Installation](#manual-installation)
- [Help](#help)
- [Commands](#commands)
- [Default Config](#default-config)
- [Config Themes](#config-themes)
- [Config Styles](#config-styles)
- [Config Highlights](#config-highlights)
- [Config Colors](#config-colors)
- [Config Enables](#config-enables)
- [Config Autocmd](#config-autocmd)
- [Lualine](#lualine)
- [Barbecue](#barbecue)
- [Api](#api)
- [Get Colors](#get-colors)
- [Color utils](#color-utils)
- [How to get color shades](#how-to-get-color-shades)
- [How to get color tints](#how-to-get-color-tints)
- [Contributing](#contributing)
- [Designed by](#designed-by)
- [Credits and Reference 🎉](#credits-and-reference-🎉)
<!--toc:end-->

## Features

- Support for Treesitter
Expand Down Expand Up @@ -44,7 +71,7 @@ Download using your preferred package manager.
config = function()
vim.o.background = 'dark' -- or 'light'

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

vim.cmd.colorscheme 'solarized' -- or 'selenized'
vim.cmd.colorscheme 'solarized'
end
}
```
Expand Down Expand Up @@ -89,6 +116,7 @@ vim.o.background = 'dark'
-- default config
require('solarized').setup({
transparent = false, -- enable transparent background
palette = 'solarized', -- or selenized
styles = {
comments = {},
functions = {},
Expand Down Expand Up @@ -177,7 +205,6 @@ require('solarized').setup {
CursorLine = { bg = c.base02 },
Function = { italic = false },
Visual = { bg = c.cyan },
CmpKindBorder = { fg = c.base01, bg = c.base04 }
}
end
}
Expand All @@ -199,7 +226,7 @@ require('solarized').setup {

return {
fg = '#fff', -- output: #ffffff
bg = darken(colors.base03, 10)
bg = darken(colors.base03, 100)
}
end,
highlights = function(colors)
Expand Down Expand Up @@ -253,7 +280,7 @@ This option enhances highlighting by enabling Solarized's autocmd feature.
```lua
require('lualine').setup {
options = {
theme = 'solarized', -- or 'selenized'
theme = 'solarized',
disabled_filetypes = {
'NvimTree',
},
Expand Down Expand Up @@ -290,25 +317,48 @@ You can utilize useful functions to customize your Neovim plugins.
```lua
local palette = require('solarized.palette')
local colors = palette.get_colors()
local colors = palette.get_selenized_colors()
```

### Colorhelper
### Color utils

```lua
local colorhelper = require('solarized.utils.colors')
local color = require('solarized.utils.colors')

-- Convert a hex color code to RGB
colorhelper.hex_to_rgb('#ffffff')
color.hex_to_rgb('#ffffff')

-- Darken a color by a specified percentage
colorhelper.darken('#ffffff', 100)
color.darken('#ffffff', 100)

-- Lighten a color by a specified percentage
colorhelper.lighten('#000000', 100)
color.lighten('#000000', 100)

-- Blend two colors with a specified ratio
colorhelper.blend('#ffffff', '#000000', 0.15)
color.blend('#ffffff', '#000000', 0.15)
```

### How to get color shades

```lua
local darken = require('solarized.utils.colors').darken
local colors = require('solarized.palette').get_colors()
for i = 1, 10, 1 do
local shade = darken(colors.blue, i * 10)

print(shade)
end
```

### How to get color tints

```lua
local lighten = require('solarized.utils.colors').lighten

for i = 1, 10, 1 do
local tints = lighten(colors.blue, i * 10)

print(tints)
end
```

## Contributing
Expand Down
1 change: 0 additions & 1 deletion colors/selenized.lua

This file was deleted.

2 changes: 1 addition & 1 deletion doc/solarized.nvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ example:
CursorLine = { bg = c.base02 },
Function = { italic = false },
Visual = { bg = c.cyan },
CmpKindBorder = { fg = c.base01, bg = c.base04 }
CmpKindBorder = { fg = c.base01, bg = base04 }
}
end
}
Expand Down
8 changes: 1 addition & 7 deletions lua/barbecue/theme/solarized.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
local c = {}
local palette = require('solarized.palette')

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

local M = {
normal = {},
Expand Down
25 changes: 0 additions & 25 deletions lua/lualine/themes/selenized.lua

This file was deleted.

9 changes: 1 addition & 8 deletions lua/solarized/command.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@ local command = {
local subcommands = {
colors = function(arg)
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 colors = palette.get_colors()

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

local function color_desc(color)
local colors_desc = {
base04 = 'background tone (column/nvim-tree)',
base03 = 'background tone (main)',
base02 = 'background tone (highlight/menu/LineNr)',
base01 = 'content tone (comment)',
Expand Down
15 changes: 3 additions & 12 deletions lua/solarized/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ M.colors = nil
function M.default_config()
return {
transparent = false,
palette = 'solarized', -- selenized
styles = {
comments = {},
functions = {},
Expand Down Expand Up @@ -62,19 +63,9 @@ function M.load()
vim.o.termguicolors = true
vim.g.colors_name = 'solarized'

local colors = palette.get_colors()
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 = {}

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

Expand Down
Loading

0 comments on commit 5d84b00

Please sign in to comment.