humble (re)beginnings

This commit is contained in:
Daniel Lundin 2024-06-03 09:47:45 +02:00
parent 3926adf70c
commit 318ea18b91
No known key found for this signature in database
6 changed files with 63 additions and 87 deletions

View file

@ -1,2 +0,0 @@
vim.o.background = "dark"
require("sumi-e").colorscheme()

View file

@ -1,2 +0,0 @@
vim.o.background = "light"
require("sumi-e").colorscheme()

View file

@ -1 +1,2 @@
require("sumi-e").colorscheme()
package.loaded["sumi-e"] = nil
require("sumi-e")

View file

@ -1,27 +0,0 @@
local colors = {
white = "#ffffff",
black = "#000000",
gray500 = "#7f7f7f",
}
function _colors_dark()
colors.bg = "#11171d"
colors.fg = "#e3e0cd"
colors.string = colors.gray500
colors.comment = colors.gray500
end
function _colors_light()
colors.bg = "#ffffff"
colors.fg = "#000000"
end
function colors.generate()
if vim.o.background == "dark" then
_colors_dark()
else
_colors_light()
end
end
return colors

View file

@ -1,9 +0,0 @@
local config = {
defaults = {
overrides = {},
},
}
setmetatable(config, { __index = config.defaults })
return config

View file

@ -1,51 +1,66 @@
local colors = require("sumi-e.colors")
local config = require("sumi-e.config")
local sumi = {}
vim.g.colors_name = "sumi-e"
local function set_groups()
local groups = {
Normal = { fg = colors.fg, bg = colors.bg },
NormalFloat = { bg = colors.bg },
String = { fg = colors.string, italic = true },
Comment = { fg = colors.comment, bold = true, italic = true },
}
vim.cmd("hi clear")
groups =
vim.tbl_extend("force", groups, type(config.overrides) == "function" and config.overrides() or config.overrides)
for group, parameters in pairs(groups) do
vim.api.nvim_set_hl(0, group, parameters)
end
if vim.fn.exists("syntax_on") == 1 then
vim.cmd("syntax reset")
end
--- Apply user settings.
---@param values table
function sumi.setup(values)
setmetatable(config, { __index = vim.tbl_extend("force", config.defaults, values) })
local colors = {
light = {
foreground = "#202020",
intense = "#000000",
primary = "#ff0000",
secondary = "#00ff00",
diagnostic_error = "#ff0038",
diagnostic_warning = "#ff7700",
diagnostic_info = "#47eae0",
diagnostic_hint = "#47eae0",
diff_add = "#00ff77",
diff_change = "#47eae0",
diff_delete = "#ff0038",
highlight_subtle = "#f0f0f0",
dimmed = "#cccccc",
},
dark = {
foreground = "#b2b2b2",
intense = "#e7e7e7",
primary = "#00ff00",
secondary = "#555555",
diagnostic_error = "#ff0038",
diagnostic_warning = "#ff7700",
diagnostic_info = "#47eae0",
diagnostic_hint = "#47eae0",
diff_add = "#00ff77",
diff_change = "#47eae0",
diff_delete = "#ff0038",
dimmed = "#666666",
highlight_subtle = "#101010",
},
}
local c = colors[vim.o.background]
local theme = {
Constant = { fg = c.foreground },
Delimiter = { fg = c.foreground },
Identifier = { fg = c.foreground },
Normal = { fg = c.foreground },
Keyword = { fg = c.foreground, bold = true },
Operator = { fg = c.foreground },
Special = { fg = c.foreground },
String = { fg = c.foreground },
Type = { fg = c.foreground },
["@function"] = { fg = c.foreground },
["@special"] = { fg = c.foreground },
["@variable"] = { fg = c.foreground },
-- UI Elements
CursorLine = { bg = c.highlight_subtle },
LineNr = { fg = c.dimmed, italic = true },
}
for group, hl in pairs(theme) do
vim.api.nvim_set_hl(0, group, hl)
end
--- Set the colorscheme.
function sumi.colorscheme()
if vim.version().minor < 8 then
vim.notify(
"Neovim 0.8+ is required for sumi-e colorscheme",
vim.log.levels.ERROR,
{ title = "Sumi-e colorscheme" }
)
return
end
vim.api.nvim_command("hi clear")
if vim.fn.exists("syntax_on") then
vim.api.nvim_command("syntax reset")
end
vim.g.VM_theme_set_by_colorscheme = true -- Required for Visual Multi
vim.o.termguicolors = true
vim.g.colors_name = "sumi-e"
colors.generate()
set_groups()
end
return sumi