nvim kanagawa theme

kanagawa 一款柔和色调的主题,相比 tokyo.night 没有那么的刺眼。主要特别注意的是,这款插件采用了 jit 编译技术,一旦修改配置,还需要执行 KanagawaCompile 才能生效。

kanagawa

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
-- Kanagawa comes in three variants:
-- 1.wave the default heart-warming theme,
-- 2.dragon for those late-night sessions
-- 3.lotus for when you're out in the open.
return {
    "rebelot/kanagawa.nvim",
    config = function ()
        require('kanagawa').setup({
            -- If you enable compilation, make sure to run :KanagawaCompile command every time you make changes to your config.
            compile = true,             -- enable compiling the colorscheme
            undercurl = true,            -- enable undercurls
            commentStyle = { italic = true, bold = false},
            functionStyle = { bold = true },
            keywordStyle = { italic = true},
            statementStyle = { bold = true },
            typeStyle = {italic = true, bold = false},
            transparent = true,         -- do not set background color
            dimInactive = false,         -- dim inactive window `:h hl-NormalNC`
            terminalColors = true,       -- define vim.g.terminal_color_{0,17}
            globalStatus = true,       -- adjust window separators highlight for laststatus=3
            colors = {                   -- add/modify theme and palette colors
                palette = {},
                theme = {
                    wave = {},
                    lotus = {},
                    dragon = {},
                    all = {
                        ui = {
                            bg_gutter = "none",
                            bg_p1 = 'none',
                        },
                    }
                },
            },
            overrides = function(colors) -- add/modify highlights
                -- eg: ~/.config/nvim/lazy/kanagawa.nvim/lua/kanagawa/highlights/editor.lua
                local theme = colors.theme
                local palette = colors.palette
                return {
                    -- CursorLineNr = { fg = theme.diag.warning, bg = theme.ui.bg_gutter, bold = true },
                    CursorLineNr = { fg = "#709db2", bg = theme.ui.bg_gutter, bold = false },
                    -- CursorLineNr = { fg = "#545c7e", bg = theme.ui.bg_gutter, bold = true },

                    -- Visual		Visual mode selection.
                    -- Visual = { bg = theme.ui.bg_visual },
                    -- Visual = { bg = palette.waveBlue2 },
                    Visual = { bg = "#2D4F67" },
                    -- VisualNOS	Visual mode selection when vim is "Not Owning the Selection".
                    VisualNOS = { link = "Visual" },

                    NormalFloat = { bg = "none" },
                    FloatBorder = { bg = "none" },
                    FloatTitle = { bg = "none" },

                    -- Save an hlgroup with dark background and dimmed foreground
                    -- so that you can use it where your still want darker windows.
                    -- E.g.: autocmd TermOpen * setlocal winhighlight=Normal:NormalDark
                    NormalDark = { fg = theme.ui.fg_dim, bg = theme.ui.bg_m3 },

                    -- Popular plugins that open floats will link to NormalFloat by default;
                    -- set their background accordingly if you wish to keep them dark and borderless
                    LazyNormal = { bg = theme.ui.bg_m3, fg = theme.ui.fg_dim },
                    MasonNormal = { bg = theme.ui.bg_m3, fg = theme.ui.fg_dim },

                    -- Search = { bg = colors.surimiOrange },
                    -- Search = { bg = '#FFA066' },
                }
            end,
            theme = "wave",              -- Load "wave" theme when 'background' option is not set
            background = {               -- map the value of 'background' option to a theme
                dark = "dragon",           -- try "dragon" !
                light = "lotus"
            },
        })
    end
}

修改 lualine

打开 ~/.config/nvim/lazy/kanagawa.nvim/lua/lualine/themes/kanagawa.lua

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
local theme = require("kanagawa.colors").setup().theme

local kanagawa = {}

kanagawa.normal = {
  a = { bg = theme.syn.fun, fg = theme.ui.bg_m3 },
  b = { bg = theme.diff.change, fg = theme.syn.fun },
  -- c = { bg = theme.ui.bg_p1, fg = theme.ui.fg },
  c = { bg = nil, fg = "#938AA9" },
}

kanagawa.insert = {
  a = { bg = theme.diag.ok, fg = theme.ui.bg },
  b = { bg = theme.ui.bg, fg = theme.diag.ok },
}

kanagawa.command = {
  a = { bg = theme.syn.operator, fg = theme.ui.bg },
  b = { bg = theme.ui.bg, fg = theme.syn.operator },
}

kanagawa.visual = {
  a = { bg = theme.syn.keyword, fg = theme.ui.bg },
  b = { bg = theme.ui.bg, fg = theme.syn.keyword },
}

kanagawa.replace = {
  a = { bg = theme.syn.constant, fg = theme.ui.bg },
  b = { bg = theme.ui.bg, fg = theme.syn.constant },
}

kanagawa.inactive = {
  a = { bg = theme.ui.bg_m3, fg = theme.ui.fg_dim },
  b = { bg = theme.ui.bg_m3, fg = theme.ui.fg_dim, gui = "bold" },
  c = { bg = theme.ui.bg_m3, fg = theme.ui.fg_dim },
}

if vim.g.kanagawa_lualine_bold then
  for _, mode in pairs(kanagawa) do
    mode.a.gui = "bold"
  end
end

return kanagawa

tmux 颜色问题

tmux 可能出现显示颜色问题,需要修改

alacritty

1
2
3
4
## ----------------------------------------------------------------------------env
[env]
TERM='xterm-256color'
# TERM='Alacritty'

tmux

1
2
set -g default-terminal "screen-256color"
set-option -sa terminal-overrides ',screen-256color:Tc'

ref: https://gist.github.com/andersevenrud/015e61af2fd264371032763d4ed965b6

william 支付宝支付宝
william 微信微信
0%