From 8a10c63f32147d5623eac216c2c75cf3f24324ad Mon Sep 17 00:00:00 2001 From: "asep.komarudin" Date: Sat, 25 May 2024 09:28:49 +0700 Subject: [PATCH] add: update config colorscheme --- lazy-lock.json | 5 +- lua/custom/default.lua | 2 +- lua/plugins/colorscheme.lua | 115 +++++++++--------------------------- lua/plugins/transparant.lua | 14 ++++- lua/user/colorscheme.lua | 7 --- 5 files changed, 44 insertions(+), 99 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 0503087..2b91b0c 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -10,10 +10,10 @@ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "code_runner.nvim": { "branch": "main", "commit": "d135c4178bf8980ca5fa4aa6e27ab9ee4373c875" }, "codeium.vim": { "branch": "main", "commit": "289eb724e5d6fab2263e94a1ad6e54afebefafb2" }, + "dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" }, "dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" }, "friendly-snippets": { "branch": "main", "commit": "dd2fd1281d4b22e7b4a5bfafa3e142d958e251f2" }, "gitsigns.nvim": { "branch": "main", "commit": "76927d14d3fbd4ba06ccb5246e79d93b5442c188" }, - "gruvbox-baby": { "branch": "main", "commit": "ea71b4225d0140103d99748ca4a33ecf22c03f62" }, "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, "lazy.nvim": { "branch": "main", "commit": "8f19915175395680808de529e4220da8dafc0759" }, "lsp-progress.nvim": { "branch": "main", "commit": "55a04895ea20c365b670051a3128265d43bdfa3d" }, @@ -43,14 +43,13 @@ "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" }, "nvim-ufo": { "branch": "main", "commit": "a5390706f510d39951dd581f6d2a972741b3fa26" }, "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, - "onedarkpro.nvim": { "branch": "main", "commit": "ec07364f3cfa9cc6467bf067a490cfd74011efcd" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "promise-async": { "branch": "main", "commit": "38a4575da9497326badd3995e768b4ccf0bb153e" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "12b1a1e095d968887a17ef791c2edb78d7595d46" }, "smart-splits.nvim": { "branch": "master", "commit": "2179ec0d26aacd4f40c766c79f6ebc83b7001e48" }, "statuscol.nvim": { "branch": "main", "commit": "483b9a596dfd63d541db1aa51ee6ee9a1441c4cc" }, "tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "3d3cd95e4a4135c250faf83dd5ed61b8e5502b86" }, - "telescope.nvim": { "branch": "master", "commit": "5665d93988acfbb0747bdbf4f4cb583bcebc8930" }, + "telescope.nvim": { "branch": "master", "commit": "c2ce039188e22288449e43b77710036e69a45a70" }, "toggleterm.nvim": { "branch": "main", "commit": "fee58a0473fd92b28c34f8f724e4918b15ba30a3" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" }, diff --git a/lua/custom/default.lua b/lua/custom/default.lua index 8e18544..adf283e 100644 --- a/lua/custom/default.lua +++ b/lua/custom/default.lua @@ -11,7 +11,7 @@ -- catppuccin, catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha -- dracula -- nightfox, dayfox, dawnfox, duskfox, nordfox, terafox, carbonfox -vim.g.pcode_colorscheme = "onedark" +vim.g.pcode_colorscheme = "dracula" -- custom transparent mode -- only support diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index 743921d..f805878 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -1,17 +1,5 @@ -local gruvbox = false -local dracula = false -local tokyonight = false -local nord = false -local sonokai = false -local lunar = false -local material = false -local onedark = false -local catppuccin = false local nightfox = false -local sonokai_style = "default" -local material_style = "oceanic" - _G.switch = function(param, case_table) local case = case_table[param] if case then @@ -39,47 +27,9 @@ _G.extract = function(text) end local color = vim.g.pcode_colorscheme or "gruvbox-baby" -if substring(tostring(color), "tokyonight") then - tokyonight = true -elseif substring(tostring(color), "sonokai") then - sonokai = true - sonokai_style = extract(color)[2] or "default" -elseif substring(tostring(color), "material") then - material = true - local materialstyle = extract(color)[2] or "oceanic" - if materialstyle == "deepocean" then - material_style = "deep ocean" - else - material_style = materialstyle - end -elseif substring(tostring(color), "onedark") then - onedark = true -end +local materialstyle = extract(color)[2] or "oceanic" +local material_style = (materialstyle == "deepocean") and "deep ocean" or materialstyle switch(color, { - ["lunar"] = function() - lunar = true - end, - ["nord"] = function() - nord = true - end, - ["catppuccin"] = function() - catppuccin = true - end, - ["catppuccin-latte"] = function() - catppuccin = true - end, - ["catppuccin-frappe"] = function() - catppuccin = true - end, - ["catppuccin-macchiato"] = function() - catppuccin = true - end, - ["catppuccin-mocha"] = function() - catppuccin = true - end, - ["dracula"] = function() - dracula = true - end, ["nightfox"] = function() nightfox = true end, @@ -101,28 +51,23 @@ switch(color, { ["carbonfox"] = function() nightfox = true end, - ["gruvbox-baby"] = function() - gruvbox = true - end, - default = function() - gruvbox = true - end, + default = function() end, }) -local transparent = false +-- local transparent = false local transparent_mode = vim.g.pcode_transparent_mode or 0 -if transparent_mode ~= nil then - if transparent_mode == 1 then - transparent = true - end -end +-- if transparent_mode ~= nil then +-- if transparent_mode == 1 then +-- transparent = true +-- end +-- end return { -- color scheme { "luisiacc/gruvbox-baby", lazy = true, - enabled = gruvbox, + enabled = (color == "gruvbox-baby") and true or false, config = function() local colors = require("gruvbox-baby.colors").config() vim.g.gruvbox_baby_highlights = { @@ -143,19 +88,14 @@ return { FloatBorder = { fg = colors.fg, bg = colors.bg }, LspInfoBorder = { fg = colors.fg, bg = colors.bg }, } + vim.g.gruvbox_baby_transparent_mode = transparent_mode end, }, { "Mofiqul/dracula.nvim", - enabled = dracula, + enabled = (color == "dracula") and true or false, config = function() - local is_transparent = false local colors = require("dracula").colors() - if is_transparent then - colors = { - bg = "none", - } - end require("dracula").setup { colors = { -- purple = "#FCC76A", @@ -194,23 +134,22 @@ return { WinBarNC = { fg = colors.fg, bg = colors.bg }, LspInfoBorder = { fg = colors.fg }, }, - transparent_bg = transparent, - -- transparent_bg = is_transparent, + transparent_bg = (transparent_mode == 1) and true or false, } end, }, { "folke/tokyonight.nvim", - enabled = tokyonight, + enabled = substring(tostring(color), "tokyonight") and true or false, config = function() require "user.tokyonight" end, }, { "shaunsingh/nord.nvim", - enabled = nord, + enabled = (color == "nord") and true or false, config = function() - vim.g.nord_disable_background = transparent + vim.g.nord_disable_background = (transparent_mode == 1) and true or false require("nord").set() local nord = require "nord.colors" vim.api.nvim_create_autocmd("ColorScheme", { @@ -226,7 +165,7 @@ return { }, { "sainnhe/sonokai", - enabled = sonokai, + enabled = substring(tostring(color), "sonokai") and true or false, config = function() vim.api.nvim_create_autocmd("ColorScheme", { group = vim.api.nvim_create_augroup("custom_highlights_sonokai", {}), @@ -255,21 +194,21 @@ return { set_hl("LspInfoNormal", palette.fg, palette.bg0) end, }) - vim.g.sonokai_style = sonokai_style - vim.g.sonokai_transparent_background = 2 + vim.g.sonokai_style = extract(color)[2] or "default" + vim.g.sonokai_transparent_background = (transparent_mode == 1) and 2 or 0 end, }, - { "lunarvim/lunar.nvim", enabled = lunar }, + { "lunarvim/lunar.nvim", enabled = (color == "lunar") and true or false }, { "marko-cerovac/material.nvim", - enabled = material, + enabled = substring(tostring(color), "material") and true or false, config = function() local colors = require "material.colors" vim.g.material_style = material_style require("material").setup { lualine_style = "stealth", disable = { - background = transparent, + background = (transparent_mode == 1) and true or false, }, plugins = { -- Uncomment the plugins that you use to highlight them -- Available plugins: @@ -306,6 +245,7 @@ return { StatusLine = { fg = "#f8f8f2", bg = colors.bg }, StatusLineTerm = { fg = "#f8f8f2", bg = colors.bg }, WinBarNC = { fg = colors.fg, bg = colors.bg }, + CursorLine = { bg = "#333842" }, }, } end, @@ -313,9 +253,9 @@ return { { "olimorris/onedarkpro.nvim", priority = 1000, -- Ensure it loads first - enabled = onedark, + enabled = substring(tostring(color), "onedark") and true or false, config = function() - local is_transparent = false + local is_transparent = (transparent_mode == 1) and true or false require("onedarkpro").setup { styles = { types = "NONE", @@ -432,10 +372,11 @@ return { }, { "catppuccin/nvim", - enabled = catppuccin, + enabled = substring(tostring(color), "catppuccin") and true or false, name = "catppuccin", priority = 1000, config = function() + local transparent = (transparent_mode == 1) and true or false require("catppuccin").setup { flavour = "auto", -- latte, frappe, macchiato, mocha background = { -- :h background @@ -516,7 +457,7 @@ return { require("nightfox").setup { options = { terminal_colors = true, - transparent = transparent, + transparent = (transparent_mode == 1) and true or false, styles = { -- Style to be applied to different syntax groups comments = "italic", -- Value is any valid attr-list value `:help attr-list` conditionals = "italic", diff --git a/lua/plugins/transparant.lua b/lua/plugins/transparant.lua index c11832e..b82b170 100644 --- a/lua/plugins/transparant.lua +++ b/lua/plugins/transparant.lua @@ -25,7 +25,18 @@ return { cmd = { "TransparentToggle", "TransparentEnable", "TransparentDisable" }, config = function() require("transparent").setup { - extra_groups = {}, + extra_groups = { + "Normal", + "NormalNC", + "NormalFloat", + "FloatBorder", + "Comment", + "Folded", + "GitSignsAdd", + "GitSignsDelete", + "GitSignsChange", + "FoldColumn", + }, exclude_groups = { -- disable active selection backgroun "CursorLine", @@ -53,6 +64,7 @@ return { require("transparent").clear_prefix "NeoTree" -- clear prefix for Telescope require("transparent").clear_prefix "Telescope" + require("transparent").clear_prefix "mason" if clear_lualine then -- clear prefix for Lualine require("transparent").clear_prefix "Lualine" diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua index 2ec3785..a245c18 100644 --- a/lua/user/colorscheme.lua +++ b/lua/user/colorscheme.lua @@ -1,11 +1,4 @@ local colorscheme = vim.g.pcode_colorscheme or "gruvbox-baby" -local transparent_mode = vim.g.pcode_transparent_mode or 0 -if transparent_mode ~= nil then - if transparent_mode == 1 then - vim.g.gruvbox_baby_transparent_mode = 1 - vim.g.sonokai_transparent_background = 2 - end -end if substring(tostring(colorscheme), "sonokai") then colorscheme = "sonokai"