2021-04-17 19:22:55 +00:00
|
|
|
local util = require("tokyonight.util")
|
2021-04-20 11:39:38 +00:00
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
|
|
|
---@param config Config
|
|
|
|
---@return ColorScheme
|
|
|
|
function M.setup(config)
|
|
|
|
config = config or require("tokyonight.config")
|
|
|
|
|
|
|
|
-- Color Palette
|
|
|
|
---@class ColorScheme
|
2021-04-20 23:04:52 +00:00
|
|
|
local colors = {}
|
|
|
|
|
2021-04-24 20:24:40 +00:00
|
|
|
colors = {
|
|
|
|
none = "NONE",
|
|
|
|
bg_dark = "#1f2335",
|
|
|
|
bg = "#24283b",
|
|
|
|
bg_highlight = "#292e42",
|
|
|
|
terminal_black = "#414868",
|
|
|
|
fg = "#c0caf5",
|
|
|
|
fg_dark = "#a9b1d6",
|
|
|
|
fg_gutter = "#3b4261",
|
|
|
|
dark3 = "#545c7e",
|
|
|
|
comment = "#565f89",
|
|
|
|
dark5 = "#737aa2",
|
|
|
|
blue0 = "#3d59a1",
|
|
|
|
blue = "#7aa2f7",
|
|
|
|
cyan = "#7dcfff",
|
|
|
|
blue1 = "#2ac3de",
|
|
|
|
blue2 = "#0db9d7",
|
|
|
|
blue5 = "#89ddff",
|
|
|
|
blue6 = "#B4F9F8",
|
2021-05-02 07:40:40 +00:00
|
|
|
blue7 = "#394b70",
|
2021-04-24 20:24:40 +00:00
|
|
|
magenta = "#bb9af7",
|
|
|
|
purple = "#9d7cd8",
|
|
|
|
orange = "#ff9e64",
|
|
|
|
yellow = "#e0af68",
|
|
|
|
green = "#9ece6a",
|
|
|
|
green1 = "#73daca",
|
2021-05-02 07:40:40 +00:00
|
|
|
green2 = "#41a6b5",
|
2021-04-24 20:24:40 +00:00
|
|
|
teal = "#1abc9c",
|
|
|
|
red = "#f7768e",
|
|
|
|
red1 = "#db4b4b",
|
2021-05-02 08:13:28 +00:00
|
|
|
git = { change = "#6183bb", add = "#449dab", delete = "#914c54", conflict = "#bb7a61" },
|
2021-05-14 21:23:14 +00:00
|
|
|
gitSigns = { add = "#164846", change = "#394b70", delete = "#823c41" },
|
2021-04-24 20:24:40 +00:00
|
|
|
}
|
2021-05-02 08:43:18 +00:00
|
|
|
if config.style == "night" or config.style == "day" or vim.o.background == "light" then
|
|
|
|
colors.bg = "#1a1b26"
|
|
|
|
end
|
2021-05-02 07:40:40 +00:00
|
|
|
util.bg = colors.bg
|
2021-05-19 06:49:33 +00:00
|
|
|
util.day_brightness = config.dayBrightness
|
2021-05-02 07:40:40 +00:00
|
|
|
|
|
|
|
colors.diff = {
|
2021-05-12 09:19:28 +00:00
|
|
|
add = util.darken(colors.green2, 0.15),
|
|
|
|
delete = util.darken(colors.red1, 0.15),
|
|
|
|
change = util.darken(colors.blue7, 0.15),
|
2021-05-02 07:40:40 +00:00
|
|
|
text = colors.blue7,
|
|
|
|
}
|
2021-04-20 11:39:38 +00:00
|
|
|
|
2021-04-25 09:42:59 +00:00
|
|
|
colors.gitSigns = {
|
2021-05-14 21:23:14 +00:00
|
|
|
add = util.brighten(colors.gitSigns.add, 0.2),
|
|
|
|
change = util.brighten(colors.gitSigns.change, 0.2),
|
|
|
|
delete = util.brighten(colors.gitSigns.delete, 0.2),
|
2021-04-25 09:42:59 +00:00
|
|
|
}
|
|
|
|
|
2021-04-20 11:39:38 +00:00
|
|
|
colors.git.ignore = colors.dark3
|
|
|
|
colors.black = util.darken(colors.bg, 0.8, "#000000")
|
|
|
|
colors.border_highlight = colors.blue0
|
|
|
|
colors.border = colors.black
|
|
|
|
|
2021-04-20 20:43:54 +00:00
|
|
|
-- Popups and statusline always get a dark background
|
2021-04-20 11:39:38 +00:00
|
|
|
colors.bg_popup = colors.bg_dark
|
|
|
|
colors.bg_statusline = colors.bg_dark
|
2021-04-20 20:43:54 +00:00
|
|
|
|
|
|
|
-- Sidebar and Floats are configurable
|
2021-04-26 05:24:01 +00:00
|
|
|
colors.bg_sidebar = config.darkSidebar and colors.bg_dark or colors.bg
|
2021-04-20 20:43:54 +00:00
|
|
|
colors.bg_float = config.darkFloat and colors.bg_dark or colors.bg
|
|
|
|
|
2021-04-20 11:39:38 +00:00
|
|
|
colors.bg_visual = util.darken(colors.blue0, 0.7)
|
|
|
|
colors.bg_search = colors.blue0
|
|
|
|
colors.fg_sidebar = colors.fg_dark
|
|
|
|
|
|
|
|
colors.error = colors.red1
|
|
|
|
colors.warning = colors.yellow
|
2021-04-21 23:05:54 +00:00
|
|
|
colors.info = colors.blue2
|
|
|
|
colors.hint = colors.teal
|
2021-04-23 18:21:12 +00:00
|
|
|
|
|
|
|
util.color_overrides(colors, config)
|
2021-04-24 20:24:40 +00:00
|
|
|
|
2021-05-02 08:43:18 +00:00
|
|
|
if config.transform_colors and (config.style == "day" or vim.o.background == "light") then
|
|
|
|
return util.light_colors(colors)
|
|
|
|
end
|
|
|
|
|
2021-04-20 11:39:38 +00:00
|
|
|
return colors
|
|
|
|
end
|
|
|
|
|
|
|
|
return M
|