refactor!: make dracula cleaner
authorTran Duc Binh <binhtran432k@gmail.com>
Mon, 22 Aug 2022 01:37:43 +0000 (08:37 +0700)
committerTran Duc Binh <binhtran432k@gmail.com>
Mon, 22 Aug 2022 01:49:13 +0000 (08:49 +0700)
.editorconfig [new file with mode: 0644]
.luarc.json [new file with mode: 0644]
colors/dracula.lua
lua/dracula/init.lua
lua/lualine/themes/dracula-nvim.lua

diff --git a/.editorconfig b/.editorconfig
new file mode 100644 (file)
index 0000000..151984e
--- /dev/null
@@ -0,0 +1,5 @@
+root = true
+
+[*.lua]
+indent_style = space
+indent_size = 3
diff --git a/.luarc.json b/.luarc.json
new file mode 100644 (file)
index 0000000..02573a8
--- /dev/null
@@ -0,0 +1,10 @@
+{
+    "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
+    "Lua.diagnostics.globals": [
+        "vim"
+    ],
+    "Lua.runtime.path": [
+        "lua/?.lua",
+        "lua/?/init.lua"
+    ]
+}
index 7164abcf32b7c425a98d72c0282f6857f8ddc5eb..91f894b0abd55e8f13444030ccfe793b59e7a808 100644 (file)
@@ -1,13 +1 @@
-local dracula = require("dracula")
-
-vim.cmd("hi clear")
-
-if vim.fn.exists("syntax_on") then
-       vim.cmd("syntax reset")
-end
-
-vim.o.background = "dark"
-vim.o.termguicolors = true
-vim.g.colors_name = "dracula"
-
-dracula.apply();
+require("dracula").setup()
index 8baa570499aca9e38b78f2daf863b2577049fbfd..afdc3b4c41ddb973c39cffdd23409ec633cc1448 100644 (file)
--- Dracula color scheme
-
-local M = {}
-
-local DEFAULT_COLORS = {
-  bg = "#282A36",
-  fg = "#F8F8F2",
-  selection = "#44475A",
-  comment = "#6272A4",
-  red = "#FF5555",
-  orange = "#FFB86C",
-  yellow = "#F1FA8C",
-  green = "#50fa7b",
-  purple = "#BD93F9",
-  cyan = "#8BE9FD",
-  pink = "#FF79C6",
-  bright_red = "#FF6E6E",
-  bright_green = "#69FF94",
-  bright_yellow = "#FFFFA5",
-  bright_blue = "#D6ACFF",
-  bright_magenta = "#FF92DF",
-  bright_cyan = "#A4FFFF",
-  bright_white = "#FFFFFF",
-  menu = "#21222C",
-  visual = "#3E4452",
-  gutter_fg = "#4B5263",
-  nontext = "#3B4048",
-  white = "#ABB2BF",
-  black = "#191A21",
+local o = vim.o
+local g = vim.g
+local cmd = vim.cmd
+
+---@class DefaultConfig
+local DEFAULT_OPTIONS = {
+   italic_comment = g.dracula_italic_comment,
+   transparent_bg = g.dracula_transparent_bg,
+   show_end_of_buffer = g.dracula_show_end_of_buffer,
+   lualine_bg_color = g.dracula_lualine_bg_color,
+   colors = {
+      bg = "#282A36",
+      fg = "#F8F8F2",
+      selection = "#44475A",
+      comment = "#6272A4",
+      red = "#FF5555",
+      orange = "#FFB86C",
+      yellow = "#F1FA8C",
+      green = "#50fa7b",
+      purple = "#BD93F9",
+      cyan = "#8BE9FD",
+      pink = "#FF79C6",
+      bright_red = "#FF6E6E",
+      bright_green = "#69FF94",
+      bright_yellow = "#FFFFA5",
+      bright_blue = "#D6ACFF",
+      bright_magenta = "#FF92DF",
+      bright_cyan = "#A4FFFF",
+      bright_white = "#FFFFFF",
+      menu = "#21222C",
+      visual = "#3E4452",
+      gutter_fg = "#4B5263",
+      nontext = "#3B4048",
+      white = "#ABB2BF",
+      black = "#191A21",
+   },
 }
 
-local colors = vim.tbl_deep_extend('force', DEFAULT_COLORS, vim.g.dracula_colors or {})
+local TRANSPARENTS = {
+   "Normal",
+   "SignColumn",
+   "NvimTreeNormal",
+   "NvimTreeVertSplit",
+}
 
-M.colors = function()
-  return colors
+local function apply_term_colors(colors)
+   g.terminal_color_0 = colors.black
+   g.terminal_color_1 = colors.red
+   g.terminal_color_2 = colors.green
+   g.terminal_color_3 = colors.yellow
+   g.terminal_color_4 = colors.purple
+   g.terminal_color_5 = colors.pink
+   g.terminal_color_6 = colors.cyan
+   g.terminal_color_7 = colors.white
+   g.terminal_color_8 = colors.selection
+   g.terminal_color_9 = colors.bright_red
+   g.terminal_color_10 = colors.bright_green
+   g.terminal_color_11 = colors.bright_yellow
+   g.terminal_color_12 = colors.bright_blue
+   g.terminal_color_13 = colors.bright_magenta
+   g.terminal_color_14 = colors.bright_cyan
+   g.terminal_color_15 = colors.bright_white
+   g.terminal_color_background = colors.bg
+   g.terminal_color_foreground = colors.fg
 end
 
-M.apply_term_colors = function(colors)
-       vim.g.terminal_color_0 = colors.black
-       vim.g.terminal_color_1 = colors.red
-       vim.g.terminal_color_2 = colors.green
-       vim.g.terminal_color_3 = colors.yellow
-       vim.g.terminal_color_4 = colors.purple
-       vim.g.terminal_color_5 = colors.pink
-       vim.g.terminal_color_6 = colors.cyan
-       vim.g.terminal_color_7 = colors.white
-       vim.g.terminal_color_8 = colors.selection
-       vim.g.terminal_color_9 = colors.bright_red
-       vim.g.terminal_color_10 = colors.bright_green
-       vim.g.terminal_color_11 = colors.bright_yellow
-       vim.g.terminal_color_12 = colors.bright_blue
-       vim.g.terminal_color_13 = colors.bright_magenta
-       vim.g.terminal_color_14 = colors.bright_cyan
-       vim.g.terminal_color_15 = colors.bright_white
-       vim.g.terminal_color_background = colors.bg
-       vim.g.terminal_color_foreground = colors.fg
+---apply dracula colorscheme
+---@param opts DefaultConfig
+local function apply(opts)
+   local isItalic = opts.italic_comment
+   local isShowBufEnd = opts.show_end_of_buffer
+   local colors = opts.colors
+   apply_term_colors(colors)
+
+   -- highlight(Group, Foreground, Backgroud, Attribute, Special)
+   local highlights = {
+      Normal = { fg = colors.fg, bg = colors.bg, },
+      NormalFloat = { fg = colors.fg, bg = colors.bg, },
+      Comment = { fg = colors.comment, attr = isItalic and "italic" or nil, },
+      Constant = { fg = colors.yellow, },
+      String = { fg = colors.yellow, },
+      Character = { fg = colors.green, },
+      Number = { fg = colors.orange, },
+      Boolean = { fg = colors.cyan, },
+      Float = { fg = colors.orange, },
+      FloatBorder = { fg = colors.white, },
+      Operator = { fg = colors.purple, },
+      Keyword = { fg = colors.cyan, },
+      Keywords = { fg = colors.cyan, },
+      Identifier = { fg = colors.cyan, },
+      Function = { fg = colors.yellow, },
+      Statement = { fg = colors.purple, },
+      Conditional = { fg = colors.pink, },
+      Repeat = { fg = colors.pink, },
+      Label = { fg = colors.cyan, },
+      Exception = { fg = colors.purple, },
+      PreProc = { fg = colors.yellow, },
+      Include = { fg = colors.purple, },
+      Define = { fg = colors.purple, },
+      Title = { fg = colors.cyan, },
+      Macro = { fg = colors.purple, },
+      PreCondit = { fg = colors.cyan, },
+      Type = { fg = colors.cyan, },
+      StorageClass = { fg = colors.pink, },
+      Structure = { fg = colors.yellow, },
+      TypeDef = { fg = colors.yellow, },
+      Special = { fg = colors.green, attr = "italic", },
+      SpecialComment = { fg = colors.comment, attr = "italic", },
+      Error = { fg = colors.bright_red, },
+      Todo = { fg = colors.purple, attr = "bold,italic", },
+      Underlined = { fg = colors.cyan, attr = "underline", },
+
+      Cursor = { attr = "reverse", },
+      CursorLineNr = { fg = colors.fg, attr = "bold", },
+
+      SignColumn = { bg = colors.bg, },
+
+      Conceal = { fg = colors.comment, },
+      CursorColumn = { bg = colors.black, },
+      CursorLine = { bg = colors.selection, },
+      ColorColumn = { bg = colors.selection, },
+
+      StatusLine = { fg = colors.white, bg = colors.black, },
+      StatusLineNC = { fg = colors.comment, },
+      StatusLineTerm = { fg = colors.white, bg = colors.black, },
+      StatusLineTermNC = { fg = colors.comment, },
+
+      Directory = { fg = colors.cyan, },
+      DiffAdd = { fg = colors.bg, bg = colors.green, },
+      DiffChange = { fg = colors.orange, },
+      DiffDelete = { fg = colors.red, },
+      DiffText = { fg = colors.comment, },
+
+      ErrorMsg = { fg = colors.bright_red, },
+      VertSplit = { fg = colors.black, },
+      Folded = { fg = colors.comment, },
+      FoldColumn = {},
+      Search = { fg = colors.black, bg = colors.orange, },
+      IncSearch = { fg = colors.orange, bg = colors.comment, },
+      LineNr = { fg = colors.comment, },
+      MatchParen = { fg = colors.fg, attr = "underline", },
+      NonText = { fg = colors.nontext, },
+      Pmenu = { fg = colors.white, bg = colors.menu, },
+      PmenuSel = { fg = colors.white, bg = colors.selection, },
+      PmenuSbar = { bg = colors.bg, },
+      PmenuThumb = { bg = colors.selection, },
+
+      Question = { fg = colors.purple, },
+      QuickFixLine = { fg = colors.black, bg = colors.yellow, },
+      SpecialKey = { fg = colors.nontext, },
+
+      SpellBad = { fg = colors.bright_red, attr = "underline", },
+      SpellCap = { fg = colors.yellow, },
+      SpellLocal = { fg = colors.yellow, },
+      SpellRare = { fg = colors.yellow, },
+
+      TabLine = { fg = colors.comment, },
+      TabLineSel = { fg = colors.white, },
+      TabLineFill = { bg = colors.bg, },
+      Terminal = { fg = colors.white, bg = colors.black, },
+      Visual = { bg = colors.visual, },
+      VisualNOS = { fg = colors.visual, },
+      WarningMsg = { fg = colors.yellow, },
+      WildMenu = { fg = colors.black, bg = colors.white, },
+
+      EndOfBuffer = { fg = isShowBufEnd and colors.visual or colors.bg, },
+
+      -- TreeSitter
+      TSError = { fg = colors.bright_red, },
+      TSPunctDelimiter = { fg = colors.fg, },
+      TSPunctBracket = { fg = colors.fg, },
+      TSPunctSpecial = { fg = colors.fg, },
+
+      TSConstant = { fg = colors.purple, },
+      TSConstantBuiltin = { fg = colors.purple, },
+
+      TSConstMacro = { fg = colors.cyan, },
+      TSStringRegex = { fg = colors.red, },
+      TSString = { fg = colors.yellow, },
+      TSStringEscape = { fg = colors.cyan, },
+      TSCharacter = { fg = colors.green, },
+      TSNumber = { fg = colors.purple, },
+      TSBoolean = { fg = colors.purple, },
+      TSFloat = { fg = colors.green, },
+      TSAnnotation = { fg = colors.yellow, },
+      TSAttribute = { fg = colors.cyan, },
+      TSNamespace = { fg = colors.orange, },
+
+      TSFuncBuiltin = { fg = colors.cyan, },
+      TSFunction = { fg = colors.green, },
+      TSFuncMacro = { fg = colors.green, },
+      TSParameter = { fg = colors.orange, },
+      TSParameterReference = { fg = colors.orange, },
+      TSMethod = { fg = colors.green, },
+      TSField = { fg = colors.orange, },
+      TSProperty = { fg = colors.fg, },
+      TSConstructor = { fg = colors.cyan, },
+
+      TSConditional = { fg = colors.pink, },
+      TSRepeat = { fg = colors.pink, },
+      TSLabel = { fg = colors.cyan, },
+
+      TSKeyword = { fg = colors.pink, },
+      TSKeywordFunction = { fg = colors.cyan, },
+      TSKeywordOperator = { fg = colors.pink, },
+      TSOperator = { fg = colors.pink, },
+      TSException = { fg = colors.purple, },
+      TSType = { fg = colors.bright_cyan, },
+      TSTypeBuiltin = { fg = colors.cyan, attr = "italic", },
+      TSStructure = { fg = colors.purple, },
+      TSInclude = { fg = colors.pink, },
+
+      TSVariable = { fg = colors.fg, },
+      TSVariableBuiltin = { fg = colors.purple, },
+
+      TSText = { fg = colors.orange, },
+      TSStrong = { fg = colors.orange, attr = "bold", }, -- bold
+      TSEmphasis = { fg = colors.yellow, attr = "italic", }, -- italic
+      TSUnderline = { fg = colors.orange, },
+      TSTitle = { fg = colors.pink, }, -- title
+      TSLiteral = { fg = colors.yellow, }, -- inline code
+      TSURI = { fg = colors.yellow, attr = "italic", }, -- urls
+
+      TSTag = { fg = colors.cyan, },
+      TSTagDelimiter = { fg = colors.white, },
+
+      -- HTML
+      htmlArg = { fg = colors.yellow, },
+      htmlBold = { fg = colors.yellow, attr = "bold", },
+      htmlEndTag = { fg = colors.white, },
+      htmlH1 = { fg = colors.pink, },
+      htmlH2 = { fg = colors.pink, },
+      htmlH3 = { fg = colors.pink, },
+      htmlH4 = { fg = colors.pink, },
+      htmlH5 = { fg = colors.pink, },
+      htmlH6 = { fg = colors.pink, },
+      htmlItalic = { fg = colors.purple, attr = "italic", },
+      htmlLink = { fg = colors.purple, attr = "underline", },
+      htmlSpecialChar = { fg = colors.yellow, },
+      htmlSpecialTagName = { fg = colors.cyan, },
+      htmlTag = { fg = colors.pink, },
+      htmlTagN = { fg = colors.pink, },
+      htmlTagName = { fg = colors.cyan, },
+      htmlTitle = { fg = colors.white, },
+
+      -- Markdown
+      markdownBlockquote = { fg = colors.yellow, attr = "italic", },
+      markdownBold = { fg = colors.orange, attr = "bold", },
+      markdownCode = { fg = colors.green, },
+      markdownCodeBlock = { fg = colors.orange, },
+      markdownCodeDelimiter = { fg = colors.red, },
+      markdownH1 = { fg = colors.pink, attr = "bold", },
+      markdownH2 = { fg = colors.pink, attr = "bold", },
+      markdownH3 = { fg = colors.pink, attr = "bold", },
+      markdownH4 = { fg = colors.pink, attr = "bold", },
+      markdownH5 = { fg = colors.pink, attr = "bold", },
+      markdownH6 = { fg = colors.pink, attr = "bold", },
+      markdownHeadingDelimiter = { fg = colors.red, },
+      markdownHeadingRule = { fg = colors.comment, },
+      markdownId = { fg = colors.purple, },
+      markdownIdDeclaration = { fg = colors.cyan, },
+      markdownIdDelimiter = { fg = colors.purple, },
+      markdownItalic = { fg = colors.yellow, attr = "italic", },
+      markdownLinkDelimiter = { fg = colors.purple, },
+      markdownLinkText = { fg = colors.pink, },
+      markdownListMarker = { fg = colors.cyan, },
+      markdownOrderedListMarker = { fg = colors.red, },
+      markdownRule = { fg = colors.comment, },
+
+      --  Diff
+      diffAdded = { fg = colors.green, },
+      diffRemoved = { fg = colors.red, },
+      diffFileId = { fg = colors.yellow, attr = "bold,reverse", },
+      diffFile = { fg = colors.nontext, },
+      diffNewFile = { fg = colors.green, },
+      diffOldFile = { fg = colors.red, },
+
+      debugPc = { bg = colors.cyan, },
+      debugBreakpoint = { fg = colors.red, attr = "reverse", },
+
+      -- Git Signs
+      GitSignsAdd = { fg = colors.bright_green, },
+      GitSignsChange = { fg = colors.cyan, },
+      GitSignsDelete = { fg = colors.bright_red, },
+      GitSignsAddLn = { fg = colors.black, bg = colors.bright_green, },
+      GitSignsChangeLn = { fg = colors.black, bg = colors.cyan, },
+      GitSignsDeleteLn = { fg = colors.black, bg = colors.bright_red, },
+
+      -- Telescope
+      TelescopePromptBorder = { fg = colors.comment, },
+      TelescopeResultsBorder = { fg = colors.comment, },
+      TelescopePreviewBorder = { fg = colors.comment, },
+      TelescopeSelection = { fg = colors.white, bg = colors.selection, },
+      TelescopeMultiSelection = { fg = colors.purple, bg = colors.selection, },
+      TelescopeNormal = { fg = colors.fg, bg = colors.bg, },
+      TelescopeMatching = { fg = colors.green, },
+      TelescopePromptPrefix = { fg = colors.purple, },
+
+      -- NvimTree
+      NvimTreeNormal = { fg = colors.fg, bg = colors.menu, },
+      NvimTreeVertSplit = { fg = colors.bg, bg = colors.bg, },
+      NvimTreeRootFolder = { fg = colors.fg, attr = "bold", },
+      NvimTreeGitDirty = { fg = colors.yellow, },
+      NvimTreeGitNew = { fg = colors.bright_green, },
+      NvimTreeImageFile = { fg = colors.pink, },
+      NvimTreeFolderIcon = { fg = colors.purple, },
+      NvimTreeIndentMarker = { fg = colors.nontext, },
+      NvimTreeEmptyFolderName = { fg = colors.comment, },
+      NvimTreeFolderName = { fg = colors.fg, },
+      NvimTreeSpecialFile = { fg = colors.pink, attr = "underline", },
+      NvimTreeOpenedFolderName = { fg = colors.fg, },
+      NvimTreeCursorLine = { bg = colors.selection, },
+      NvimTreeIn = { bg = colors.selection, },
+
+      NvimTreeEndOfBuffer = { fg = isShowBufEnd and colors.visual or colors.bg, },
+
+      -- Bufferline
+      BufferLineIndicatorSelected = { fg = colors.purple, },
+      BufferLineFill = { bg = colors.black, },
+
+      -- LSP
+      DiagnosticError = { fg = colors.red, },
+      DiagnosticWarn = { fg = colors.yellow, },
+      DiagnosticInfo = { fg = colors.cyan, },
+      DiagnosticHint = { fg = colors.cyan, },
+      DiagnosticUnderlineError = { attr = "undercurl", sp = colors.red, },
+      DiagnosticUnderlineWarn = { attr = "undercurl", sp = colors.yellow, },
+      DiagnosticUnderlineInfo = { attr = "undercurl", sp = colors.cyan, },
+      DiagnosticUnderlineHint = { attr = "undercurl", sp = colors.cyan, },
+      DiagnosticSignError = { fg = colors.red, },
+      DiagnosticSignWarn = { fg = colors.yellow, },
+      DiagnosticSignInfo = { fg = colors.cyan, },
+      DiagnosticSignHint = { fg = colors.cyan, },
+      DiagnosticFloatingError = { fg = colors.red, },
+      DiagnosticFloatingWarn = { fg = colors.yellow, },
+      DiagnosticFloatingInfo = { fg = colors.cyan, },
+      DiagnosticFloatingHint = { fg = colors.cyan, },
+      DiagnosticVirtualTextError = { fg = colors.red, },
+      DiagnosticVirtualTextWarn = { fg = colors.yellow, },
+      DiagnosticVirtualTextInfo = { fg = colors.cyan, },
+      DiagnosticVirtualTextHint = { fg = colors.cyan, },
+
+      LspDiagnosticsDefaultError = { fg = colors.red, },
+      LspDiagnosticsDefaultWarning = { fg = colors.yellow, },
+      LspDiagnosticsDefaultInformation = { fg = colors.cyan, },
+      LspDiagnosticsDefaultHint = { fg = colors.cyan, },
+      LspDiagnosticsUnderlineError = { fg = colors.red, attr = "undercurl", },
+      LspDiagnosticsUnderlineWarning = { fg = colors.yellow, attr = "undercurl", },
+      LspDiagnosticsUnderlineInformation = { fg = colors.cyan, attr = "undercurl", },
+      LspDiagnosticsUnderlineHint = { fg = colors.cyan, attr = "undercurl", },
+      LspReferenceText = { fg = colors.orange, },
+      LspReferenceRead = { fg = colors.orange, },
+      LspReferenceWrite = { fg = colors.orange, },
+
+      --LSP Saga
+      LspFloatWinNormal = { fg = colors.fg, },
+      LspFloatWinBorder = { fg = colors.comment, },
+      LspSagaHoverBorder = { fg = colors.comment, },
+      LspSagaSignatureHelpBorder = { fg = colors.comment, },
+      LspSagaCodeActionBorder = { fg = colors.comment, },
+      LspSagaDefPreviewBorder = { fg = colors.comment, },
+      LspLinesDiagBorder = { fg = colors.comment, },
+      LspSagaRenameBorder = { fg = colors.comment, },
+      LspSagaBorderTitle = { fg = colors.menu, },
+      LSPSagaDiagnosticTruncateLine = { fg = colors.comment, },
+      LspSagaDiagnosticBorder = { fg = colors.comment, },
+      LspSagaShTruncateLine = { fg = colors.comment, },
+      LspSagaDocTruncateLine = { fg = colors.comment, },
+      LspSagaLspFinderBorder = { fg = colors.comment, },
+
+      -- IndentBlankLine
+      IndentBlanklineContextChar = { fg = colors.bright_red, attr = "nocombine", },
+
+      -- Nvim compe
+      CmpItemAbbrDeprecated = { fg = colors.white, bg = colors.menu, },
+      CmpItemAbbrMatch = { fg = colors.cyan, bg = colors.menu, },
+
+      --barbar
+      BufferCurrentTarget = { fg = colors.red, },
+      BufferVisibleTarget = { fg = colors.red, },
+      BufferInactiveTarget = { fg = colors.red, },
+
+      -- Compe
+      CompeDocumentation = "Pmenu",
+      CompeDocumentationBorder = "Pmenu",
+
+      -- Cmp
+      CmpItemKind = "Pmenu",
+      CmpItemAbbr = "Pmenu",
+      CmpItemKindMethod = "TSMethod",
+      CmpItemKindText = "TSText",
+      CmpItemKindFunction = "TSFunction",
+      CmpItemKindConstructor = "TSType",
+      CmpItemKindVariable = "TSVariable",
+      CmpItemKindClass = "TSType",
+      CmpItemKindInterface = "TSType",
+      CmpItemKindModule = "TSNamespace",
+      CmpItemKindProperty = "TSProperty",
+      CmpItemKindOperator = "TSOperator",
+      CmpItemKindReference = "TSParameterReference",
+      CmpItemKindUnit = "TSField",
+      CmpItemKindValue = "TSField",
+      CmpItemKindField = "TSField",
+      CmpItemKindEnum = "TSField",
+      CmpItemKindKeyword = "TSKeyword",
+      CmpItemKindSnippet = "TSText",
+      CmpItemKindColor = "cssColor",
+      CmpItemKindFile = "TSURI",
+      CmpItemKindFolder = "TSURI",
+      CmpItemKindEvent = "TSConstant",
+      CmpItemKindEnumMember = "TSField",
+      CmpItemKindConstant = "TSConstant",
+      CmpItemKindStruct = "TSStructure",
+      CmpItemKindTypeParameter = "TSParameter",
+   }
+
+   -- apply transparents
+   if opts.transparent_bg then
+      for _, group in ipairs(TRANSPARENTS) do
+         highlights[group].bg = nil
+      end
+   end
+
+   local links = {} ---@type string[]
+   -- run defined highlights
+   for group, value in pairs(highlights) do
+      if type(value) == "table" then
+         local sp = value.sp and " guisp=" .. value.sp or ""
+         cmd(string.format("highlight %s guifg=%s guibg=%s gui=%s%s",
+            group, value.fg or "NONE", value.bg or "NONE",
+            value.attr or "NONE", sp))
+      elseif type(value) == "string" then
+         -- make sure links will run later
+         links[#links + 1] = string.format("highlight! link %s %s", group, value)
+      end
+   end
+
+   -- run highlights link commands
+   for _, command in ipairs(links) do
+      cmd(command)
+   end
 end
 
-M.apply = function()
-
-    local isItalic = vim.g.dracula_italic_comment == true
-
-       local highlight = function(group, fg, bg, attr, sp)
-               fg = fg and "guifg=" .. fg or "guifg=NONE"
-               bg = bg and "guibg=" .. bg or "guibg=NONE"
-               attr = attr and "gui=" ..attr or "gui=NONE"
-               sp = sp and "guisp=" .. sp or ""
-
-               vim.api.nvim_command("highlight " .. group .. " ".. fg .. " " .. bg .. " ".. attr .. " " .. sp)
-       end
-       local colors = M.colors()
-       M.apply_term_colors(colors)
-
-       -- highlight(Group, Foreground, Backgroud, Attribute, Special)
-       if(vim.g.dracula_transparent_bg == true) then
-               highlight("Normal", colors.fg, nil, nil, nil)
-       else
-               highlight("Normal", colors.fg, colors.bg, nil, nil)
-       end
-       highlight("NormalFloat", colors.fg, colors.bg, nil, nil)
-       highlight("Comment", colors.comment, nil, isItalic and 'italic' or nil, nil)
-       highlight("Constant", colors.yellow, nil, nil, nil)
-       highlight("String", colors.yellow, nil, nil, nil)
-       highlight("Character", colors.green, nil, nil, nil)
-       highlight("Number", colors.orange, nil, nil, nil)
-       highlight("Boolean", colors.cyan, nil, nil, nil)
-       highlight("Float", colors.orange, nil, nil, nil)
-       highlight("FloatBorder", colors.white, nil, nil, nil)
-       highlight("Operator", colors.purple, nil, nil, nil)
-       highlight("Keyword", colors.cyan, nil, nil, nil)
-       highlight("Keywords", colors.cyan, nil, nil, nil)
-       highlight("Identifier", colors.cyan, nil, nil, nil)
-       highlight("Function", colors.yellow, nil, nil, nil)
-       highlight("Statement", colors.purple, nil, nil, nil)
-       highlight("Conditional", colors.pink, nil, nil, nil)
-       highlight("Repeat", colors.pink, nil, nil, nil)
-       highlight("Label", colors.cyan, nil, nil, nil)
-       highlight("Exception", colors.purple, nil, nil, nil)
-       highlight("PreProc", colors.yellow, nil, nil, nil)
-       highlight("Include", colors.purple, nil, nil, nil)
-       highlight("Define", colors.purple, nil, nil, nil)
-       highlight("Title", colors.cyan, nil, nil, nil)
-       highlight("Macro", colors.purple, nil, nil, nil)
-       highlight("PreCondit", colors.cyan, nil, nil, nil)
-       highlight("Type", colors.cyan, nil, nil, nil)
-       highlight("StorageClass", colors.pink, nil, nil, nil)
-       highlight("Structure", colors.yellow, nil, nil, nil)
-       highlight("TypeDef", colors.yellow, nil, nil, nil)
-       highlight("Special", colors.green, nil, "italic", nil)
-       highlight("SpecialComment", colors.comment, nil, "italic", nil)
-       highlight("Error", colors.bright_red, nil, nil, nil)
-       highlight("Todo", colors.purple, nil, "bold,italic", nil)
-       highlight("Underlined", colors.cyan, nil, "underline", nil)
-
-       highlight("Cursor", nil, nil, "reverse", nil)
-       highlight("CursorColumn", nil, colors.black, "reverse", nil)
-       highlight("CursorLineNr", colors.fg, nil, "bold", nil)
-
-       if(vim.g.dracula_transparent_bg == true)then
-               highlight("SignColumn", nil, nil, nil, nil)
-       else
-               highlight("SignColumn", nil, colors.bg, nil, nil)
-       end
-
-       highlight("Conceal", colors.comment, nil, nil, nil)
-       highlight("CursorColumn", nil, colors.black, nil, nil)
-       highlight("CursorLine", nil, colors.selection, nil, nil)
-       highlight("ColorColumn", nil, colors.selection, nil, nil)
-
-       highlight("StatusLine", colors.white, colors.black, nil, nil)
-       highlight("StatusLineNC", colors.comment, nil, nil, nil)
-       highlight("StatusLineTerm", colors.white, colors.black, nil, nil)
-       highlight("StatusLineTermNC", colors.comment, nil, nil, nil)
-
-       highlight("Directory", colors.cyan, nil, nil, nil)
-       highlight("DiffAdd", colors.bg, colors.green, nil, nil)
-       highlight("DiffChange", colors.orange, nil, nil, nil)
-       highlight("DiffDelete", colors.red, nil, nil, nil)
-       highlight("DiffText", colors.comment, nil, nil, nil)
-
-       highlight("ErrorMsg", colors.bright_red, nil, nil, nil)
-       highlight("VertSplit", colors.black, nil, nil, nil)
-       highlight("Folded", colors.comment, nil, nil, nil)
-       highlight("FoldColumn", nil, nil, nil, nil)
-       highlight("Search", colors.black, colors.orange, nil, nil)
-       highlight("IncSearch", colors.orange, colors.comment, nil, nil)
-       highlight("LineNr", colors.comment, nil, nil, nil)
-       highlight("MatchParen", colors.fg, nil, "underline", nil)
-       highlight("NonText", colors.nontext, nil, nil, nil)
-       highlight("Pmenu", colors.white, colors.menu, nil, nil)
-       highlight("PmenuSel", colors.white, colors.selection, nil, nil)
-       highlight("PmenuSbar", nil, colors.bg, nil, nil)
-       highlight("PmenuThumb", nil, colors.selection, nil, nil)
-
-       highlight("Question", colors.purple, nil, nil, nil)
-       highlight("QuickFixLine", colors.black, colors.yellow, nil, nil)
-       highlight("SpecialKey", colors.nontext, nil, nil, nil)
-
-       highlight("SpellBad", colors.bright_red, nil, "underline", nil)
-       highlight("SpellCap", colors.yellow, nil, nil, nil)
-       highlight("SpellLocal", colors.yellow, nil, nil, nil)
-       highlight("SpellRare", colors.yellow, nil, nil, nil)
-
-       highlight("TabLine", colors.comment, nil, nil, nil)
-       highlight("TabLineSel", colors.white, nil, nil, nil)
-       highlight("TabLineFill", nil, colors.bg, nil, nil)
-       highlight("Terminal", colors.white, colors.black, nil, nil)
-       highlight("Visual", nil, colors.visual, nil, nil)
-       highlight("VisualNOS", colors.visual, nil, nil, nil)
-       highlight("WarningMsg", colors.yellow, nil, nil, nil)
-       highlight("WildMenu", colors.black, colors.white, nil, nil)
-
-       if(vim.g.dracula_show_end_of_buffer == true) then
-               highlight("EndOfBuffer", colors.visual, nil, nil, nil)
-       else
-               highlight("EndOfBuffer", colors.bg, nil, nil, nil)
-       end
-
-       -- TreeSitter
-       highlight("TSError", colors.bright_red, nil, nil, nil)
-       highlight("TSPunctDelimiter", colors.fg, nil, nil, nil)
-       highlight("TSPunctBracket", colors.fg, nil, nil, nil)
-       highlight("TSPunctSpecial", colors.fg, nil, nil, nil)
-
-       highlight("TSConstant", colors.purple, nil, nil, nil)
-       highlight("TSConstantBuiltin", colors.purple, nil, nil, nil)
-
-       highlight("TSConstMacro", colors.cyan, nil, nil, nil)
-       highlight("TSStringRegex", colors.red, nil, nil, nil)
-       highlight("TSString", colors.yellow, nil, nil, nil)
-       highlight("TSStringEscape", colors.cyan, nil, nil, nil)
-       highlight("TSCharacter", colors.green, nil, nil, nil)
-       highlight("TSNumber", colors.purple, nil, nil, nil)
-       highlight("TSBoolean", colors.purple, nil, nil, nil)
-       highlight("TSFloat", colors.green, nil, nil, nil)
-       highlight("TSAnnotation", colors.yellow, nil, nil, nil)
-       highlight("TSAttribute", colors.cyan, nil, nil, nil)
-       highlight("TSNamespace", colors.orange, nil, nil, nil)
-
-       highlight("TSFuncBuiltin", colors.cyan, nil, nil, nil)
-       highlight("TSFunction", colors.green, nil, nil, nil)
-       highlight("TSFuncMacro", colors.green, nil, nil, nil)
-       highlight("TSParameter", colors.orange, nil, nil, nil)
-       highlight("TSParameterReference", colors.orange, nil, nil, nil)
-       highlight("TSMethod", colors.green, nil, nil, nil)
-       highlight("TSField", colors.orange, nil, nil, nil)
-       highlight("TSProperty", colors.fg, nil, nil, nil)
-       highlight("TSConstructor", colors.cyan, nil, nil, nil)
-
-       highlight("TSConditional", colors.pink, nil, nil, nil)
-       highlight("TSRepeat", colors.pink, nil, nil, nil)
-       highlight("TSLabel", colors.cyan, nil, nil, nil)
-
-       highlight("TSKeyword", colors.pink, nil, nil, nil)
-       highlight("TSKeywordFunction", colors.cyan, nil, nil, nil)
-       highlight("TSKeywordOperator", colors.pink, nil, nil, nil)
-       highlight("TSOperator", colors.pink, nil, nil, nil)
-       highlight("TSException", colors.purple, nil, nil, nil)
-       highlight("TSType", colors.bright_cyan, nil, nil, nil)
-       highlight("TSTypeBuiltin", colors.cyan, nil, "italic", nil)
-       highlight("TSStructure", colors.purple, nil, nil, nil)
-       highlight("TSInclude", colors.pink, nil, nil, nil)
-
-       highlight("TSVariable", colors.fg, nil, nil, nil)
-       highlight("TSVariableBuiltin", colors.purple, nil, nil, nil)
-
-  highlight("TSText", colors.orange, nil, nil, nil)
-       highlight("TSStrong", colors.orange, nil, "bold", nil)  -- bold
-       highlight("TSEmphasis", colors.yellow, nil, "italic", nil)  -- italic
-       highlight("TSUnderline", colors.orange, nil, nil, nil)
-       highlight("TSTitle", colors.pink, nil, nil, nil)          -- title
-       highlight("TSLiteral", colors.yellow, nil, nil, nil)      -- inline code
-       highlight("TSURI", colors.yellow, nil, "italic", nil)     -- urls
-
-  highlight("TSTag", colors.cyan, nil, nil, nil)
-       highlight("TSTagDelimiter", colors.white, nil, nil, nil)
-
-       -- HTML
-       highlight("htmlArg", colors.yellow, nil, nil, nil)
-       highlight("htmlBold", colors.yellow, nil, "bold", nil)
-       highlight("htmlEndTag", colors.white, nil, nil, nil)
-       highlight("htmlH1", colors.pink, nil, nil, nil)
-       highlight("htmlH2", colors.pink, nil, nil, nil)
-       highlight("htmlH3", colors.pink, nil, nil, nil)
-       highlight("htmlH4", colors.pink, nil, nil, nil)
-       highlight("htmlH5", colors.pink, nil, nil, nil)
-       highlight("htmlH6", colors.pink, nil, nil, nil)
-       highlight("htmlItalic", colors.purple, nil, "italic", nil)
-       highlight("htmlLink", colors.purple, nil, "underline", nil)
-       highlight("htmlSpecialChar", colors.yellow, nil, nil, nil)
-       highlight("htmlSpecialTagName", colors.cyan, nil, nil, nil)
-       highlight("htmlTag", colors.pink, nil, nil, nil)
-       highlight("htmlTagN", colors.pink, nil, nil, nil)
-       highlight("htmlTagName", colors.cyan, nil, nil, nil)
-       highlight("htmlTitle", colors.white, nil, nil, nil)
-
-       -- Markdown
-       highlight("markdownBlockquote", colors.yellow, nil, "italic", nil)
-       highlight("markdownBold", colors.orange, nil, "bold", nil)
-       highlight("markdownCode", colors.green, nil, nil, nil)
-       highlight("markdownCodeBlock", colors.orange, nil, nil, nil)
-       highlight("markdownCodeDelimiter", colors.red, nil, nil, nil)
-       highlight("markdownH1", colors.pink, nil, "bold", nil)
-       highlight("markdownH2", colors.pink, nil, "bold", nil)
-       highlight("markdownH3", colors.pink, nil, "bold", nil)
-       highlight("markdownH4", colors.pink, nil, "bold", nil)
-       highlight("markdownH5", colors.pink, nil, "bold", nil)
-       highlight("markdownH6", colors.pink, nil, "bold", nil)
-       highlight("markdownHeadingDelimiter", colors.red, nil, nil, nil)
-       highlight("markdownHeadingRule", colors.comment, nil, nil, nil)
-       highlight("markdownId", colors.purple, nil, nil, nil)
-       highlight("markdownIdDeclaration", colors.cyan, nil, nil, nil)
-       highlight("markdownIdDelimiter", colors.purple, nil, nil, nil)
-       highlight("markdownItalic", colors.yellow, nil, "italic", nil)
-       highlight("markdownLinkDelimiter", colors.purple, nil, nil, nil)
-       highlight("markdownLinkText", colors.pink, nil, nil, nil)
-       highlight("markdownListMarker", colors.cyan, nil, nil, nil)
-       highlight("markdownOrderedListMarker", colors.red, nil, nil, nil)
-       highlight("markdownRule", colors.comment, nil, nil, nil)
-
-       --  Diff
-       highlight("diffAdded", colors.green, nil, nil, nil)
-       highlight("diffRemoved", colors.red, nil, nil, nil)
-       highlight("diffFileId", colors.yellow, nil, "bold,reverse", nil)
-       highlight("diffFile", colors.nontext, nil, nil, nil)
-       highlight("diffNewFile", colors.green, nil, nil, nil)
-       highlight("diffOldFile", colors.red, nil, nil, nil)
-
-       highlight("debugPc", nil, colors.cyan, nil, nil)
-       highlight("debugBreakpoint", colors.red, nil, "reverse", nil)
-
-       -- Git Signs
-       highlight('GitSignsAdd', colors.bright_green, nil, nil, nil)
-       highlight('GitSignsChange', colors.cyan, nil, nil, nil)
-       highlight('GitSignsDelete', colors.bright_red, nil, nil, nil)
-       highlight('GitSignsAddLn', colors.black, colors.bright_green, nil, nil)
-       highlight('GitSignsChangeLn', colors.black, colors.cyan, nil, nil)
-       highlight('GitSignsDeleteLn', colors.black, colors.bright_red, nil, nil)
-
-       -- Nvim compe
-       vim.api.nvim_command("highlight! link CompeDocumentation Pmenu")
-
-       -- Telescope
-       highlight("TelescopePromptBorder", colors.comment, nil, nil, nil)
-       highlight("TelescopeResultsBorder", colors.comment, nil, nil, nil)
-       highlight("TelescopePreviewBorder", colors.comment, nil, nil, nil)
-       highlight("TelescopeSelection", colors.white, colors.selection, nil, nil)
-       highlight("TelescopeMultiSelection", colors.purple, colors.selection, nil, nil)
-       highlight("TelescopeNormal", colors.fg, colors.bg, nil, nil)
-       highlight("TelescopeMatching", colors.green, nil, nil, nil)
-       highlight("TelescopePromptPrefix", colors.purple, nil, nil, nil)
-
-       -- NvimTree
-       if(vim.g.dracula_transparent_bg == true) then
-               highlight("NvimTreeNormal ", colors.fg, nil, nil, nil)
-               highlight("NvimTreeVertSplit", nil, nil, nil, nil)
-       else
-               highlight("NvimTreeNormal ", colors.fg, colors.menu, nil, nil)
-               highlight("NvimTreeVertSplit", colors.bg, colors.bg, nil, nil)
-       end
-       highlight("NvimTreeRootFolder", colors.fg, nil, 'bold', nil)
-       highlight("NvimTreeGitDirty", colors.yellow, nil, nil, nil)
-       highlight("NvimTreeGitNew", colors.bright_green, nil, nil, nil)
-       highlight("NvimTreeImageFile", colors.pink, nil, nil, nil)
-       highlight("NvimTreeFolderIcon", colors.purple, nil, nil, nil)
-       highlight("NvimTreeIndentMarker", colors.nontext, nil, nil, nil)
-       highlight("NvimTreeEmptyFolderName", colors.comment, nil, nil, nil)
-       highlight("NvimTreeFolderName", colors.fg, nil, nil, nil)
-       highlight("NvimTreeSpecialFile", colors.pink, nil, 'underline', nil)
-       highlight("NvimTreeOpenedFolderName", colors.fg, nil, nil, nil)
-       highlight("NvimTreeCursorLine", nil, colors.selection, nil, nil)
-       highlight("NvimTreeIn", nil, colors.selection, nil, nil)
-
-       if(vim.g.dracula_show_end_of_buffer == true) then
-               highlight("NvimTreeEndOfBuffer", colors.visual, nil, nil, nil)
-       else
-               highlight("NvimTreeEndOfBuffer", colors.bg, nil, nil, nil)
-       end
-
-       -- Bufferline
-       highlight("BufferLineIndicatorSelected", colors.purple , nil, nil, nil)
-       highlight("BufferLineFill", nil , colors.black, nil, nil)
-
-       -- LSP
-       highlight('DiagnosticError', colors.red, nil, nil, nil)
-       highlight('DiagnosticWarn', colors.yellow, nil, nil, nil)
-       highlight('DiagnosticInfo', colors.cyan, nil, nil, nil)
-       highlight('DiagnosticHint', colors.cyan, nil, nil, nil)
-       highlight('DiagnosticUnderlineError', nil, nil, 'undercurl', colors.red)
-       highlight('DiagnosticUnderlineWarn', nil, nil, 'undercurl', colors.yellow)
-       highlight('DiagnosticUnderlineInfo', nil, nil, 'undercurl', colors.cyan)
-       highlight('DiagnosticUnderlineHint', nil, nil, 'undercurl', colors.cyan)
-       highlight('DiagnosticSignError', colors.red, nil, nil, nil)
-       highlight('DiagnosticSignWarn', colors.yellow, nil, nil, nil)
-       highlight('DiagnosticSignInfo', colors.cyan, nil, nil, nil)
-       highlight('DiagnosticSignHint', colors.cyan, nil, nil, nil)
-       highlight('DiagnosticFloatingError', colors.red, nil, nil, nil)
-       highlight('DiagnosticFloatingWarn', colors.yellow, nil, nil, nil)
-       highlight('DiagnosticFloatingInfo', colors.cyan, nil, nil, nil)
-       highlight('DiagnosticFloatingHint', colors.cyan, nil, nil, nil)
-       highlight('DiagnosticVirtualTextError', colors.red, nil, nil, nil)
-       highlight('DiagnosticVirtualTextWarn', colors.yellow, nil, nil, nil)
-       highlight('DiagnosticVirtualTextInfo', colors.cyan, nil, nil, nil)
-       highlight('DiagnosticVirtualTextHint', colors.cyan, nil, nil, nil)
-
-       highlight('LspDiagnosticsDefaultError', colors.red, nil, nil, nil)
-       highlight('LspDiagnosticsDefaultWarning', colors.yellow, nil, nil, nil)
-       highlight('LspDiagnosticsDefaultInformation', colors.cyan, nil, nil, nil)
-       highlight('LspDiagnosticsDefaultHint', colors.cyan, nil, nil, nil)
-       highlight('LspDiagnosticsUnderlineError', colors.red, nil, 'undercurl', nil)
-       highlight('LspDiagnosticsUnderlineWarning', colors.yellow, nil, 'undercurl', nil)
-       highlight('LspDiagnosticsUnderlineInformation', colors.cyan, nil, 'undercurl', nil)
-       highlight('LspDiagnosticsUnderlineHint', colors.cyan, nil, 'undercurl', nil)
-       highlight('LspReferenceText', colors.orange, nil, nil, nil)
-       highlight('LspReferenceRead', colors.orange, nil, nil, nil)
-       highlight('LspReferenceWrite', colors.orange, nil, nil, nil)
-
-       --LSP Saga
-       highlight("LspFloatWinNormal", colors.fg, nil, 'none', nil)
-       highlight("LspFloatWinBorder", colors.comment, nil, 'none', nil)
-       highlight("LspSagaHoverBorder", colors.comment, nil, 'none', nil)
-       highlight("LspSagaSignatureHelpBorder", colors.comment, nil, 'none', nil)
-       highlight("LspSagaCodeActionBorder", colors.comment, nil, 'none', nil)
-       highlight("LspSagaDefPreviewBorder", colors.comment, nil, 'none', nil)
-       highlight("LspLinesDiagBorder", colors.comment, nil, 'none', nil)
-       highlight("LspSagaRenameBorder", colors.comment, nil, 'none', nil)
-       highlight("LspSagaBorderTitle", colors.menu, nil, 'none', nil)
-       highlight("LSPSagaDiagnosticTruncateLine", colors.comment, nil, 'none', nil)
-       highlight("LspSagaDiagnosticBorder", colors.comment, nil, 'none', nil)
-       highlight("LspSagaDiagnosticBorder", colors.comment, nil, 'none', nil)
-       highlight("LspSagaShTruncateLine", colors.comment, nil, 'none', nil)
-       highlight("LspSagaShTruncateLine", colors.comment, nil, 'none', nil)
-       highlight("LspSagaDocTruncateLine", colors.comment, nil, 'none', nil)
-       highlight("LspSagaRenameBorder", colors.comment, nil, 'none', nil)
-       highlight("LspSagaLspFinderBorder", colors.comment, nil, 'none', nil)
-
-       -- IndentBlankLine
-       highlight("IndentBlanklineContextChar", colors.bright_red, nil, "nocombine", nil)
-
-       -- Nvim compe
-       highlight("CmpItemAbbrDeprecated", colors.white, colors.menu, 'none', nil)
-       highlight("CmpItemAbbrMatch", colors.cyan, colors.menu, 'none', nil)
-
-    --barbar
-       highlight("BufferCurrentTarget", colors.red, nil, 'none', nil)
-       highlight("BufferVisibleTarget", colors.red, nil, 'none', nil)
-       highlight("BufferInactiveTarget", colors.red, nil, 'none', nil)
-
-       -- Link highlights
-       vim.api.nvim_command('highlight link CompeDocumentation Pmenu')
-       vim.api.nvim_command('highlight link CompeDocumentationBorder Pmenu')
-       vim.api.nvim_command('highlight link CmpItemKind Pmenu')
-       vim.api.nvim_command('highlight link CmpItemAbbr Pmenu')
-       vim.api.nvim_command('highlight link CmpItemKindMethod TSMethod')
-       vim.api.nvim_command('highlight link CmpItemKindText TSText')
-       vim.api.nvim_command('highlight link CmpItemKindFunction TSFunction')
-       vim.api.nvim_command('highlight link CmpItemKindConstructor TSType')
-       vim.api.nvim_command('highlight link CmpItemKindVariable TSVariable')
-       vim.api.nvim_command('highlight link CmpItemKindClass TSType')
-       vim.api.nvim_command('highlight link CmpItemKindInterface TSType')
-       vim.api.nvim_command('highlight link CmpItemKindModule TSNamespace')
-       vim.api.nvim_command('highlight link CmpItemKindProperty TSProperty')
-       vim.api.nvim_command('highlight link CmpItemKindOperator TSOperator')
-       vim.api.nvim_command('highlight link CmpItemKindReference TSParameterReference')
-       vim.api.nvim_command('highlight link CmpItemKindUnit TSField')
-       vim.api.nvim_command('highlight link CmpItemKindValue TSField')
-       vim.api.nvim_command('highlight link CmpItemKindField TSField')
-       vim.api.nvim_command('highlight link CmpItemKindEnum TSField')
-       vim.api.nvim_command('highlight link CmpItemKindKeyword TSKeyword')
-       vim.api.nvim_command('highlight link CmpItemKindSnippet TSText')
-       vim.api.nvim_command('highlight link CmpItemKindColor cssColor')
-       vim.api.nvim_command('highlight link CmpItemKindFile TSURI')
-       vim.api.nvim_command('highlight link CmpItemKindFolder TSURI')
-       vim.api.nvim_command('highlight link CmpItemKindEvent TSConstant')
-       vim.api.nvim_command('highlight link CmpItemKindEnumMember TSField')
-       vim.api.nvim_command('highlight link CmpItemKindConstant TSConstant')
-       vim.api.nvim_command('highlight link CmpItemKindStruct TSStructure')
-       vim.api.nvim_command('highlight link CmpItemKindTypeParameter TSParameter')
+local local_opts = DEFAULT_OPTIONS
+
+---setup colorscheme
+---@param opts DefaultConfig | nil
+local function setup(opts)
+   cmd("hi clear")
+
+   if vim.fn.exists("syntax_on") then
+      cmd("syntax reset")
+   end
 
+   o.background = "dark"
+   o.termguicolors = true
+   g.colors_name = "dracula"
+
+   if type(opts) == "table" then
+      local_opts = vim.tbl_deep_extend("force", DEFAULT_OPTIONS, opts)
+   end
+   apply(local_opts)
 end
 
-return M;
+return {
+   setup = setup,
+   options = function() return local_opts end,
+   colors = function() return local_opts.colors end,
+}
index 85774389fe470f8493a906329031522b89b5720e..86c4ec5216aba3414a7e819f3fd629d218a0c9b0 100644 (file)
@@ -1,40 +1,42 @@
-local dracula = {}
+local dracula = require("dracula")
+local opts = dracula.options()
+local colors = dracula.colors()
 
-local colors = require('dracula').colors()
+local bg = opts.lualine_bg_color or colors.black
 
-local bg = ""
-if vim.g.dracula_lualine_bg_color ~= nil then
-    bg = vim.g.dracula_lualine_bg_color
-else
-    bg = colors.black
-end
+local normal = {
+   a = { fg = colors.black, bg = colors.purple, gui = 'bold' },
+   b = { fg = colors.purple, bg = bg },
+   c = { fg = colors.white, bg = bg },
 
-dracula.normal = {
-  a = {fg = colors.black, bg = colors.purple, gui = 'bold'},
-  b = {fg = colors.purple, bg = bg},
-  c = {fg = colors.white, bg = bg},
 }
 
-dracula.visual = {
-  a = {fg = colors.black, bg = colors.pink, gui = 'bold'},
-  b = {fg = colors.pink, bg = bg},
+local visual = {
+   a = { fg = colors.black, bg = colors.pink, gui = 'bold' },
+   b = { fg = colors.pink, bg = bg },
 }
 
-dracula.inactive = {
-  a = {fg = colors.white, bg = colors.gray, gui = 'bold'},
-  b = {fg = colors.black, bg = colors.white},
+local inactive = {
+   a = { fg = colors.white, bg = colors.gray, gui = 'bold' },
+   b = { fg = colors.black, bg = colors.white },
 }
 
-dracula.replace = {
-  a = {fg = colors.black, bg = colors.yellow, gui = 'bold'},
-  b = {fg = colors.yellow, bg = bg},
-  c = {fg = colors.white, bg = bg},
+local replace = {
+   a = { fg = colors.black, bg = colors.yellow, gui = 'bold' },
+   b = { fg = colors.yellow, bg = bg },
+   c = { fg = colors.white, bg = bg },
 }
 
-dracula.insert = {
-  a = {fg = colors.black, bg = colors.green, gui = 'bold'},
-  b = {fg = colors.green, bg = bg},
-  c = {fg = colors.white, bg = bg},
+local insert = {
+   a = { fg = colors.black, bg = colors.green, gui = 'bold' },
+   b = { fg = colors.green, bg = bg },
+   c = { fg = colors.white, bg = bg },
 }
 
-return dracula
+return {
+   normal = normal,
+   visual = visual,
+   inactive = inactive,
+   replace = replace,
+   insert = insert,
+}