diff --git a/CONFIG.md b/CONFIG.md new file mode 100644 index 0000000..b8c0f29 --- /dev/null +++ b/CONFIG.md @@ -0,0 +1,155 @@ +#### Configuration + +The dracula.nvim theme can be configured using the following options: + +| Name | type | values | Description | +| ----------- | ---------------- | -------------------------------- | -------------------------------------------------------------------------------------- | +| soft | boolean | true, false | enable soft version of dracula theme | +| transparent | boolean, string | true, false, "full" | change background to transparent | +| saturation | table | { enabled = false, amount = 10 } | change colorscheme saturation colors | +| dracula_pro | plugin | require('draculapro') | give support for [dracula pro](https://draculatheme.com/pro) theme inside dracula.nvim | +| override | table / function | {} | update or create highlight groups | +| callback | function | function | alternative to override, for customize 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, 'CmpItemKindBorder', { link = 'WinSeparator' }) + 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.float_bg, bg = c.float_bg }, + }, +} +``` + +```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. diff --git a/CUSTOMIZE.md b/CUSTOMIZE.md deleted file mode 100644 index 8cb5d36..0000000 --- a/CUSTOMIZE.md +++ /dev/null @@ -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. diff --git a/INSTALL.md b/INSTALL.md index 668a8dd..35b088b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -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: Table -- Default: { enabled = false, amount = 10 } - -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: diff --git a/README.md b/README.md index 7a58fe1..b32270e 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ 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