Skip to content

webhooked/kanso.nvim

Repository files navigation

🌊 Kansō.nvim 🌊

Kansō is an elegant evolution of the original Kanagawa theme.
A dark theme that invites focus, not attention.

Neovim W3C


✨ Features

  • 🌈 Extensive support for TreeSitter syntax highlighting
  • 🔌 Compatible with popular plugins out of the box
  • ⚡ Compilation to lua byte code for fast startup times
  • 🎨 Three beautiful theme variants to match your mood and environment
  • 👁️ WCAG 2.1 AA compliant

📦 Installation

Download with your favorite package manager.

-- Using Packer
use "webhooked/kanso.nvim"

-- Using Lazy
{
  "webhooked/kanso.nvim",
  lazy = false,
  priority = 1000,
}

📋 Requirements

  • Terminal with truecolor support
  • Terminal with undercurl support (optional)

🚀 Usage

As simple as writing:

colorscheme kanso

Or in Lua:

vim.cmd("colorscheme kanso")

⚙️ Configuration

There is no need to call setup if you are ok with the defaults.

-- Default options:
require('kanso').setup({
    bold = true,                 -- enable bold fonts
    italics = true,             -- enable italics
    compile = false,             -- enable compiling the colorscheme
    undercurl = true,            -- enable undercurls
    commentStyle = { italic = true },
    functionStyle = {},
    keywordStyle = { italic = true},
    statementStyle = {},
    typeStyle = {},
    transparent = false,         -- do not set background color
    dimInactive = false,         -- dim inactive window `:h hl-NormalNC`
    terminalColors = true,       -- define vim.g.terminal_color_{0,17}
    colors = {                   -- add/modify theme and palette colors
        palette = {},
        theme = { zen = {}, pearl = {}, ink = {}, all = {} },
    },
    overrides = function(colors) -- add/modify highlights
        return {}
    end,
    theme = "zen",              -- Load "zen" theme
    background = {               -- map the value of 'background' option to a theme
        dark = "zen",           -- try "ink" !
        light = "pearl"         -- try "mist" !
    },
})

-- setup must be called before loading
vim.cmd("colorscheme kanso")
💡 Important Notes

Compilation: If you enable compilation, make sure to run :KansōCompile command every time you make changes to your config.

" 1. Modify your config
" 2. Restart nvim
" 3. Run this command:
:KansōCompile

Options: Kansō adjusts to the value of some options. Make sure that the options 'laststatus' and 'cmdheight' are set before calling setup.

🎨 Themes

Kansō comes in four beautiful variants:

  • Zen (Dark)
  • Ink (Dark)
  • Mist (Dark)
  • Pearl (Light)

✧ Zen ✧

Deep & rich dark theme for focused coding.



✧ Ink ✧

Balanced theme with elegant contrast.



✧ Mist ✧

Soft & muted dark theme with gentle contrast.



✧ Pearl ✧

Light theme for daytime productivity.


🔄 Switching Between Themes

Themes can be changed in three ways:

  1. Setting config.theme to the desired theme.
  2. Using the background option: Any change to the value of vim.o.background will select the theme mapped by config.background.
  3. Loading the colorscheme directly with:
vim.cmd("colorscheme kanso-zen")
vim.cmd("colorscheme kanso-ink")
vim.cmd("colorscheme kanso-mist")
vim.cmd("colorscheme kanso-pearl")

or

require("kanso").load("zen")

🧰 Customization

In Kansō, there are two kinds of colors: PaletteColors and ThemeColors; PaletteColors are defined directly as RGB Hex strings, and have arbitrary names that recall their actual color. Conversely, ThemeColors are named and grouped semantically on the basis of their actual function.

In short, a palette defines all the available colors, while a theme maps the PaletteColors to specific ThemeColors and the same palette color may be assigned to multiple theme colors.

📝 Color Customization Example

You can change both theme or palette colors using config.colors. All the palette color names can be found here, while their usage by each theme can be found here.

require('kanso').setup({
    ...,
    colors = {
        palette = {
            -- change all usages of these colors
            zen0 = "#000000",
            fujiWhite = "#FFFFFF",
        },
        theme = {
            -- change specific usages for a certain theme, or for all of them
            zen = {
                ui = {
                    float = {
                        bg = "none",
                    },
                },
            },
            ink = {
                syn = {
                    parameter = "yellow",
                },
            },
            all = {
                ui = {
                    cursor_line_nr_active_foreground = "#C4746E"
                }
            }
        }
    },
    ...
})
🔧 Highlight Group Overrides

You can also conveniently add/modify any hlgroups using the config.overrides option, allowing you to customize the looks of specific built-in elements, or any other external plugins that provides hlgroups. (See :help highlight for more information on hlgroups.) Supported keywords are the same for :h nvim_set_hl {val} parameter.

require('kanso').setup({
    ...,
    overrides = function(colors)
        return {
            -- Assign a static color to strings
            String = { fg = colors.palette.carpYellow, italic = config.italics },
            -- theme colors will update dynamically when you change theme!
            SomePluginHl = { fg = colors.theme.syn.type, bold = true },
        }
    end,
    ...
})

🔄 Integration

Get palette and theme colors

-- Get the colors for the current theme
local colors = require("kanso.colors").setup()
local palette_colors = colors.palette
local theme_colors = colors.theme

-- Get the colors for a specific theme
local zen_colors = require("kanso.colors").setup({ theme = 'zen' })

🧩 Extras

💎 Credits

The theme is inspired by the Kanagawa theme.

  • rebelot for the original Kanagawa Neovim theme

🙏 Acknowledgements

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 7