mirror of
https://github.com/timmypidashev/darkbox.nvim.git
synced 2026-04-14 03:33:51 +00:00
Merge pull request #4 from timmypidashev/3-feature-request-customize-colors
v1.0.0
This commit is contained in:
BIN
.github/darkbox.png
vendored
BIN
.github/darkbox.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 KiB |
BIN
.github/screenshot.png
vendored
BIN
.github/screenshot.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 547 KiB |
BIN
.github/screenshot_classic.png
vendored
Normal file
BIN
.github/screenshot_classic.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 349 KiB |
BIN
.github/screenshot_dim.png
vendored
Normal file
BIN
.github/screenshot_dim.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 330 KiB |
BIN
.github/screenshot_retro.png
vendored
Normal file
BIN
.github/screenshot_retro.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 342 KiB |
25
.github/workflows/doc.yml
vendored
Normal file
25
.github/workflows/doc.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
name: docs
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: panvimdoc
|
||||
uses: kdheepak/panvimdoc@main
|
||||
with:
|
||||
vimdoc: gruvbox.nvim
|
||||
version: "Neovim >= 0.8.0"
|
||||
demojify: true
|
||||
treesitter: true
|
||||
- name: Push changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "auto-generate vimdoc"
|
||||
commit_user_name: "github-actions[bot]"
|
||||
commit_user_email: "github-actions[bot]@users.noreply.github.com"
|
||||
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
|
||||
24
.github/workflows/test.yml
vendored
Normal file
24
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
on: [push, pull_request]
|
||||
name: default
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
nvim-versions: ["stable", "nightly"]
|
||||
name: test
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- uses: rhysd/action-setup-vim@v1
|
||||
with:
|
||||
neovim: true
|
||||
version: ${{ matrix.nvim-versions }}
|
||||
|
||||
- name: run tests
|
||||
run: make test
|
||||
env:
|
||||
PLENARY_DIR: vendor/plenary.nvim
|
||||
11
Makefile
Normal file
11
Makefile
Normal file
@@ -0,0 +1,11 @@
|
||||
TESTS_INIT=tests/init.lua
|
||||
TESTS_DIR=tests/
|
||||
|
||||
.PHONY: test
|
||||
|
||||
test:
|
||||
@nvim \
|
||||
--headless \
|
||||
--noplugin \
|
||||
-u ${TESTS_INIT} \
|
||||
-c "PlenaryBustedDirectory ${TESTS_DIR} { minimal_init = '${TESTS_INIT}' }"
|
||||
60
README.md
60
README.md
@@ -9,6 +9,17 @@ A pure-black refresh of the retro-groove aesthetic for modern displays. Darkbox
|
||||
- Retro-groove inspired color palette with modern refinements
|
||||
- Built-in support for tree-sitter
|
||||
|
||||
## 📸 Screenshots
|
||||
|
||||
### Classic
|
||||

|
||||
|
||||
### Retro
|
||||

|
||||
|
||||
### Dim
|
||||

|
||||
|
||||
## 🚀 Installation
|
||||
|
||||
### Using [lazy.nvim](https://github.com/folke/lazy.nvim)
|
||||
@@ -25,9 +36,54 @@ return {
|
||||
}
|
||||
```
|
||||
|
||||
## 📸 Screenshot
|
||||
## ✏️ Configuration
|
||||
|
||||

|
||||
Additional settings for darkbox are available:
|
||||
```lua
|
||||
-- Default options:
|
||||
require("darkbox").setup({
|
||||
terminal_colors = true, -- add neovim terminal colors
|
||||
undercurl = true,
|
||||
underline = true,
|
||||
bold = true,
|
||||
italic = {
|
||||
strings = true,
|
||||
emphasis = true,
|
||||
comments = true,
|
||||
operators = false,
|
||||
folds = true,
|
||||
},
|
||||
strikethrough = true,
|
||||
invert_selection = false,
|
||||
invert_signs = false,
|
||||
invert_tabline = false,
|
||||
invert_intend_guides = false,
|
||||
inverse = true, -- invert background for search, diffs, statuslines and errors
|
||||
contrast = "", -- can be "retro", "dim" or empty string for classic
|
||||
palette_overrides = {},
|
||||
overrides = {},
|
||||
dim_inactive = false,
|
||||
transparent_mode = false,
|
||||
})
|
||||
vim.cmd("colorscheme darkbox")
|
||||
```
|
||||
|
||||
**VERY IMPORTANT**: Make sure to call setup() **BEFORE** calling the colorscheme command, to use your custom configs
|
||||
|
||||
## 🔧 Overrides
|
||||
|
||||
### Palette
|
||||
|
||||
You can specify your own palette colors. For example:
|
||||
|
||||
```lua
|
||||
require("darkbox").setup({
|
||||
palette_overrides = {
|
||||
base_red = "#991900",
|
||||
}
|
||||
})
|
||||
vim.cmd("colorscheme darkbox")
|
||||
```
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
|
||||
1576
lua/darkbox.lua
1576
lua/darkbox.lua
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
|
||||
144
tests/darkbox/darkbox_spec.lua
Normal file
144
tests/darkbox/darkbox_spec.lua
Normal file
@@ -0,0 +1,144 @@
|
||||
require("plenary.reload").reload_module("darkbox", true)
|
||||
local darkbox = require("darkbox")
|
||||
local default = darkbox.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()
|
||||
darkbox.setup()
|
||||
assert.are.same(darkbox.config, default)
|
||||
end)
|
||||
|
||||
it("works with config overrides", function()
|
||||
local expected = {
|
||||
terminal_colors = true,
|
||||
undercurl = false,
|
||||
underline = false,
|
||||
bold = true,
|
||||
italic = {
|
||||
strings = true,
|
||||
emphasis = true,
|
||||
comments = true,
|
||||
operators = false,
|
||||
folds = true,
|
||||
},
|
||||
strikethrough = true,
|
||||
inverse = true,
|
||||
invert_selection = false,
|
||||
invert_signs = false,
|
||||
invert_tabline = false,
|
||||
invert_intend_guides = false,
|
||||
contrast = "",
|
||||
palette_overrides = {},
|
||||
overrides = {},
|
||||
dim_inactive = false,
|
||||
transparent_mode = false,
|
||||
}
|
||||
|
||||
darkbox.setup({ undercurl = false, underline = false })
|
||||
assert.are.same(darkbox.config, expected)
|
||||
end)
|
||||
|
||||
it("should override a hightlight color", function()
|
||||
local config = {
|
||||
overrides = {
|
||||
Search = { fg = "#ff9900", bg = "#000000" },
|
||||
ColorColumn = { bg = "#ff9900" },
|
||||
},
|
||||
}
|
||||
|
||||
darkbox.setup(config)
|
||||
darkbox.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" },
|
||||
},
|
||||
}
|
||||
|
||||
darkbox.setup(config)
|
||||
darkbox.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 },
|
||||
},
|
||||
}
|
||||
darkbox.setup(config)
|
||||
darkbox.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",
|
||||
},
|
||||
}
|
||||
|
||||
darkbox.setup(config)
|
||||
darkbox.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()
|
||||
darkbox.setup({ terminal_colors = false })
|
||||
darkbox.load()
|
||||
assert.is_nil(vim.g.terminal_color_0)
|
||||
end)
|
||||
end)
|
||||
11
tests/init.lua
Normal file
11
tests/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")
|
||||
Reference in New Issue
Block a user