A dark/light theme for Neovim based on the Monokai color palette. This theme is born from a mix between the code of the great tokyonight.nvim and the palette of the flavorful vim-monokai-tasty.
Install with your package manager.
-- Lazy
{
"polirritmico/monokai-nightasty.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 monokai-nightasty]])
The Dark/light styles could be toggled by calling the provided function:
:MonokaiToggleLight
require("lualine").setup({
options = { theme = "monokai-nightasty" },
})
⚠️ Set the configuration BEFORE calling
colorscheme monokai-nightasty
.
Check the defaults
table in the config.lua
file.
-- Highlight line at the cursor position
vim.opt.cursorline = true
-- Default to dark theme
vim.o.background = "dark" -- dark | light
require("monokai-nightasty").setup({
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_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. Color values in `extras/palettes`
on_colors = function(colors)
colors.border = colors.grey
colors.comment = "#2d7e79"
end
on_highlights = function(highlights, colors)
highlights.TelescopeNormal = { fg = colors.magenta, bg = colors.charcoal }
highlights.WinSeparator = { fg = colors.grey }
end,
})
-- Load the theme AFTER the setup
vim.cmd("colorscheme monokai-nightasty")
-- Toggle Dark/Light styles
vim.keymap.set(
{"n", "v"}, "<leader>tl", "<CMD>MonokaiToggleLight<CR>",
{silent = true, desc = "Monokai-NighTasty: Toggle light/dark theme"}
)
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 in colors.light_palette
. If vim.o.background == "light"
is
detected, then the default
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. Currently, any change with config.on_colors(colors)
affects both
light and dark styles.
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:
:Inspect
to get info of the highlight group at the current position.:TSHighlightCapturesUnderCursor
from the
playground plugin.theme.lua
or colors.lua
files inside the
lua/monokai-nightasty/
directory.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.
Just source the theme file:
source-file 'path/to/monokai-nightasty_dark.tmux'
undercurls
in TmuxIf 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("monokai-nightasty.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("monokai-nightasty.colors").setup()
local util = require("monokai-nightasty.util")
some_plugin_config.example = util.lighten(colors.bg, 0.5)
some_plugin_config.another = util.darken(colors.bg, 0.3)
Color name | Hex code | Render |
---|---|---|
Yellow | #ffff87 |
|
Purple | #af87ff |
|
Green Light | #a4e400 |
|
Blue Light | #62d8f1 |
|
Magenta | #fc1a70 |
|
Orange | #ff9700 |
Color name | Hex code | Render |
---|---|---|
Yellow | #ff8f00 |
|
Purple | #6054d0 |
|
Green Light | #4fb000 |
|
Blue Light | #00b3e3 |
|
Magenta | #ff004b |
|
Orange | #ff4d00 |
This plugin is made mainly for my personal use, but suggestions, issues, or pull requests are very welcome.
Enjoy