Merge pull request #14 from maxmx03/draculapro

Draculapro
This commit is contained in:
Milianor 2023-05-02 14:08:46 -03:00 committed by GitHub
commit db7895d0ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 1072 additions and 886 deletions

160
CONFIG.md Normal file
View file

@ -0,0 +1,160 @@
#### Configuration Instructions for Dracula.nvim
The dracula.nvim theme can be configured using the following options:
| Name | type | values | Description |
| ----------- | ---------------- | -------------------------------- | -------------------------------------------------------------- |
| soft | boolean | true, false | Enables the soft version of the Draculatheme |
| transparent | boolean, string | true, false, "full" | Changes the background to transparent |
| saturation | table | { enabled = false, amount = 10 } | Changes the saturation of the colorscheme |
| dracula_pro | plugin | require('draculapro') | Provides support for the Dracula Pro theme |
| override | table / function | {} | Updates of creates highlight groups |
| callback | function | function | An alternative to `override` used to customize the colorscheme |
#### How to customize [telescope](https://github.com/nvim-telescope/telescope.nvim)
```lua
local dracula = require 'dracula'
function custom(c)
return {
TelescopeResultsBorder = { fg = c.bgdark, bg = c.bgdark },
TelescopeResultsNormal = { bg = c.bgdark },
TelescopePreviewNormal = { bg = c.bg },
TelescopePromptBorder = { fg = c.bgdark, bg = c.bgdark },
TelescopeTitle = { fg = c.fg, bg = c.comment },
TelescopePromptPrefix = { fg = c.purple },
}
end
dracula.setup {
soft = false,
transparent = false,
saturation = {
enabled = false,
amount = 10,
},
override = custom,
-- callback = function (c)
-- vim.api.nvim_set_hl(0, TelescopeResultsBorder, { fg = c.bgdark, bg = c.bgdark })
-- vim.api.nvim_set_hl(0, TelescopeResultsNormal, { bg = c.bgdark })
-- vim.api.nvim_set_hl(0, TelescopePreviewNormal, { bg = c.bg })
-- vim.api.nvim_set_hl(0, TelescopePromptBorder, { fg = c.bgdark, bg = c.bgdark })
-- vim.api.nvim_set_hl(0, TelescopeTitle, { fg = c.fg, bg = c.comment })
-- vim.api.nvim_set_hl(0, TelescopePromptPrefix, { fg = c.purple })
-- end
}
vim.cmd.colorscheme 'dracula'
```
#### How to customize [cmp](https://github.com/hrsh7th/nvim-cmp)
```lua
local dracula = require 'dracula'
dracula.setup {
override = {
CmpItemKindText = { reverse = true },
CmpItemKindMethod = { reverse = true },
CmpItemKindFunction = { reverse = true },
CmpItemKindConstructor = { reverse = true },
CmpItemKindField = { reverse = true },
CmpItemKindVariable = { reverse = true },
CmpItemKindClass = { reverse = true },
CmpItemKindInterface = { reverse = true },
CmpItemKindModule = { reverse = true },
CmpItemKindProperty = { reverse = true },
CmpItemKindUnit = { reverse = true },
CmpItemKindValue = { reverse = true },
CmpItemKindEnum = { reverse = true },
CmpItemKindKeyword = { reverse = true },
CmpItemKindSnippet = { reverse = true },
CmpItemKindColor = { reverse = true },
CmpItemKindFile = { reverse = true },
CmpItemKindReference = { reverse = true },
CmpItemKindFolder = { reverse = true },
CmpItemKindEnumMember = { reverse = true },
CmpItemKindConstant = { reverse = true },
CmpItemKindStruct = { reverse = true },
CmpItemKindEvent = { reverse = true },
CmpItemKindOperator = { reverse = true },
CmpItemKindTypeParameter = { reverse = true },
CmpItemKindBorder = { fg = c.bgdark, bg = c.bgdark },
},
}
```
```lua
local function border(hl_name)
return {
{ '╭', hl_name },
{ '─', hl_name },
{ '╮', hl_name },
{ '│', hl_name },
{ '╯', hl_name },
{ '─', hl_name },
{ '╰', hl_name },
{ '│', hl_name },
}
end
cmp.setup {
window = {
completion = {
border = border 'CmpItemKindBorder'
},
documentation = {
border = border 'CmpItemKindBorder'
}
}
}
```
#### How to change styles
```lua
local dracula = require 'dracula'
dracula.setup {
override = {
['@type'] = { italic = true, bold = false },
['@function'] = { italic = false, bold = false },
['@comment'] = { italic = true },
['@keyword'] = { italic = false },
['@constant'] = { italic = false, bold = false },
['@variable'] = { italic = true },
['@field'] = { italic = true },
['@parameter'] = { italic = true },
}
}
vim.cmd 'colorscheme dracula'
```
#### How to customize Dracula colors
```lua
local dracula = require 'dracula'
dracula.setup {
colors = {
bg = '#color',
bgdark = '#color',
}
}
vim.cmd.colorscheme 'dracula'
```
#### How to find a Highlight group
To find a highlight group that you want to customize, you can use the `:Inspect` command.
This command shows the current highlight
groups being applied to the code in the current buffer. Here's how to use it:
Alternatively, you can use plugins like [Telescope](https://github.com/nvim-telescope/telescope.nvim) or
[Playground](https://github.com/nvim-treesitter/playground) to find the highlight groups you need to customize your colorscheme.
For example, you can use the `:Telescope highlights` command with the Telescope
plugin to list all the available highlight
groups and select the one you want to customize.

View file

@ -1,91 +0,0 @@
##### How to customize Dracula
To override a highlight group, you will need to use the
vim.api.nvim_set_hl() function.
This function allows you to set the colors for a specific highlight group.
Here's an example of how to use this function to set the color
of the CursorLineNr highlight group to yellow:
```lua
local dracula = require 'dracula'
dracula.setup {
callback = function (colors)
vim.api.nvim_set_hl(0, 'CursorLineNr', { fg = colors.yellow })
end
}
vim.cmd 'colorscheme dracula'
```
or
```lua
local dracula = require 'dracula'
local colors = require 'dracula.palettes'
dracula.setup {
override = {
CursorLineNr = { fg = colors.yellow }
}
}
vim.cmd 'colorscheme dracula'
```
![example1](https://user-images.githubusercontent.com/50273941/228698201-4a8a57fd-51e6-473a-aecd-4771cd07ad6f.png)
#### How to config styles
```lua
local dracula = require 'dracula'
dracula.setup {
override = {
['@type'] = { italic = true, bold = false },
['@function'] = { italic = false, bold = false },
['@comment'] = { italic = true },
['@keyword'] = { italic = false },
['@constant'] = { italic = false, bold = false },
['@variable'] = { italic = true },
['@field'] = { italic = true },
['@parameter'] = { italic = true },
-- read :h nvim_set_hl for more info
}
}
vim.cmd 'colorscheme dracula'
```
#### How to customize Dracula colors
In the previous example, we used the nvim_set_hl function
to change the CursorLineNr color. In this example,
we are overriding Dracula colors to change the background color:
```lua
local dracula = require 'dracula'
dracula.setup {
colors = {
bg = '#283630',
float_bg = '#202b26',
}
}
vim.cmd 'colorscheme dracula'
```
![example2](https://user-images.githubusercontent.com/50273941/228698426-6acd98f2-bc11-45a7-b217-744389265730.png)
#### How to find a Highlight group
To find a highlight group that you want to customize, you can use the `:Inspect command`.
This command shows the current highlight
groups being applied to the code in the current buffer. Here's how to use it:
Alternatively, you can use plugins like [Telescope](https://github.com/nvim-telescope/telescope.nvim) or
[Playground](https://github.com/nvim-treesitter/playground) to find the highlight groups you need to customize your colorscheme.
For example, you can use the `:Telescope highlights` command with the Telescope
plugin to list all the available highlight
groups and select the one you want to customize.

View file

@ -15,71 +15,27 @@ Below is a list of some plugin managers that you could install.
Here's an example of how to install dracula using the [lazy.nvim](https://github.com/folke/lazy.nvim) plugin manager:
```lua
local opts = {
install = {
missing = true,
colorscheme = { 'dracula' }
}
}
require('lazy').setup({
{
'maxmx03/dracula.nvim',
lazy = false, -- make sure we load this during startup if it is your main colorscheme
priority = 1000, -- make sure to load this before all the other start plugins
config = function ()
local dracula = require('dracula')
local dracula = require 'dracula'
dracula.setup({})
dracula.setup()
vim.cmd('colorscheme dracula')
vim.cmd.colorscheme 'dracula'
end
},
})
```
#### Configuration
The dracula.nvim theme can be configured using the following options:
`soft`
- Type: boolean
- Default: false
Set this option to true to enable the soft version of the Dracula color palette, which has reduced color saturation.
Set it to false to use the original, more vibrant colors.
`transparent`
- Type: boolean
- Default: false
`colors`
- Type: table or callback(colors: table)
- Default: dracula colors
`callback`
- Type: callback(colors: table)
`override`
- Type: table or callback(colors: table)
```lua
local dracula = require('dracula')
local colors = require('dracula.palettes')
dracula.setup({
soft = false,
transparent = false
colors = function (colors)
return {
error = colors.purple,
}
end,
override = {
['@function'] = { fg = colors.cyan, italic = true, bold = false }
},
callback = function (colors)
vim.api.nvim_set_hl(0, 'CursorLineNr', { fg = colors.yellow })
end
})
}, opts)
```
Lazy will install Dracula colorscheme in the following directories:

View file

@ -12,9 +12,13 @@ To preview the dracula.nvim colorscheme, click [here](https://github.com/maxmx03
All instructions can be found at [INSTALL.md](https://github.com/maxmx03/dracula.nvim/blob/master/INSTALL.md).
## How to customize
## How to config
All instructions can be found at [CUSTOMIZE.md](https://github.com/maxmx03/dracula.nvim/blob/master/CUSTOMIZE.md).
All instructions can be found at [CONFIG.md](https://github.com/maxmx03/dracula.nvim/blob/master/CONFIG.md).
## Dracula Pro
For users of Dracula Pro, plesae create a new private repository using this [template](https://github.com/maxmx03/master-template)
## Contributions

View file

@ -6,7 +6,7 @@ author = 'Max Miliano'
[palette]
fg = '#f8f8f2'
bg = '#282a36'
float_bg = '#21222c'
bgdark = '#21222c'
currentline = '#44475a'
selection = '#44475a'
comment = '#6272a4'
@ -61,14 +61,14 @@ Comment = 'comment - i'
Folded = 'comment selection'
FoldColumn = 'fg bg'
LineNr = 'comment bg'
FloatBorder = 'comment float_bg'
FloatBorder = 'comment bgdark'
Whitespace = 'bg -'
WinSeparator = 'comment float_bg'
WinSeparator = 'comment bgdark'
VertSplit = 'link:WinSeparator'
CursorLine = '- currentline'
CursorColumn = 'link:CursorLine'
ColorColumn = '- float_bg'
NormalFloat = 'fg float_bg'
ColorColumn = '- bgdark'
NormalFloat = 'fg bgdark'
Visual = '- selection'
VisualNOS = 'link:Visual'
WarningMsg = 'warning bg'
@ -373,13 +373,13 @@ NvimTreeRootFolder = 'link:Directory'
NvimTreeFolderIcon = 'link:Directory'
NvimTreeIndentMarker = 'link:Directory'
NvimTreeNormal = 'link:NormalFloat'
NvimTreeWinSeparator = 'float_bg float_bg'
NvimTreeWinSeparator = 'bgdark bgdark'
NvimTreeVertSplit = 'link:VertSplit'
NvimTreeFolderName = 'fg'
NvimTreeOpenedFolderName = 'purple - b'
NvimTreeOpenedFolderName = 'link:Directory'
NvimTreeEmptyFolderName = 'purple - i'
NvimTreeGitIgnored = 'comment - i'
NvimTreeEndOfBuffer = 'float_bg'
NvimTreeEndOfBuffer = 'bgdark'
NvimTreeCursorLine = 'link:CursorLine'
NvimTreeGitStaged = 'sign_add'
NvimTreeGitNew = 'sign_add'
@ -391,7 +391,7 @@ NvimTreeGitDirty = 'sign_change'
[NeoTree]
NeoTreeNormal = 'link:NormalFloat'
NeoTreeNormalNC = 'link:NormalFloat'
NeoTreeEndOfBuffer = 'float_bg'
NeoTreeEndOfBuffer = 'bgdark'
NeoTreeRootName = 'link:Directory'
NeoTreeFileName = 'fg'
NeoTreeFileNameOpened = 'purple - b'
@ -411,11 +411,11 @@ NeoTreeIndentMarker = 'blended_purple'
DapUINormal = 'link:NormalFloat'
[StatusLine]
StatusLine = 'fg float_bg'
StatusLineNC = 'float_bg float_bg'
StatusLineSeparator = 'float_bg'
StatusLineTerm = 'float_bg'
StatusLineTermNC = 'float_bg'
StatusLine = 'fg bgdark'
StatusLineNC = 'bgdark bgdark'
StatusLineSeparator = 'bgdark'
StatusLineTerm = 'bgdark'
StatusLineTermNC = 'bgdark'
[Dashboard]
DashboardHeader = 'red'
@ -581,10 +581,10 @@ MiniIndentscopeSymbol = 'blended_pink'
MiniIndentscopeSymbolOff = '- -'
[MiniMap]
MiniMapNormal = 'comment float_bg'
MiniMapNormal = 'comment bgdark'
MiniMapSymbolCount = 'purple'
MiniMapSymbolLine = 'pink'
MiniMapSymbolView = 'float_bg'
MiniMapSymbolView = 'bgdark'
[MiniStatusLine]
MiniStatuslineModeNormal = 'bg purple'

View file

@ -1,20 +1,19 @@
if vim.fn.has("nvim-0.9.0") == 1 then
vim.api.nvim_create_autocmd("LspTokenUpdate", {
if vim.fn.has 'nvim-0.9.0' == 1 then
vim.api.nvim_create_autocmd('LspTokenUpdate', {
callback = function(args)
local token = args.data.token
if token.type ~= "variable" or token.modifiers.readonly then
if token.type ~= 'variable' or token.modifiers.readonly then
return
end
local text =
vim.api.nvim_buf_get_text(args.buf, token.line, token.start_col, token.line, token.end_col, {})[1]
local text = vim.api.nvim_buf_get_text(args.buf, token.line, token.start_col, token.line, token.end_col, {})[1]
if text ~= string.upper(text) then
return
end
vim.lsp.semantic_tokens.highlight_token(token, args.buf, args.data.client_id, "@constant")
vim.lsp.semantic_tokens.highlight_token(token, args.buf, args.data.client_id, '@constant')
end,
})
end

View file

@ -1,65 +1,104 @@
local colors = require 'dracula.palettes'
local utils = require 'dracula.utils'
local M = {}
function M:new()
local config = {
soft = false,
transparent = false,
colors = {},
user_config = {},
}
local config = {
saturation = {
enabled = false,
amount = 10,
},
soft = false,
transparent = false,
dracula_pro = nil,
colors = colors,
user_config = {},
}
setmetatable(config, self)
self.__index = self
setmetatable(config, self)
self.__index = self
return config
return config
end
function M:set_colors()
if self.soft then
self.colors = require("dracula.palettes.soft")
return
end
if not self.soft then
return
end
self.colors = require("dracula.palettes")
self.colors = require 'dracula.palettes.soft'
end
function M:change_colors_saturation()
if self.saturation.enabled then
for i, color in pairs(self.colors) do
local new_color = utils.reduce_saturation(color, self.saturation.amount)
self.colors[i] = new_color
end
end
end
function M:set_user_colors()
if self.user_config.colors then
if vim.tbl_isempty(self.colors) then
return
end
if self.user_config.colors then
if vim.tbl_isempty(self.colors) then
return
end
if type(self.user_config.colors) == "table" then
self.colors = vim.tbl_extend("force", self.colors, self.user_config.colors)
return
end
if type(self.user_config.colors) == 'table' then
self.colors = vim.tbl_extend('force', self.colors, self.user_config.colors)
return
end
self.colors = vim.tbl_extend("force", self.colors, self.user_config.colors(self.colors))
end
self.colors = vim.tbl_extend('force', self.colors, self.user_config.colors(self.colors))
end
end
function M:set_soft(soft)
if soft then
self.soft = true
return
end
if soft then
self.soft = true
return
end
self.soft = false
self.soft = false
end
function M:set_saturation(saturation)
if not saturation then
return
end
if saturation.enabled then
self.saturation.enabled = true
if type(saturation.amount) == 'number' then
self.saturation.amount = saturation.amount
end
else
self.saturation.enabled = false
end
end
function M:set_transparent(transparent)
if transparent then
self.transparent = true
return
end
if transparent then
self.transparent = transparent
return
end
self.transparent = false
self.transparent = false
end
function M:call_user_callback(cb)
if type(cb) == "function" then
cb(self.colors)
end
if type(cb) == 'function' then
cb(self.colors)
end
end
function M:set_draculapro(dracula_pro)
if dracula_pro then
self.dracula_pro = dracula_pro
end
end
return M

View file

@ -1,55 +1,97 @@
require("dracula.autocmd")
local utils = require("dracula.utils")
local theme = require("dracula.theme")
local Config = require("dracula.config")
require 'dracula.autocmd'
local utils = require 'dracula.utils'
local theme = require 'dracula.theme'
local Config = require 'dracula.config'
local M = Config:new()
function M:apply_transparency()
if self.transparent then
return {
Normal = { bg = "NONE" },
SignColumn = { bg = "NONE" },
CursorLineNr = { bg = "NONE" },
LineNr = { bg = "NONE" },
}
end
local groups = {
Normal = { bg = 'NONE' },
SignColumn = { bg = 'NONE' },
CursorLineNr = { bg = 'NONE' },
LineNr = { bg = 'NONE' },
}
if self.transparent then
if self.transparent == 'full' then
local groups2 = {
NormalFloat = { bg = 'NONE' },
WinSeparator = { bg = 'NONE' },
NvimTreeWinSeparator = { link = 'WinSeparator' },
StatusLine = { bg = 'NONE' },
StatusLineNC = { bg = 'NONE' },
NvimTreeStatusLine = { bg = 'NONE' },
}
groups = vim.tbl_extend('keep', groups, groups2)
end
return groups
end
end
function M:support_draculapro()
if not self.dracula_pro then
return
end
local c = self.colors
local colors = {
pro = c.purple,
blade = c.green,
buffy = c.pink,
morbius = c.orange,
lincoln = c.yellow,
van_helsing = c.cyan,
}
local accent_color = colors[self.dracula_pro.theme]
return {
Directory = { fg = accent_color },
TelescopeTitle = { fg = accent_color, reverse = true },
CursorLineNr = { fg = c.fg },
}
end
function M.load_default()
if vim.g.colors_name then
vim.cmd("hi clear")
end
if vim.g.colors_name then
vim.cmd 'hi clear'
end
vim.o.background = "dark"
if vim.fn.exists("syntax_on") then
vim.cmd("syntax reset")
end
vim.o.background = 'dark'
if vim.fn.exists 'syntax_on' then
vim.cmd 'syntax reset'
end
vim.o.termguicolors = true
vim.g.colors_name = "dracula"
vim.o.termguicolors = true
vim.g.colors_name = 'dracula'
end
M.setup = function(user_config)
M.load_default()
M.load_default()
if vim.tbl_isempty(M.user_config) then
M.user_config = user_config or {}
end
if vim.tbl_isempty(M.user_config) then
M.user_config = user_config or {}
end
M:set_soft(M.user_config.soft)
M:set_transparent(M.user_config.transparent)
M:set_colors()
M:set_user_colors()
M:set_soft(M.user_config.soft)
M:set_colors()
M:set_saturation(M.user_config.saturation)
M:set_transparent(M.user_config.transparent)
M:set_draculapro(M.user_config.dracula_pro)
M:set_user_colors()
M:change_colors_saturation()
theme.set_highlights(M.colors)
theme.set_highlights(M.colors)
if type(M.user_config.override) == "function" then
M.user_config.override = M.user_config.override(M.colors)
end
if type(M.user_config.override) == 'function' then
M.user_config.override = M.user_config.override(M.colors)
end
utils.update_highlight_groups(M.user_config.override)
utils.update_highlight_groups(M:apply_transparency())
M:call_user_callback(M.user_config.callback)
utils.update_highlight_groups(M.user_config.override)
utils.update_highlight_groups(M:apply_transparency())
utils.update_highlight_groups(M:support_draculapro())
M:call_user_callback(M.user_config.callback)
end
return M

View file

@ -1,41 +1,41 @@
local colors = {
fg = "#f8f8f2",
bg = "#282a36",
float_bg = "#21222c",
currentline = "#44475a",
selection = "#44475a",
comment = "#6272a4",
cyan = "#8be9fd",
green = "#50fa7b",
orange = "#ffb86c",
pink = "#ff79c6",
purple = "#bd93f9",
red = "#ff5555",
yellow = "#f1fa8c",
cursor_fg = "#282a36",
cursor_bg = "#f8f8f2",
sign_add = "#50fa7b",
sign_change = "#ffb866",
sign_delete = "#ff5555",
error = "#ff555b",
warning = "#ffb866",
info = "#8be9fd",
hint = "#8be9fd",
other = "#bd93f9",
blended_orange = "#483F3E",
blended_red = "#48303B",
blended_cyan = "#374754",
blended_green = "#2E4940",
fg = '#f8f8f2',
bg = '#282a36',
bgdark = '#21222c',
currentline = '#44475a',
selection = '#44475a',
comment = '#6272a4',
cyan = '#8be9fd',
green = '#50fa7b',
orange = '#ffb86c',
pink = '#ff79c6',
purple = '#bd93f9',
red = '#ff5555',
yellow = '#f1fa8c',
cursor_fg = '#282a36',
cursor_bg = '#f8f8f2',
sign_add = '#50fa7b',
sign_change = '#ffb866',
sign_delete = '#ff5555',
error = '#ff555b',
warning = '#ffb866',
info = '#8be9fd',
hint = '#8be9fd',
other = '#bd93f9',
blended_orange = '#483F3E',
blended_red = '#48303B',
blended_cyan = '#374754',
blended_green = '#2E4940',
blended_yellow = '#464943',
blended_purple = "#3E3A53",
blended_pink = "#5E3E5A",
blended_add = "#2E4940",
blended_change = "#483F3E",
blended_warning = "#483F3E",
blended_error = "#48303B",
blended_info = "#374754",
blended_hint = "#374754",
blended_other = "#3E3A53",
blended_purple = '#3E3A53',
blended_pink = '#5E3E5A',
blended_add = '#2E4940',
blended_change = '#483F3E',
blended_warning = '#483F3E',
blended_error = '#48303B',
blended_info = '#374754',
blended_hint = '#374754',
blended_other = '#3E3A53',
}
return colors

View file

@ -1,41 +1,41 @@
local colors = {
fg = "#f8f8f2",
bg = "#282a36",
float_bg = "#262626",
currentline = "#44475a",
selection = "#44475a",
comment = "#7b7f8b",
cyan = "#adf6f6",
green = "#62e884",
orange = "#ffb86c",
pink = "#f286c4",
purple = "#bf9eee",
red = "#ee6666",
yellow = "#e7ee98",
cursor_fg = "#282a36",
cursor_bg = "#f8f8f2",
sign_add = "#62e884",
sign_change = "#ffb866",
sign_delete = "#ee6666",
error = "#ee6666",
warning = "#ffb866",
info = "#97e1f1",
hint = "#97e1f1",
other = "#bf9eee",
blended_orange = "#483F3E",
blended_red = "#46333D",
blended_cyan = "#394552",
blended_green = "#314742",
fg = '#f8f8f2',
bg = '#282a36',
bgdark = '#262626',
currentline = '#44475a',
selection = '#44475a',
comment = '#7b7f8b',
cyan = '#adf6f6',
green = '#62e884',
orange = '#ffb86c',
pink = '#f286c4',
purple = '#bf9eee',
red = '#ee6666',
yellow = '#e7ee98',
cursor_fg = '#282a36',
cursor_bg = '#f8f8f2',
sign_add = '#62e884',
sign_change = '#ffb866',
sign_delete = '#ee6666',
error = '#ee6666',
warning = '#ffb866',
info = '#97e1f1',
hint = '#97e1f1',
other = '#bf9eee',
blended_orange = '#483F3E',
blended_red = '#46333D',
blended_cyan = '#394552',
blended_green = '#314742',
blended_yellow = '#454745',
blended_purple = "#3F3B52",
blended_pink = "#5B415A",
blended_add = "#314742",
blended_change = "#483F3E",
blended_warning = "#483F3E",
blended_error = "#46333D",
blended_info = "#394552",
blended_hint = "#394552",
blended_other = "#3F3B52",
blended_purple = '#3F3B52',
blended_pink = '#5B415A',
blended_add = '#314742',
blended_change = '#483F3E',
blended_warning = '#483F3E',
blended_error = '#46333D',
blended_info = '#394552',
blended_hint = '#394552',
blended_other = '#3F3B52',
}
return colors

File diff suppressed because it is too large Load diff

View file

@ -1,29 +1,113 @@
local M = {}
function M.get_hl(group_name)
local group = vim.api.nvim_get_hl(0, { name = group_name, link = false })
local group = vim.api.nvim_get_hl(0, { name = group_name, link = false })
if type(group) == "table" then
return group
end
if type(group) == 'table' then
return group
end
return nil
return nil
end
function M.update_highlight_groups(groups)
if not groups then
return
end
if not groups then
return
end
for group_name, val in pairs(groups) do
local group_val = M.get_hl(group_name)
for group_name, val in pairs(groups) do
local group_val = M.get_hl(group_name)
if type(group_val) == "table" then
local value = vim.tbl_extend("force", group_val, val)
if type(group_val) == 'table' then
local value = vim.tbl_extend('force', group_val, val)
vim.api.nvim_set_hl(0, group_name, value)
end
end
vim.api.nvim_set_hl(0, group_name, value)
end
end
end
local function hsl_to_rgb(h, s, l)
local r, g, b = 0, 0, 0
if s == 0 then
r, g, b = l, l, l
else
local function hue_to_rgb(p, q, t)
if t < 0 then
t = t + 1
end
if t > 1 then
t = t - 1
end
if t < 1 / 6 then
return p + (q - p) * 6 * t
end
if t < 1 / 2 then
return q
end
if t < 2 / 3 then
return p + (q - p) * (2 / 3 - t) * 6
end
return p
end
local q = l < 0.5 and l * (1 + s) or l + s - l * s
local p = 2 * l - q
r = hue_to_rgb(p, q, h + 1 / 3)
g = hue_to_rgb(p, q, h)
b = hue_to_rgb(p, q, h - 1 / 3)
end
return math.floor(r * 255 + 0.5), math.floor(g * 255 + 0.5), math.floor(b * 255 + 0.5)
end
local function rgb_to_hsl(r, g, b)
r, g, b = r / 255, g / 255, b / 255
local maxval = math.max(r, g, b)
local minval = math.min(r, g, b)
local h, s, l = 0, 0, (maxval + minval) / 2
if maxval ~= minval then
local d = maxval - minval
s = l > 0.5 and d / (2 - maxval - minval) or d / (maxval + minval)
if maxval == r then
h = (g - b) / d + (g < b and 6 or 0)
elseif maxval == g then
h = (b - r) / d + 2
else
h = (r - g) / d + 4
end
h = h / 6
end
return h, s, l
end
function M.reduce_saturation(color, amount)
-- remove "#" prefix if present
color = color:gsub('^#', '')
-- split the color into its red, green, and blue components
local r = tonumber(color:sub(1, 2), 16)
local g = tonumber(color:sub(3, 4), 16)
local b = tonumber(color:sub(5, 6), 16)
-- convert the RGB color to HSL
local h, s, l = rgb_to_hsl(r, g, b)
-- reduce the saturation by the specified amount
s = s * (1 - amount / 100)
-- convert the HSL color back to RGB
r, g, b = hsl_to_rgb(h, s, l)
-- convert the RGB color back to hexadecimal
return string.format('#%02x%02x%02x', r, g, b)
end
return M

View file

@ -1,47 +1,35 @@
local dracula = require("dracula")
local c = dracula.colors
local colors = {
bgdark = c.float_bg,
lightgray = c.comment,
blended_purple = c.blended_purple,
purple = c.purple,
red = c.red,
yellow = c.yellow,
green = c.green,
white = c.fg,
bg = c.bg,
}
local dracula = require 'dracula'
local colors = dracula.colors
return {
normal = {
a = { bg = colors.purple, fg = colors.bg, gui = "bold" },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.bgdark, fg = colors.white },
},
insert = {
a = { bg = colors.green, fg = colors.bg, gui = "bold" },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.bgdark, fg = colors.white },
},
visual = {
a = { bg = colors.yellow, fg = colors.bg, gui = "bold" },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.bgdark, fg = colors.white },
},
replace = {
a = { bg = colors.red, fg = colors.bg, gui = "bold" },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.bgdark, fg = colors.white },
},
command = {
a = { bg = colors.blended_purple, fg = colors.purple, gui = "bold" },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.bgdark, fg = colors.white },
},
inactive = {
a = { bg = colors.bgdark, fg = colors.white, gui = "bold" },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.bgdark, fg = colors.white },
},
normal = {
a = { bg = colors.purple, fg = colors.bg, gui = 'bold' },
b = { bg = colors.comment, fg = colors.fg },
c = { bg = colors.bgdark, fg = colors.fg },
},
insert = {
a = { bg = colors.green, fg = colors.bg, gui = 'bold' },
b = { bg = colors.comment, fg = colors.fg },
c = { bg = colors.bgdark, fg = colors.fg },
},
visual = {
a = { bg = colors.yellow, fg = colors.bg, gui = 'bold' },
b = { bg = colors.comment, fg = colors.fg },
c = { bg = colors.bgdark, fg = colors.fg },
},
replace = {
a = { bg = colors.red, fg = colors.bg, gui = 'bold' },
b = { bg = colors.comment, fg = colors.fg },
c = { bg = colors.bgdark, fg = colors.fg },
},
command = {
a = { bg = colors.blended_purple, fg = colors.purple, gui = 'bold' },
b = { bg = colors.comment, fg = colors.fg },
c = { bg = colors.bgdark, fg = colors.fg },
},
inactive = {
a = { bg = colors.bgdark, fg = colors.fg, gui = 'bold' },
b = { bg = colors.comment, fg = colors.fg },
c = { bg = colors.bgdark, fg = colors.fg },
},
}

6
stylua.toml Normal file
View file

@ -0,0 +1,6 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "None"