A dark/light theme for Neovim loosely based on the Monokai color palette. Think Monokai, with slightly more muted magenta, and a light theme that uses (much) darker shades of the Monokai palette.
- 'Just works' in light and dark terminals. No need to set
bg=light|dark|whatever
- Support for popular plugins like treesitter, cmp, telescope, gitsigns, lualine, indent-blankline, which-key, notify, noice, todo-comments and more.
- Upcoming: Smarter comment highlighting. Inline comments should be easily visible, everything else should stay out of your way.
showcase.mp4
- Neovim >= 0.9.0
- nvim-treesitter > 0.9.2
Install with your package manager.
-- Lazy
{
"MartyBeGood/martykai.nvim",
lazy = false,
priority = 1000,
}
No need to use the setup()
function, just set the colorscheme
:
vim.opt.background = "dark" -- default to dark or light style
vim.cmd.colorscheme("martykai")
The Dark/light styles could be toggled by calling the provided function:
:MonokaiToggleLight
In Lua:
require("martykai").toggle()
require("lualine").setup({
options = { theme = "martykai" },
})
β οΈ Set the configuration BEFORE callingcolorscheme martykai
.
Monokai Nightasty comes with these defaults:
{
dark_style_background = "default", -- default, dark, transparent, #color
light_style_background = "default", -- default, dark, transparent, #color
terminal_colors = true, -- Set the colors used when opening a `:terminal`
color_headers = false, -- Enable header colors for each header level (h1, h2, etc.)
hl_styles = {
-- Style to be applied to different syntax groups. See `:help nvim_set_hl`
comments = { italic = true },
keywords = { italic = false },
functions = {},
variables = {},
-- Background styles for sidebars (panels) and floating windows:
floats = "default", -- default, dark, transparent
sidebars = "default", -- default, dark, transparent
},
sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
hide_inactive_statusline = false, -- Hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
dim_inactive = false, -- dims inactive windows
lualine_bold = true, -- Lualine headers will be bold or regular.
lualine_style = "default", -- "dark", "light" or "default" (Follows dark/light style)
markdown_header_marks = false, -- Add headers marks highlights (the `#` character) to Treesitter highlight query
--- You can override specific color groups to use other groups or a hex color
--- function will be called with the theme ColorScheme table
on_colors = function(colors) end,
--- You can override specific highlights to use other groups or a hex color
--- function will be called with the theme Highlights and ColorScheme tables
on_highlights = function(highlights, colors) end,
}
return {
"polirritmico/martykai.nvim",
lazy = false,
priority = 1000,
keys = {
{ "<leader>tt", "<cmd>MonokaiToggleLight<cr>", desc = "martykai: Toggle dark/light theme." },
},
opts = {
dark_style_background = "transparent", -- default, dark, transparent, #color
light_style_background = "default", -- default, dark, transparent, #color
color_headers = true, -- Enable header colors for each header level (h1, h2, etc.)
lualine_bold = true, -- Lualine a and z sections font width
lualine_style = "default", -- "dark", "light" or "default" (Follows dark/light style)
-- Style to be applied to different syntax groups. See `:help nvim_set_hl`
hl_styles = {
keywords = { italic = true },
comments = { italic = true },
},
--- You can override specific color/highlights. Theme color values
--- in `extras/palettes`. Also could be any hex RGB color you like.
on_colors = function(colors)
-- Custom color only for light theme
local current_is_light = vim.o.background == "light"
colors.comment = current_is_light and "#2d7e79" or colors.grey
-- Custom color only for dark theme
colors.border = not current_is_light and colors.magenta or colors.border
-- Custom lualine normal color
colors.lualine.normal_bg = current_is_light and "#7ebd00" or colors.green
end,
on_highlights = function(highlights, colors)
-- You could add styles like bold, underline, italic
highlights.TelescopeSelection = { bold = true }
highlights.TelescopeBorder = { fg = colors.grey }
highlights["@lsp.type.property.lua"] = { fg = colors.fg }
end,
},
config = function(_, opts)
-- Highlight line at the cursor position
vim.opt.cursorline = true
-- Default to dark theme
vim.o.background = "dark" -- dark | light
require("martykai").load(opts)
end,
}
How the plugin setup the highlights and colors under the hood:
-
colors
are loaded from the base palette. The colors of the light style are set incolors.light_palette
. Ifvim.o.background == "light"
is detected, then thedefault
palette is overridden with the light palette values. -
Then,
colors
is extended and adjusted following the configuration settings. -
After that,
config.on_colors(colors)
is called, overriding any matching color. -
The highlight groups are set using the generated
colors
. -
Finally,
config.on_highlights(highlights, colors)
can be used to override highlight groups.
To get the name of a highlight group or to find the used color, here are some alternatives:
- Use
:Inspect
to get info of the highlight group at the current position. - Check the generated palettes in the extras.
- For the theme with the color names instead of the colors code, you could
check directly the
theme.lua
orcolors.lua
files inside thelua/martykai/
directory.
You could set colors for light
or dark
themes using boolean logic:
on_colors = function(colors)
local is_light = vim.o.background == "light"
colors.comment = is_light and "#2d7e79" or colors.grey
colors.border = not is_light and colors.magenta or colors.border
end,
Currently this extra files are generated:
The Monokai Nightasty Palette is a file with the used colors
and highlights
.
To use the generated config files with the corresponding external tool, check
the extras
folder, copy, link or reference the file in each setting. Refer to
the respective program documentation.
Nvim Tressiter no longer provide highlight captures for the headers #
marks.
This plugin will provide them for as long as they work, or until nvim-treesitter
provides any way to highlight them.
To enable this feature, set the markdown_header_marks
option to true
(defaults to false
).
Disabled | Enabled |
---|---|
![]() |
![]() |
Just source the theme file:
source-file 'path/to/martykai_dark.tmux'
Fix undercurls
in Tmux
If the undercurls or colors are not being properly displayed within Tmux, add the following to your config file:
# Undercurl
set -as terminal-features ",xterm-256color:RGB" # or: set -g default-terminal "${TERM}"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
You could import the color palette to use with other plugins:
local colors = require("martykai.colors").setup()
some_plugin_config.title = colors.blue_light
example_plugin_config = {
foo = colors.bg_dark,
bar = colors.blue_light,
}
Some color utility functions are available for your use:
local colors = require("martykai.colors").setup()
local util = require("martykai.util")
some_plugin_config.example = util.lighten(colors.bg, 0.5)
some_plugin_config.another = util.darken(colors.bg, 0.3)
[!NOTE] WiP This shows the original monokai-nightasty
Color name | Hex code | Render |
---|---|---|
Yellow | #ffff87 |
|
Purple | #af87ff |
|
Green | #a4e400 |
|
Blue | #62d8f1 |
|
Magenta | #fc1a70 |
|
Orange | #ff9700 |
Color name | Hex code | Render |
---|---|---|
Yellow | #ff8f00 |
|
Purple | #6054d0 |
|
Green | #4fb000 |
|
Blue | #00b3e3 |
|
Magenta | #ff004b |
|
Orange | #ff4d00 |
This plugin is made mainly for my personal use, but suggestions, issues, or pull requests are very welcome.
Enjoy