From 880593ccbacf8fccdd0945a87413dc41b84157c7 Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Wed, 30 Apr 2025 20:50:42 +0200 Subject: [PATCH] feat(colorscheme): change colorscheme to onedark --- init.lua | 2 +- lua/ow/plugins/moonfly.lua | 18 ---------- lua/ow/plugins/nvim-tree.lua | 68 +++++++++++------------------------- lua/ow/plugins/onedark.lua | 20 +++++++++++ 4 files changed, 41 insertions(+), 67 deletions(-) delete mode 100644 lua/ow/plugins/moonfly.lua create mode 100644 lua/ow/plugins/onedark.lua diff --git a/init.lua b/init.lua index 84f880a..d9fed65 100644 --- a/init.lua +++ b/init.lua @@ -38,7 +38,7 @@ local plugins = { ---@type LazyConfig local opts = { install = { - colorscheme = { "moonfly" }, + colorscheme = { "onedark" }, }, ui = { icons = { diff --git a/lua/ow/plugins/moonfly.lua b/lua/ow/plugins/moonfly.lua deleted file mode 100644 index 02b78c6..0000000 --- a/lua/ow/plugins/moonfly.lua +++ /dev/null @@ -1,18 +0,0 @@ --- https://github.com/bluz71/vim-moonfly-colors - ----@type LazyPluginSpec -return { - "bluz71/vim-moonfly-colors", - priority = 1000, - lazy = false, - name = "moonfly", - init = function() - vim.g.moonflyNormalFloat = true - vim.g.moonflyCursorColor = true - vim.g.moonflyWinSeparator = 2 - vim.g.moonflyVirtualTextColor = true - end, - config = function() - vim.cmd.colorscheme("moonfly") - end, -} diff --git a/lua/ow/plugins/nvim-tree.lua b/lua/ow/plugins/nvim-tree.lua index fbcaff3..180593d 100644 --- a/lua/ow/plugins/nvim-tree.lua +++ b/lua/ow/plugins/nvim-tree.lua @@ -1,51 +1,24 @@ +local function find_link_source(name) + local hl = vim.api.nvim_get_hl(0, { name = "NvimTreeFileIcon" }) + while hl.link do + hl = vim.api.nvim_get_hl(0, { name = hl.link }) + end + + return hl +end + local function override_highlights() - -- Git - vim.cmd.highlight({ - "link NvimTreeGitDeletedIcon MoonflyTurquoise", - bang = true, - }) - vim.cmd.highlight({ - "link NvimTreeGitDirtyIcon MoonflyTurquoise", - bang = true, - }) - vim.cmd.highlight({ - "link NvimTreeGitIgnoredIcon Comment", - bang = true, - }) - vim.cmd.highlight({ - "link NvimTreeGitMergeIcon MoonflyCrimson", - bang = true, - }) - vim.cmd.highlight({ - "link NvimTreeGitNewIcon MoonflyOrchid", - bang = true, - }) - vim.cmd.highlight({ - "link NvimTreeGitRenamedIcon MoonflyTurquoise", - bang = true, - }) - vim.cmd.highlight({ - "link NvimTreeGitStagedIcon MoonflyGreen", - bang = true, - }) + -- File Icon + local hl = find_link_source("NvimTreeFileIcon") + vim.api.nvim_set_hl(0, "NvimTreeFileIcon", { fg = hl.fg, bg = nil }) - -- Bookmarks - vim.cmd.highlight({ - "link NvimTreeBookmarkHL MoonflyYellowLineActive", - bang = true, - }) - - -- Clipboard - vim.cmd.highlight({ - "link NvimTreeCutHL MoonflyRedLineActive", - bang = true, - }) - - -- Modified - vim.cmd.highlight({ - "link NvimTreeModifiedIcon MoonflyTurquoise", - bang = true, - }) + -- Symlink Icon + hl = find_link_source("NvimTreeSymlinkIcon") + vim.api.nvim_set_hl( + 0, + "NvimTreeSymlinkIcon", + { fg = hl.fg, bg = nil } + ) end local function disable_highlights() @@ -127,8 +100,6 @@ return { end end - override_highlights() - local signs = require("ow.lsp").diagnostic_signs require("nvim-tree").setup({ on_attach = function(bufnr) @@ -280,6 +251,7 @@ return { }, }) + override_highlights() disable_highlights() require("nvim-tree.api").tree.toggle({ diff --git a/lua/ow/plugins/onedark.lua b/lua/ow/plugins/onedark.lua new file mode 100644 index 0000000..33c7fab --- /dev/null +++ b/lua/ow/plugins/onedark.lua @@ -0,0 +1,20 @@ +---@type LazyPluginSpec +return { + "navarasu/onedark.nvim", + -- enabled = false, + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + local c = require("onedark.palette").dark + local opts = { + style = "dark", + highlights = { + NormalFloat = { bg = c.bg0 }, + FloatBorder = { bg = c.bg0 }, + TabLineSel = { fg = c.fg, bg = c.bg0 } + }, + } + require("onedark").setup(opts) + -- Enable theme + require("onedark").load() + end, +}