Compare commits
10 Commits
9f1f4fedf7
...
49396cf922
Author | SHA1 | Date | |
---|---|---|---|
49396cf922
|
|||
cd47babf01
|
|||
3339077059
|
|||
ddca54425d
|
|||
e4575ef47f
|
|||
1a01b546d9
|
|||
2a46b982d9
|
|||
656764cfca
|
|||
26208feca6
|
|||
e7d15542bc
|
1
colors/carbonight-carbon.lua
Normal file
1
colors/carbonight-carbon.lua
Normal file
@@ -0,0 +1 @@
|
|||||||
|
require("carbonight").load({ style = "carbon" })
|
@@ -1 +1 @@
|
|||||||
require('carbonight').load('tokyo')
|
require("carbonight").load({ style = "tokyo" })
|
||||||
|
54
lua/carbonight/colors/carbon.lua
Normal file
54
lua/carbonight/colors/carbon.lua
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
--[[
|
||||||
|
Copyright (C) 2024 Kyren223
|
||||||
|
This file is licensed under the GPL-3.0-or-later license, see https://fsf.org/licenses/gpl-3.0
|
||||||
|
--]]
|
||||||
|
|
||||||
|
local utils = require("carbonight.utils")
|
||||||
|
|
||||||
|
---@class Colors
|
||||||
|
local M = {
|
||||||
|
-- normal = { fg = '#EFEDE7', bg = '#09090F' },
|
||||||
|
normal = { fg = "#EFEDE7", bg = "#1B1B1B" },
|
||||||
|
visual = { bg = "#232143" },
|
||||||
|
cursor_line = { bg = "#281E25" },
|
||||||
|
violet = { fg = "#D484FF" },
|
||||||
|
gray_underline = { underline = true, sp = "#909090" },
|
||||||
|
unused = { fg = "#808080", undercurl = true, sp = "#808080", bold = true },
|
||||||
|
comment = { fg = "#007215" },
|
||||||
|
success = { fg = "#46d46c" },
|
||||||
|
doc_comment = { fg = "#5D545F" },
|
||||||
|
macro = { fg = "#DD6718" },
|
||||||
|
string = { fg = "#F6D087" },
|
||||||
|
keyword = { fg = "#F16265", nocombine = true },
|
||||||
|
identifier = { fg = "#BB91F0" },
|
||||||
|
variable = { fg = "#E6F0A8" },
|
||||||
|
-- function_declaration = { fg = "#54D7A9" },
|
||||||
|
-- function_call = { fg = "#51C6DC" },
|
||||||
|
function_declaration = { fg = "#8DDEE0", bold = true, italic = true },
|
||||||
|
function_call = { fg = "#8EDFF9", nocombine = true },
|
||||||
|
label = { fg = "#20999D", italic = true },
|
||||||
|
operator = { fg = "#54D7A9" },
|
||||||
|
parentheses = { fg = "#F9FAF4" },
|
||||||
|
-- type = { fg = "#51C6DC" },
|
||||||
|
type = { fg = "#54D7A9", bold = true, italic = true },
|
||||||
|
interface = { fg = "#54D7A9", nocombine = true },
|
||||||
|
static_field = { fg = "#F8F8F2" },
|
||||||
|
type_parameter = { fg = "#007E8A" },
|
||||||
|
parameter = { fg = "#F5A670" },
|
||||||
|
annotation = { fg = "#D9E577" },
|
||||||
|
rust_macro = { fg = "#5874FF" },
|
||||||
|
illuminate = { bg = "#534355" },
|
||||||
|
git_modified = { fg = "#00f1f5", bold = true, italic = true },
|
||||||
|
enum = { fg = "#D8C44B", nocombine = true },
|
||||||
|
abstract = { fg = "#52E3F6", bold = true, italic = true },
|
||||||
|
conflict_ours_marker = { bg = "#333955", bold = true },
|
||||||
|
conflict_ours = { bg = "#25293D" },
|
||||||
|
conflict_base_marker = { bg = "#202728" },
|
||||||
|
conflict_base = { bg = "#252D2F" },
|
||||||
|
conflict_theirs = { bg = "#3d242c" },
|
||||||
|
conflict_theirs_marker = { bg = "#57323e", bold = true },
|
||||||
|
}
|
||||||
|
|
||||||
|
M.static_method = utils.override(M.normal, { bg = "NONE", italic = true })
|
||||||
|
|
||||||
|
return M
|
@@ -3,44 +3,30 @@ Copyright (C) 2024 Kyren223
|
|||||||
This file is licensed under the GPL-3.0-or-later license, see https://fsf.org/licenses/gpl-3.0
|
This file is licensed under the GPL-3.0-or-later license, see https://fsf.org/licenses/gpl-3.0
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local utils = require("carbonight.utils")
|
local M = {}
|
||||||
|
|
||||||
---@class Colors
|
---@param opts? carbonight.Config
|
||||||
local M = {
|
function M.setup(opts)
|
||||||
-- normal = { fg = '#EFEDE7', bg = '#09090F' },
|
if not opts or not opts.style then
|
||||||
normal = { fg = "#EFEDE7", bg = "#1B1B1B" },
|
return require("carbonight.colors.carbon") -- fallback
|
||||||
visual = { bg = "#232143" },
|
end
|
||||||
cursor_line = { bg = "#281E25" },
|
|
||||||
violet = { fg = "#D484FF" },
|
|
||||||
gray_underline = { underline = true, sp = "#909090" },
|
|
||||||
unused = { fg = "#808080", undercurl = true, sp = "#808080", bold = true },
|
|
||||||
comment = { fg = "#007215" },
|
|
||||||
success = { fg = "#46d46c" },
|
|
||||||
doc_comment = { fg = "#5D545F" },
|
|
||||||
macro = { fg = "#DD6718" },
|
|
||||||
string = { fg = "#F6D087" },
|
|
||||||
keyword = { fg = "#F16265", nocombine = true },
|
|
||||||
identifier = { fg = "#BB91F0" },
|
|
||||||
variable = { fg = "#E6F0A8" },
|
|
||||||
-- function_declaration = { fg = "#54D7A9" },
|
|
||||||
-- function_call = { fg = "#51C6DC" },
|
|
||||||
function_declaration = { fg = "#8DDEE0", bold = true, italic = true },
|
|
||||||
function_call = { fg = "#8EDFF9" },
|
|
||||||
label = { fg = "#20999D", italic = true },
|
|
||||||
operator = { fg = "#54D7A9" },
|
|
||||||
parentheses = { fg = "#F9FAF4" },
|
|
||||||
-- type = { fg = "#51C6DC" },
|
|
||||||
type = { fg = "#54D7A9", bold = true, italic = true },
|
|
||||||
interface = { fg = "#54D7A9" },
|
|
||||||
static_field = { fg = "#F8F8F2" },
|
|
||||||
type_parameter = { fg = "#007E8A" },
|
|
||||||
parameter = { fg = "#F5A670" },
|
|
||||||
annotation = { fg = "#D9E577" },
|
|
||||||
rust_macro = { fg = "#5874FF" },
|
|
||||||
illuminate = { bg = "#534355" },
|
|
||||||
git_modified = { fg = "#00f1f5", bold = true, italic = true },
|
|
||||||
}
|
|
||||||
|
|
||||||
M.static_method = utils.override(M.normal, { bg = "NONE", italic = true })
|
if type(opts.style) ~= "string" then
|
||||||
|
vim.notify("Style must be a string!", vim.log.levels.ERROR, { title = "Carbonight" })
|
||||||
|
return require("carbonight.colors.carbon") -- fallback
|
||||||
|
end
|
||||||
|
|
||||||
|
local ok, colors = pcall(require, "carbonight.colors." .. opts.style)
|
||||||
|
if not ok then
|
||||||
|
vim.notify(
|
||||||
|
'Style "' .. opts.style .. '" not found, unable to load colorscheme!',
|
||||||
|
vim.log.levels.ERROR,
|
||||||
|
{ title = "Carbonight" }
|
||||||
|
)
|
||||||
|
return require("carbonight.colors.carbon") -- fallback
|
||||||
|
end
|
||||||
|
|
||||||
|
return colors
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@@ -5,7 +5,8 @@ This file is licensed under the GPL-3.0-or-later license, see https://fsf.org/li
|
|||||||
|
|
||||||
local utils = require("carbonight.utils")
|
local utils = require("carbonight.utils")
|
||||||
|
|
||||||
local c = utils.deep_copy(require("carbonight.colors"))
|
---@type Colors
|
||||||
|
local c = utils.deep_copy(require("carbonight.colors.carbon"))
|
||||||
|
|
||||||
c.normal.bg = "#1E1E2E"
|
c.normal.bg = "#1E1E2E"
|
||||||
c.visual.bg = utils.blend("#3d59a1", 0.4)
|
c.visual.bg = utils.blend("#3d59a1", 0.4)
|
||||||
@@ -13,4 +14,5 @@ c.cursor_line.bg = "#292e42"
|
|||||||
c.illuminate.bg = "#3b4261"
|
c.illuminate.bg = "#3b4261"
|
||||||
c.comment.fg = "#565f89"
|
c.comment.fg = "#565f89"
|
||||||
|
|
||||||
|
---@type Colors
|
||||||
return c
|
return c
|
||||||
|
34
lua/carbonight/config.lua
Normal file
34
lua/carbonight/config.lua
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
--[[
|
||||||
|
Copyright (C) 2024 Kyren223
|
||||||
|
This file is licensed under the GPL-3.0-or-later license, see https://fsf.org/licenses/gpl-3.0
|
||||||
|
--]]
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@class carbonight.Config
|
||||||
|
M.defaults = {
|
||||||
|
style = "carbon", -- Theme variation, "carbon" or "tokyo"
|
||||||
|
}
|
||||||
|
|
||||||
|
---@type carbonight.Config
|
||||||
|
M.options = nil
|
||||||
|
|
||||||
|
---@param options? carbonight.Config
|
||||||
|
function M.setup(options)
|
||||||
|
M.options = vim.tbl_deep_extend("force", {}, M.defaults, options or {})
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param opts? carbonight.Config
|
||||||
|
function M.extend(opts)
|
||||||
|
return opts and vim.tbl_deep_extend("force", {}, M.options, opts) or M.options
|
||||||
|
end
|
||||||
|
|
||||||
|
setmetatable(M, {
|
||||||
|
__index = function(_, k)
|
||||||
|
if k == "options" then
|
||||||
|
return M.defaults
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
return M
|
24
lua/carbonight/groups/conflict-marker.lua
Normal file
24
lua/carbonight/groups/conflict-marker.lua
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
--[[
|
||||||
|
Copyright (C) 2025 Kyren223
|
||||||
|
This file is licensed under the GPL-3.0-or-later license, see https://fsf.org/licenses/gpl-3.0
|
||||||
|
--]]
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@param c Colors
|
||||||
|
function M.get(c)
|
||||||
|
return {
|
||||||
|
ConflictOursMarker = c.conflict_ours_marker,
|
||||||
|
ConflictOurs = c.conflict_ours,
|
||||||
|
|
||||||
|
ConflictBaseMarker = c.conflict_base_marker,
|
||||||
|
ConflictBase = c.conflict_base,
|
||||||
|
|
||||||
|
ConflictMid = c.conflict_base_marker,
|
||||||
|
|
||||||
|
ConflictTheirs = c.conflict_theirs_marker,
|
||||||
|
ConflictTheirsMarker = c.conflict_theirs,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
@@ -13,12 +13,15 @@ local groups = {
|
|||||||
"nvim-cmp",
|
"nvim-cmp",
|
||||||
"neogit",
|
"neogit",
|
||||||
"ghostty",
|
"ghostty",
|
||||||
|
"conflict-marker"
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.setup(colors)
|
---@param colors? Colors
|
||||||
|
---@param opts? carbonight.Config
|
||||||
|
function M.setup(colors, opts)
|
||||||
local highlights = {}
|
local highlights = {}
|
||||||
for _, v in ipairs(groups) do
|
for _, v in ipairs(groups) do
|
||||||
local group = require("carbonight.groups." .. v).get(colors)
|
local group = require("carbonight.groups." .. v).get(colors, opts)
|
||||||
highlights = vim.tbl_deep_extend("error", highlights, group)
|
highlights = vim.tbl_deep_extend("error", highlights, group)
|
||||||
end
|
end
|
||||||
return highlights
|
return highlights
|
||||||
|
@@ -52,6 +52,7 @@ function M.get(c)
|
|||||||
["@lsp.type.keywordLiteral"] = c.keyword,
|
["@lsp.type.keywordLiteral"] = c.keyword,
|
||||||
["@lsp.type.variable"] = {},
|
["@lsp.type.variable"] = {},
|
||||||
["@lsp.type.type"] = {},
|
["@lsp.type.type"] = {},
|
||||||
|
["@lsp.type.comment"] = {},
|
||||||
|
|
||||||
-- NOTE: Rust
|
-- NOTE: Rust
|
||||||
-- ['@variable.rust'] = c.identifier,
|
-- ['@variable.rust'] = c.identifier,
|
||||||
@@ -75,13 +76,42 @@ function M.get(c)
|
|||||||
["@lsp.type.string.go"] = {},
|
["@lsp.type.string.go"] = {},
|
||||||
["@lsp.type.type.go"] = {},
|
["@lsp.type.type.go"] = {},
|
||||||
["@lsp.type.variable.go"] = {},
|
["@lsp.type.variable.go"] = {},
|
||||||
["@lsp.mod.readonly.go"] = { link = "@constant"},
|
["@lsp.mod.readonly.go"] = "@constant",
|
||||||
["@lsp.typemod.variable.defaultLibrary.go"] = { link = "@constant.builtin" },
|
["@lsp.typemod.variable.defaultLibrary.go"] = "@constant.builtin",
|
||||||
["@lsp.typemod.type.defaultLibrary.go"] = { link = "@type.builtin" },
|
["@lsp.typemod.type.defaultLibrary.go"] = "@type.builtin",
|
||||||
|
|
||||||
|
|
||||||
-- NOTE: Java
|
-- NOTE: Java
|
||||||
["@lsp.type.modifier.java"] = c.keyword
|
["@lsp.type.modifier.java"] = c.keyword,
|
||||||
|
["@variable.builtin.java"] = c.keyword,
|
||||||
|
["@lsp.type.enum.java"] = c.enum,
|
||||||
|
["@lsp.typemod.enumMember.public.java"] = c.type,
|
||||||
|
["@lsp.typemod.enumMember.readonly.java"] = c.type,
|
||||||
|
["@lsp.typemod.enumMember.staitc.java"] = c.type,
|
||||||
|
["@lsp.typemod.property.declaration.java"] = c.type,
|
||||||
|
["@lsp.typemod.property.public.java"] = c.type,
|
||||||
|
["@lsp.typemod.property.readonly.java"] = c.type,
|
||||||
|
["@lsp.typemod.property.static.java"] = c.type,
|
||||||
|
["@lsp.typemod.class.abstract.java"] = c.abstract,
|
||||||
|
["@lsp.typemod.class.constructor.java"] = utils.override(c.function_call, { bold = true, italic = true }),
|
||||||
|
["@lsp.typemod.enum.public.java"] = c.enum,
|
||||||
|
["@lsp.typemod.enum.readonly.java"] = c.enum,
|
||||||
|
["@lsp.typemod.enum.static.java"] = c.enum,
|
||||||
|
["@lsp.type.parameter.java"] = { fg = "#D9AD69", italic = true },
|
||||||
|
|
||||||
|
-- NOTE: zig
|
||||||
|
["@lsp.type.string.zig"] = {},
|
||||||
|
|
||||||
|
-- NOTE: C/C++
|
||||||
|
["@lsp.type.comment.cpp"] = c.doc_comment, -- unused conditional code
|
||||||
|
["@lsp.type.enumMember.cpp"] = c.enum,
|
||||||
|
["@lsp.type.enumMember.c"] = c.enum,
|
||||||
|
|
||||||
|
-- NOTE: comments
|
||||||
|
["@comment.todo"] = { fg = c.function_call.fg, bold = true },
|
||||||
|
["@comment.note"] = { fg = c.success.fg, bold = true },
|
||||||
|
["@comment.warning"] = { fg = c.annotation.fg, bold = true },
|
||||||
|
["@comment.error"] = { fg = c.keyword.fg, bold = true },
|
||||||
|
["@comment.perf"] = { fg = c.identifier.fg, bold = true },
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@@ -3,35 +3,33 @@ Copyright (C) 2024 Kyren223
|
|||||||
This file is licensed under the GPL-3.0-or-later license, see https://fsf.org/licenses/gpl-3.0
|
This file is licensed under the GPL-3.0-or-later license, see https://fsf.org/licenses/gpl-3.0
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
local config = require("carbonight.config")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.load(style)
|
---@param opts? carbonight.Config
|
||||||
local colors
|
function M.load(opts)
|
||||||
if style ~= nil then
|
opts = require("carbonight.config").extend(opts)
|
||||||
if not type(style) == "string" then
|
|
||||||
vim.notify("Style must be a string!", vim.log.levels.ERROR, { title = "Carbonight" })
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local ok, result = pcall(require, "carbonight.colors." .. style)
|
local colors = require("carbonight.colors").setup(opts)
|
||||||
if not ok then
|
local groups = require("carbonight.groups").setup(colors, opts)
|
||||||
vim.notify(
|
|
||||||
'Style "' .. style .. '" not found, unable to load colorscheme!',
|
-- Only needed to clear when not the default colorscheme
|
||||||
vim.log.levels.ERROR,
|
if vim.g.colors_name then
|
||||||
{ title = "Carbonight" }
|
vim.cmd("hi clear")
|
||||||
)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
colors = result
|
|
||||||
else
|
|
||||||
colors = require("carbonight.colors")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local highlights = require("carbonight.groups").setup(colors)
|
vim.o.termguicolors = true
|
||||||
|
vim.g.colors_name = "carbonight-" .. opts.style
|
||||||
|
|
||||||
for group, args in pairs(highlights) do
|
for group, hl in pairs(groups) do
|
||||||
vim.api.nvim_set_hl(0, group, args)
|
hl = type(hl) == "string" and { link = hl } or hl
|
||||||
|
vim.api.nvim_set_hl(0, group, hl)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return colors, groups, opts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.setup = config.setup
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@@ -8,7 +8,7 @@ function M.override(original, extension)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@param c string hex color code
|
---@param c string hex color code
|
||||||
---@return number color color as RGB number
|
---@return table color color as RGB table
|
||||||
function M.rgb(c)
|
function M.rgb(c)
|
||||||
c = string.lower(c)
|
c = string.lower(c)
|
||||||
return { tonumber(c:sub(2, 3), 16), tonumber(c:sub(4, 5), 16), tonumber(c:sub(6, 7), 16) }
|
return { tonumber(c:sub(2, 3), 16), tonumber(c:sub(4, 5), 16), tonumber(c:sub(6, 7), 16) }
|
||||||
|
Reference in New Issue
Block a user