From b485e1c8fb748f407f38096892ab2bb77b8c9a40 Mon Sep 17 00:00:00 2001 From: Matt Leong Date: Mon, 22 Nov 2021 13:58:09 -0800 Subject: [PATCH] feat(themes): add onedark --- lua/cosmic/config/examples/config.lua | 3 ++- lua/cosmic/core/theme/integrated/onedark.lua | 24 +++++++++++++++++++ .../core/theme/integrated/rose-pine.lua | 17 +------------ lua/cosmic/core/theme/plugins.lua | 15 +++++++++--- lua/cosmic/utils.lua | 5 ++-- readme.md | 1 + 6 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 lua/cosmic/core/theme/integrated/onedark.lua diff --git a/lua/cosmic/config/examples/config.lua b/lua/cosmic/config/examples/config.lua index 6627f6b..f8cb854 100644 --- a/lua/cosmic/config/examples/config.lua +++ b/lua/cosmic/config/examples/config.lua @@ -20,9 +20,10 @@ config.treesitter = {} -- theming, don't forget to run :PackerSync and reload CosmicNvim when chaning themes -- 'catppuccin' -- 'gruvbox' +-- 'nightfox' -- 'nord' +-- 'onedark' -- 'rose-pine' --- nightfox config.theme = 'tokyonight' -- don't define or set to nil, if you want to enable your own theme in cosmic/config/plugins.lua -- lsp settings diff --git a/lua/cosmic/core/theme/integrated/onedark.lua b/lua/cosmic/core/theme/integrated/onedark.lua new file mode 100644 index 0000000..07d92ee --- /dev/null +++ b/lua/cosmic/core/theme/integrated/onedark.lua @@ -0,0 +1,24 @@ +local theme = require('onedark.colors') + +local colors = { + white = theme.fg, + bg = theme.bg3, + bg_highlight = theme.bg3, + statusline_bg = theme.bg0, + normal = theme.green, + insert = theme.cyan, + command = theme.orange, + visual = theme.purple, + replace = theme.red, + diffAdd = theme.green, + diffModified = theme.orang, + diffDeleted = theme.red, + trace = theme.orange, + hint = theme.cyan, + info = theme.green, + error = theme.red, + warn = theme.orange, + floatBorder = theme.bg3, + selection_caret = theme.purple, +} +return colors diff --git a/lua/cosmic/core/theme/integrated/rose-pine.lua b/lua/cosmic/core/theme/integrated/rose-pine.lua index 48ff887..290a476 100644 --- a/lua/cosmic/core/theme/integrated/rose-pine.lua +++ b/lua/cosmic/core/theme/integrated/rose-pine.lua @@ -1,20 +1,5 @@ local theme = require('rose-pine.palette') ---[[ base = '#191724', - surface = '#1f1d2e', - overlay = '#26233a', - inactive = '#555169', - subtle = '#6e6a86', - text = '#e0def4', - love = '#eb6f92', - gold = '#f6c177', - rose = '#ebbcba', - pine = '#31748f', - foam = '#9ccfd8', - iris = '#c4a7e7', - highlight = '#2a2837', - highlight_inactive = '#211f2d', - highlight_overlay = '#3a384a', - none = 'NONE', ]] + local colors = { white = theme.text, bg = theme.surface, diff --git a/lua/cosmic/core/theme/plugins.lua b/lua/cosmic/core/theme/plugins.lua index 2d8abf8..7f2dbd8 100644 --- a/lua/cosmic/core/theme/plugins.lua +++ b/lua/cosmic/core/theme/plugins.lua @@ -1,12 +1,13 @@ local M = {} M.supported_themes = { - 'tokyonight', 'catppuccin', 'gruvbox', - 'rose-pine', 'nightfox', 'nord', + 'onedark', + 'rose-pine', + 'tokyonight', } function M.init(use, config) @@ -70,9 +71,17 @@ function M.init(use, config) config = function() vim.cmd('color nightfox') end, - disable = config.theme ~= 'nightfox' + disable = config.theme ~= 'nightfox', }) + use({ + 'navarasu/onedark.nvim', + as = 'onedark', + config = function() + vim.cmd('color onedark') + end, + disable = config.theme ~= 'onedark', + }) end return M diff --git a/lua/cosmic/utils.lua b/lua/cosmic/utils.lua index 98776a7..5e48b71 100644 --- a/lua/cosmic/utils.lua +++ b/lua/cosmic/utils.lua @@ -129,10 +129,11 @@ function M.update() on_exit = function() if vim.tbl_isempty(errors) then vim.notify( - 'Please restart CosmicNvim and run `:PackerSync`', + 'Updated! Running CosmicReloadSync...', vim.log.levels.INFO, - { title = 'CosmicNvim Updated!', timeout = 30000 } + { title = 'CosmicNvim', timeout = 30000 } ) + M.reload_user_config_sync() else table.insert(errors, 1, 'Something went wrong! Please pull changes manually.') table.insert(errors, 2, '') diff --git a/readme.md b/readme.md index cfa6a26..142cbd1 100644 --- a/readme.md +++ b/readme.md @@ -80,6 +80,7 @@ CosmicNvim comes with first-class support for the following themes: - [Nord](https://github.com/shaunsingh/nord.nvim) - [Tokyonight](https://github.com/folke/tokyonight.nvim) - [Nightfox](https://github.com/EdenEast/nightfox.nvim) +- [Onedark](https://github.com/navarasu/onedark.nvim) [Additional Screenshots](https://github.com/mattleong/CosmicNvim/wiki/Theme-Screenshots)