diff --git a/lua/tokyonight/colors.lua b/lua/tokyonight/colors.lua index d09338d..0a7c8f2 100644 --- a/lua/tokyonight/colors.lua +++ b/lua/tokyonight/colors.lua @@ -8,6 +8,7 @@ local colors = { bg_dark = "#1f2335", bg = "#24283b", bg_highlight = "#292e42", + terminal_black = "#414868", fg = "#c0caf5", fg_dark = "#a9b1d6", fg_gutter = "#3b4261", @@ -24,8 +25,8 @@ local colors = { purple = "#9d7cd8", orange = "#ff9e64", yellow = "#e0af68", - green3 = "#9ece6a", - green = "#73daca", + green = "#9ece6a", + green1 = "#73daca", teal = "#1abc9c", red = "#f7768e", red1 = "#db4b4b", @@ -35,7 +36,7 @@ local colors = { if config.style == "night" then colors.bg = "#1a1b26" end util.bg = colors.bg colors.git.ignore = colors.dark3 -colors.black = util.darken(colors.bg, 0.7, "#000000") +colors.black = util.darken(colors.bg, 0.8, "#000000") colors.border_highlight = colors.blue0 colors.border = colors.black diff --git a/lua/tokyonight/config.lua b/lua/tokyonight/config.lua index f09de02..7ec6e5d 100644 --- a/lua/tokyonight/config.lua +++ b/lua/tokyonight/config.lua @@ -15,6 +15,7 @@ config = { keywordStyle = opt("italic_keywords", true) and "italic" or "NONE", functionStyle = opt("italic_functions", false) and "italic" or "NONE", hideInactiveStatusline = opt("hide_inactive_statusline", false), + terminalColors = opt("terminal_colors", true), } return config diff --git a/lua/tokyonight/theme.lua b/lua/tokyonight/theme.lua index d003a5d..e54caa7 100644 --- a/lua/tokyonight/theme.lua +++ b/lua/tokyonight/theme.lua @@ -4,6 +4,7 @@ local c = require("tokyonight.colors") ---@class Theme local theme = {} +theme.config = config theme.colors = c theme.base = { @@ -75,8 +76,8 @@ theme.base = { -- Uncomment and edit if you want more specific syntax highlighting. Constant = { fg = c.orange }, -- (preferred) any constant - String = { fg = c.green3 }, -- a string constant: "this is a string" - Character = { fg = c.green3 }, -- a character constant: 'c', '\n' + String = { fg = c.green }, -- a string constant: "this is a string" + Character = { fg = c.green }, -- a character constant: 'c', '\n' -- Number = { }, -- a number constant: 234, 0xff -- Boolean = { }, -- a boolean constant: TRUE, false -- Float = { }, -- a floating point constant: 2.3e10 @@ -183,7 +184,7 @@ theme.plugins = { -- TSConstMacro = { }; -- For constants that are defined by macros: `NULL` in C. -- TSError = { }; -- For syntax/parser errors. -- TSException = { }; -- For exception related keywords. - TSField = { fg = c.green }, -- For fields. + TSField = { fg = c.green1 }, -- For fields. -- TSFloat = { }; -- For floats. -- TSFunction = { }; -- For function (calls and definitions). -- TSFuncBuiltin = { }; -- For builtin functions: `table.insert` in Lua. @@ -199,7 +200,7 @@ theme.plugins = { TSOperator = { fg = c.blue5 }, -- For any operator: `+`, but also `->` and `*` in C. TSParameter = { fg = c.yellow }, -- For parameters of a function. -- TSParameterReference= { }; -- For references to parameters of a function. - TSProperty = { fg = c.green }, -- Same as `TSField`. + TSProperty = { fg = c.green1 }, -- Same as `TSField`. TSPunctDelimiter = { fg = c.blue5 }, -- For delimiters ie: `.` TSPunctBracket = { fg = c.fg_dark }, -- For brackets and parens. TSPunctSpecial = { fg = c.blue5 }, -- For special punctutation that does not fall in the catagories before. @@ -270,7 +271,7 @@ theme.plugins = { -- NeoVim healthError = { fg = c.error }, - healthSuccess = { fg = c.green }, + healthSuccess = { fg = c.green1 }, healthWarning = { fg = c.warning }, -- BufferLine diff --git a/lua/tokyonight/util.lua b/lua/tokyonight/util.lua index c531cd8..e641be9 100644 --- a/lua/tokyonight/util.lua +++ b/lua/tokyonight/util.lua @@ -16,7 +16,10 @@ local function hexToRgb(hex_str) return { tonumber(r, 16), tonumber(g, 16), tonumber(b, 16) } end -local function blend(fg, bg, alpha) +---@param fg string foreground color +---@param bg string background color +---@param alpha number number between 0 and 1. 0 results in bg, 1 results in fg +function util.blend(fg, bg, alpha) bg = hexToRgb(bg) fg = hexToRgb(fg) @@ -60,22 +63,32 @@ function util.syntax(syntax) for group, colors in pairs(syntax) do util.highligh ---@param colors ColorScheme function util.terminal(colors) - vim.g.terminal_color_0 = colors.bg - vim.g.terminal_color_1 = colors.red - vim.g.terminal_color_2 = colors.green - vim.g.terminal_color_3 = colors.orange - vim.g.terminal_color_4 = colors.blue - vim.g.terminal_color_5 = colors.magenta - vim.g.terminal_color_6 = colors.cyan - vim.g.terminal_color_7 = colors.dark5 - vim.g.terminal_color_8 = colors.fg_gutter - vim.g.terminal_color_9 = colors.red - vim.g.terminal_color_10 = colors.green - vim.g.terminal_color_11 = colors.orange - vim.g.terminal_color_12 = colors.blue - vim.g.terminal_color_13 = colors.magenta - vim.g.terminal_color_14 = colors.cyan + -- dark + vim.g.terminal_color_0 = colors.terminal_black + vim.g.terminal_color_8 = colors.terminal_black + + -- light + vim.g.terminal_color_7 = colors.fg_dark vim.g.terminal_color_15 = colors.fg + + -- colors + vim.g.terminal_color_1 = colors.red + vim.g.terminal_color_9 = colors.red + + vim.g.terminal_color_2 = colors.green + vim.g.terminal_color_10 = colors.green + + vim.g.terminal_color_3 = colors.yellow + vim.g.terminal_color_11 = colors.yellow + + vim.g.terminal_color_4 = colors.blue + vim.g.terminal_color_12 = colors.blue + + vim.g.terminal_color_5 = colors.magenta + vim.g.terminal_color_13 = colors.magenta + + vim.g.terminal_color_6 = colors.cyan + vim.g.terminal_color_14 = colors.cyan end ---@param theme Theme @@ -92,7 +105,7 @@ function util.load(theme) -- load syntax for plugins and terminal async local async async = vim.loop.new_async(vim.schedule_wrap(function() - -- util.terminal(theme.colors) + util.terminal(theme.colors) util.syntax(theme.plugins) async:close() end))