This is a work in progress port of the classic blue theme from TextMate. There are many great themes for Neovim out there, but I've not yet found one as easy on the eyes as this.
- Extensive support for
TreeSitter
syntax highlighting, and many popular plugins - Compilation to lua byte code for super fast startup times
Download with your favorite package manager:
{
"wurli/cobalt.nvim"
config = function()
vim.cmd[[colorscheme cobalt]]
end
}
use "wurli/cobalt.nvim"
vim.cmd[[colorscheme cobalt]]
- neovim latest
- truecolor terminal support
- undercurl terminal support (optional)
There is no need to call setup if you are ok with the defaults.
-- Default options:
require('cobalt').setup({
compile = false, -- enable compiling the colorscheme
undercurl = true, -- enable undercurls
commentStyle = { italic = true },
functionStyle = {},
keywordStyle = { italic = true},
statementStyle = { bold = true },
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 = { classic = {}, lotus = {}, dragon = {}, all = {} },
},
overrides = function(colors) -- add/modify highlights
return {}
end,
theme = "classic", -- Load "wave" theme when 'background' option is not set
background = { -- map the value of 'background' option to a theme
dark = "classic", -- try "dragon" !
light = "lotus"
},
})
-- setup must be called before loading
vim.cmd("colorscheme cobalt")
NOTE 1: If you enable compilation, make sure to run :CobaltCompile
command every time you make changes to your config.
" 1. Modify your config
" 2. Restart nvim
" 3. Run this command:
:CobaltCompile
NOTE 2: Cobalt adjusts to the value of some options. Make sure that the options 'laststatus'
and 'cmdheight'
are set before calling setup
.
You can conveniently add/modify hlgroups
using the config.overrides
option.
Supported keywords are the same for :h nvim_set_hl
{val}
parameter.
require('cobalt').setup({
...,
overrides = function(colors)
return {
-- Assign a static color to strings
String = { fg = colors.palette.carpYellow, italic = true },
-- theme colors will update dynamically when you change theme!
SomePluginHl = { fg = colors.theme.syn.type, bold = true },
}
end,
...
})
This will make floating windows look nicer with default borders.
overrides = function(colors)
local theme = colors.theme
return {
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 },
}
end,
If you'd like to keep the floating windows darker, but you're unhappy with how borders are rendered, consider using characters that are drawn at the edges of the box:
{ "🭽", "▔", "🭾", "▕", "🭿", "▁", "🭼", "▏" }
Block-like modern Telescope UI
overrides = function(colors)
local theme = colors.theme
return {
TelescopeTitle = { fg = theme.ui.special, bold = true },
TelescopePromptNormal = { bg = theme.ui.bg_p1 },
TelescopePromptBorder = { fg = theme.ui.bg_p1, bg = theme.ui.bg_p1 },
TelescopeResultsNormal = { fg = theme.ui.fg_dim, bg = theme.ui.bg_m1 },
TelescopeResultsBorder = { fg = theme.ui.bg_m1, bg = theme.ui.bg_m1 },
TelescopePreviewNormal = { bg = theme.ui.bg_dim },
TelescopePreviewBorder = { bg = theme.ui.bg_dim, fg = theme.ui.bg_dim },
}
end,
More uniform colors for the popup menu.
overrides = function(colors)
local theme = colors.theme
return {
Pmenu = { fg = theme.ui.shade0, bg = theme.ui.bg_p1 }, -- add `blend = vim.o.pumblend` to enable transparency
PmenuSel = { fg = "NONE", bg = theme.ui.bg_p2 },
PmenuSbar = { bg = theme.ui.bg_m1 },
PmenuThumb = { bg = theme.ui.bg_p2 },
}
end,
-- Get the colors for the current theme
local colors = require("cobalt.colors").setup()
local palette_colors = colors.palette
local theme_colors = colors.theme
-- Get the colors for a specific theme
local classic_colors = require("cobalt.colors").setup({ theme = 'wave' })
The following example provides a snippet to automatically change the theme for the Kitty terminal emulator.
vim.api.nvim_create_autocmd("ColorScheme", {
pattern = "cobalt",
callback = function()
if vim.o.background == "light" then
vim.fn.system("kitty +kitten themes Cobalt_light")
elseif vim.o.background == "dark" then
vim.fn.system("kitty +kitten themes Cobalt_dragon")
else
vim.fn.system("kitty +kitten themes Cobalt")
end
end,
})
The implementation of this plugin is based on the Kanagawa theme by Tommaso Laurenzi.