mirror of
https://github.com/harivansh-afk/cozybox.nvim.git
synced 2026-04-15 05:02:08 +00:00
Initial cozybox repo
Import the current cozybox theme into the fresh repository and lighten the default blue accent. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
commit
facd7e7e31
8 changed files with 1804 additions and 0 deletions
11
Makefile
Normal file
11
Makefile
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
TESTS_INIT=tests/minimal_init.lua
|
||||||
|
TESTS_DIR=tests/
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
|
||||||
|
test:
|
||||||
|
@nvim \
|
||||||
|
--headless \
|
||||||
|
--noplugin \
|
||||||
|
-u ${TESTS_INIT} \
|
||||||
|
-c "PlenaryBustedDirectory ${TESTS_DIR} { minimal_init = '${TESTS_INIT}' }"
|
||||||
32
README.md
Normal file
32
README.md
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
# cozybox.nvim
|
||||||
|
|
||||||
|
Cozybox is a warm, dark Neovim theme with nix-tuned blue and green accents, darker editor surfaces, and syntax overrides baked in.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```lua
|
||||||
|
{ "harivansh-afk/cozybox.nvim", priority = 1000 , config = true, opts = ...}
|
||||||
|
```
|
||||||
|
|
||||||
|
Neovim `0.8+`.
|
||||||
|
|
||||||
|
## Enable
|
||||||
|
|
||||||
|
```vim
|
||||||
|
set background=dark " or light if you want light mode
|
||||||
|
colorscheme cozybox
|
||||||
|
```
|
||||||
|
|
||||||
|
## Override
|
||||||
|
|
||||||
|
```lua
|
||||||
|
require("cozybox").setup({
|
||||||
|
transparent_mode = false,
|
||||||
|
palette_overrides = {},
|
||||||
|
overrides = {},
|
||||||
|
})
|
||||||
|
vim.cmd("colorscheme cozybox")
|
||||||
|
```
|
||||||
|
|
||||||
|
The theme already defaults to the custom blue/green palette, hard contrast, darker editor surfaces, and syntax highlight tweaks from your nix config.
|
||||||
|
See `:h cozybox.nvim` or `lua/cozybox.lua` for the full option surface.
|
||||||
1
colors/cozybox.lua
Normal file
1
colors/cozybox.lua
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
require("cozybox").load()
|
||||||
151
doc/cozybox.nvim.txt
Normal file
151
doc/cozybox.nvim.txt
Normal file
|
|
@ -0,0 +1,151 @@
|
||||||
|
*cozybox.nvim.txt* For Neovim >= 0.8.0 Last change: 2026 March 09
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
Table of Contents *cozybox.nvim-table-of-contents*
|
||||||
|
|
||||||
|
1. Prerequisites |cozybox.nvim-prerequisites|
|
||||||
|
2. Installing |cozybox.nvim-installing|
|
||||||
|
- Using packer |cozybox.nvim-installing-using-packer|
|
||||||
|
- Using lazy.nvim |cozybox.nvim-installing-using-lazy.nvim|
|
||||||
|
- Using vim-plug |cozybox.nvim-installing-using-vim-plug|
|
||||||
|
3. Basic Usage |cozybox.nvim-basic-usage|
|
||||||
|
4. Configuration |cozybox.nvim-configuration|
|
||||||
|
- Overriding |cozybox.nvim-configuration-overriding|
|
||||||
|
>
|
||||||
|
<h1> <img src="https://i.postimg.cc/WpQzgxVh/plugin-Icon.png" width="80px"><br/>cozybox.nvim</h1>
|
||||||
|
</div>
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
Cozybox is a warm, dark Neovim theme with nix-tuned blue and green accents,
|
||||||
|
darker editor surfaces, and syntax overrides baked in.
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
1. Prerequisites *cozybox.nvim-prerequisites*
|
||||||
|
|
||||||
|
Neovim 0.8.0+
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
2. Installing *cozybox.nvim-installing*
|
||||||
|
|
||||||
|
|
||||||
|
USING PACKER *cozybox.nvim-installing-using-packer*
|
||||||
|
|
||||||
|
>lua
|
||||||
|
use { "harivansh-afk/cozybox.nvim" }
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
USING LAZY.NVIM *cozybox.nvim-installing-using-lazy.nvim*
|
||||||
|
|
||||||
|
>lua
|
||||||
|
{ "harivansh-afk/cozybox.nvim", priority = 1000 , config = true, opts = ...}
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
USING VIM-PLUG *cozybox.nvim-installing-using-vim-plug*
|
||||||
|
|
||||||
|
>vim
|
||||||
|
Plug 'harivansh-afk/cozybox.nvim'
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
3. Basic Usage *cozybox.nvim-basic-usage*
|
||||||
|
|
||||||
|
Inside `init.vim`
|
||||||
|
|
||||||
|
>vim
|
||||||
|
set background=dark " or light if you want light mode
|
||||||
|
colorscheme cozybox
|
||||||
|
<
|
||||||
|
|
||||||
|
Inside `init.lua`
|
||||||
|
|
||||||
|
>lua
|
||||||
|
vim.o.background = "dark" -- or "light" for light mode
|
||||||
|
vim.cmd([[colorscheme cozybox]])
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
4. Configuration *cozybox.nvim-configuration*
|
||||||
|
|
||||||
|
Cozybox ships with the nix palette overrides and surface tweaks as defaults.
|
||||||
|
A minimal setup looks like this:
|
||||||
|
|
||||||
|
>lua
|
||||||
|
require("cozybox").setup({
|
||||||
|
contrast = "hard",
|
||||||
|
palette_overrides = {
|
||||||
|
bright_blue = "#5b84de",
|
||||||
|
neutral_blue = "#5b84de",
|
||||||
|
faded_blue = "#6c86c8",
|
||||||
|
bright_green = "#8ec97c",
|
||||||
|
neutral_green = "#8ec97c",
|
||||||
|
faded_green = "#6fae70",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
vim.cmd("colorscheme cozybox")
|
||||||
|
<
|
||||||
|
|
||||||
|
Call `setup()` before `colorscheme` if you want to layer more overrides on top
|
||||||
|
of the cozybox defaults.
|
||||||
|
|
||||||
|
|
||||||
|
OVERRIDING *cozybox.nvim-configuration-overriding*
|
||||||
|
|
||||||
|
|
||||||
|
PALETTE ~
|
||||||
|
|
||||||
|
You can specify your own palette colors. For example:
|
||||||
|
|
||||||
|
>lua
|
||||||
|
require("cozybox").setup({
|
||||||
|
palette_overrides = {
|
||||||
|
bright_green = "#990000",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
vim.cmd("colorscheme cozybox")
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
HIGHLIGHT GROUPS ~
|
||||||
|
|
||||||
|
If you don’t enjoy the current color for a specific highlight group, now you
|
||||||
|
can just override it in the setup. For example:
|
||||||
|
|
||||||
|
>lua
|
||||||
|
require("cozybox").setup({
|
||||||
|
overrides = {
|
||||||
|
SignColumn = {bg = "#ff9900"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
vim.cmd("colorscheme cozybox")
|
||||||
|
<
|
||||||
|
|
||||||
|
It also works with treesitter groups and lsp semantic highlight tokens
|
||||||
|
|
||||||
|
>lua
|
||||||
|
require("cozybox").setup({
|
||||||
|
overrides = {
|
||||||
|
["@lsp.type.method"] = { bg = "#ff9900" },
|
||||||
|
["@comment.lua"] = { bg = "#000000" },
|
||||||
|
}
|
||||||
|
})
|
||||||
|
vim.cmd("colorscheme cozybox")
|
||||||
|
<
|
||||||
|
|
||||||
|
Please note that the override values must follow the attributes from the
|
||||||
|
highlight group map, such as:
|
||||||
|
|
||||||
|
- **fg** - foreground color
|
||||||
|
- **bg** - background color
|
||||||
|
- **bold** - true or false for bold font
|
||||||
|
- **italic** - true or false for italic font
|
||||||
|
|
||||||
|
Other values can be seen in |`synIDattr`|
|
||||||
|
|
||||||
|
vim:tw=78:ts=8:noet:ft=help:norl:
|
||||||
1423
lua/cozybox.lua
Normal file
1423
lua/cozybox.lua
Normal file
File diff suppressed because it is too large
Load diff
6
stylua.toml
Normal file
6
stylua.toml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
column_width = 120
|
||||||
|
line_endings = "Unix"
|
||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 2
|
||||||
|
quote_style = "AutoPreferDouble"
|
||||||
|
no_call_parentheses = false
|
||||||
169
tests/cozybox/cozybox_spec.lua
Normal file
169
tests/cozybox/cozybox_spec.lua
Normal file
|
|
@ -0,0 +1,169 @@
|
||||||
|
require("plenary.reload").reload_module("cozybox", true)
|
||||||
|
local cozybox = require("cozybox")
|
||||||
|
local default = cozybox.config
|
||||||
|
|
||||||
|
local function clear_term_colors()
|
||||||
|
for item = 0, 15 do
|
||||||
|
vim.g["terminal_color_" .. item] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe("tests", function()
|
||||||
|
it("works with default values", function()
|
||||||
|
cozybox.setup()
|
||||||
|
assert.are.same(cozybox.config, default)
|
||||||
|
end)
|
||||||
|
|
||||||
|
it("works with config overrides", function()
|
||||||
|
cozybox.setup({ undercurl = false, underline = false })
|
||||||
|
assert.is_false(cozybox.config.undercurl)
|
||||||
|
assert.is_false(cozybox.config.underline)
|
||||||
|
assert.are.same(cozybox.config.contrast, "hard")
|
||||||
|
assert.are.same(cozybox.config.palette_overrides.bright_blue, "#5b84de")
|
||||||
|
assert.are.same(cozybox.config.overrides.Normal.bg, "#181818")
|
||||||
|
end)
|
||||||
|
|
||||||
|
it("should override a hightlight color", function()
|
||||||
|
local config = {
|
||||||
|
overrides = {
|
||||||
|
Search = { fg = "#ff9900", bg = "#000000" },
|
||||||
|
ColorColumn = { bg = "#ff9900" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
cozybox.setup(config)
|
||||||
|
cozybox.load()
|
||||||
|
|
||||||
|
local search_group_id = vim.api.nvim_get_hl_id_by_name("Search")
|
||||||
|
local search_values = {
|
||||||
|
background = vim.fn.synIDattr(search_group_id, "bg", "gui"),
|
||||||
|
foreground = vim.fn.synIDattr(search_group_id, "fg", "gui"),
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.are.same(search_values, { background = "#000000", foreground = "#ff9900" })
|
||||||
|
|
||||||
|
local color_column_group_id = vim.api.nvim_get_hl_id_by_name("ColorColumn")
|
||||||
|
local color_column_values = {
|
||||||
|
background = vim.fn.synIDattr(color_column_group_id, "bg", "gui"),
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.are.same(color_column_values, { background = "#ff9900" })
|
||||||
|
end)
|
||||||
|
|
||||||
|
it("should create new hightlights colors if they dont exist", function()
|
||||||
|
local config = {
|
||||||
|
overrides = {
|
||||||
|
Search = { fg = "#ff9900", bg = "#000000" },
|
||||||
|
New = { bg = "#ff9900" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
cozybox.setup(config)
|
||||||
|
cozybox.load()
|
||||||
|
|
||||||
|
local search_group_id = vim.api.nvim_get_hl_id_by_name("Search")
|
||||||
|
local search_values = {
|
||||||
|
background = vim.fn.synIDattr(search_group_id, "bg", "gui"),
|
||||||
|
foreground = vim.fn.synIDattr(search_group_id, "fg", "gui"),
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.are.same(search_values, { background = "#000000", foreground = "#ff9900" })
|
||||||
|
|
||||||
|
local new_group_id = vim.api.nvim_get_hl_id_by_name("New")
|
||||||
|
local new_group_values = {
|
||||||
|
background = vim.fn.synIDattr(new_group_id, "bg", "gui"),
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.are.same(new_group_values, { background = "#ff9900" })
|
||||||
|
end)
|
||||||
|
|
||||||
|
it("should override links", function()
|
||||||
|
local config = {
|
||||||
|
overrides = {
|
||||||
|
TelescopePreviewBorder = { fg = "#990000", bg = nil },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
cozybox.setup(config)
|
||||||
|
cozybox.load()
|
||||||
|
|
||||||
|
local group_id = vim.api.nvim_get_hl_id_by_name("TelescopePreviewBorder")
|
||||||
|
local values = {
|
||||||
|
fg = vim.fn.synIDattr(group_id, "fg", "gui"),
|
||||||
|
}
|
||||||
|
|
||||||
|
local expected = {
|
||||||
|
fg = "#990000",
|
||||||
|
}
|
||||||
|
assert.are.same(expected, values)
|
||||||
|
end)
|
||||||
|
|
||||||
|
it("should override palette", function()
|
||||||
|
local config = {
|
||||||
|
palette_overrides = {
|
||||||
|
gray = "#ff9900",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
cozybox.setup(config)
|
||||||
|
cozybox.load()
|
||||||
|
|
||||||
|
local group_id = vim.api.nvim_get_hl_id_by_name("Comment")
|
||||||
|
local values = {
|
||||||
|
fg = vim.fn.synIDattr(group_id, "fg", "gui"),
|
||||||
|
}
|
||||||
|
assert.are.same(values, { fg = "#ff9900" })
|
||||||
|
end)
|
||||||
|
|
||||||
|
it("does not set terminal colors when terminal_colors is false", function()
|
||||||
|
clear_term_colors()
|
||||||
|
cozybox.setup({ terminal_colors = false })
|
||||||
|
cozybox.load()
|
||||||
|
assert.is_nil(vim.g.terminal_color_0)
|
||||||
|
end)
|
||||||
|
|
||||||
|
it("sets terminal colors when terminal_colors is true", function()
|
||||||
|
clear_term_colors()
|
||||||
|
cozybox.setup({ terminal_colors = true })
|
||||||
|
cozybox.load()
|
||||||
|
|
||||||
|
-- dark bg
|
||||||
|
local colors = require("cozybox").palette
|
||||||
|
vim.opt.background = "dark"
|
||||||
|
assert.are.same(vim.g.terminal_color_0, colors.dark0_hard)
|
||||||
|
|
||||||
|
-- light bg
|
||||||
|
clear_term_colors()
|
||||||
|
cozybox.load()
|
||||||
|
vim.opt.background = "light"
|
||||||
|
assert.are.same(vim.g.terminal_color_0, colors.light0_hard)
|
||||||
|
end)
|
||||||
|
|
||||||
|
it("multiple calls to setup() are independent", function()
|
||||||
|
-- First call to setup
|
||||||
|
cozybox.setup({
|
||||||
|
contrast = "soft",
|
||||||
|
overrides = { CursorLine = { bg = "#FF0000" } },
|
||||||
|
})
|
||||||
|
assert.are.same(cozybox.config.contrast, "soft")
|
||||||
|
assert.are.same(cozybox.config.overrides.CursorLine.bg, "#FF0000")
|
||||||
|
|
||||||
|
-- Second call to setup
|
||||||
|
cozybox.setup({ contrast = "hard" })
|
||||||
|
assert.are.same(cozybox.config.contrast, "hard")
|
||||||
|
-- Check that overrides from the first call are reset to the cozybox defaults
|
||||||
|
assert.are.same(cozybox.config.overrides.CursorLine.bg, "#1e1e1e")
|
||||||
|
|
||||||
|
-- Third call to setup with different overrides
|
||||||
|
cozybox.setup({
|
||||||
|
overrides = { Normal = { fg = "#00FF00" } },
|
||||||
|
})
|
||||||
|
assert.are.same(cozybox.config.contrast, "hard") -- Contrast should be reset to the cozybox default
|
||||||
|
assert.are.same(cozybox.config.overrides.CursorLine.bg, "#1e1e1e") -- Default CursorLine override is preserved
|
||||||
|
assert.are.same(cozybox.config.overrides.Normal.fg, "#00FF00") -- New override is present
|
||||||
|
|
||||||
|
-- Call setup with no arguments to reset to defaults
|
||||||
|
cozybox.setup()
|
||||||
|
assert.are.same(cozybox.config.contrast, "hard")
|
||||||
|
assert.are.same(cozybox.config.overrides.Normal.bg, "#181818")
|
||||||
|
end)
|
||||||
|
end)
|
||||||
11
tests/minimal_init.lua
Normal file
11
tests/minimal_init.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
local plenary_dir = os.getenv("PLENARY_DIR") or "/tmp/plenary.nvim"
|
||||||
|
local is_not_a_directory = vim.fn.isdirectory(plenary_dir) == 0
|
||||||
|
if is_not_a_directory then
|
||||||
|
vim.fn.system({ "git", "clone", "https://github.com/nvim-lua/plenary.nvim", plenary_dir })
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.opt.rtp:append(".")
|
||||||
|
vim.opt.rtp:append(plenary_dir)
|
||||||
|
|
||||||
|
vim.cmd("runtime plugin/plenary.vim")
|
||||||
|
require("plenary.busted")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue