Skip to content

Commit

Permalink
feat: allow to override default color palettes
Browse files Browse the repository at this point in the history
  • Loading branch information
NTBBloodbath committed Mar 9, 2023
1 parent b5a6ba3 commit 7518ba8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,28 @@ require("sweetie").setup({
enable = true,
transparency_amount = 20,
},
-- Override default sweetie color palettes
-- Palette fields:
-- bg
-- fg
-- bg_hl
-- bg_alt
-- fg_alt
-- grey
-- dark_grey
-- red
-- orange
-- green
-- teal
-- yellow
-- blue
-- magenta
-- violet
-- cyan
palette = {
dark = {},
light = {},
},
-- Override default highlighting groups options
overrides = {},
-- Custom plugins highlighting groups
Expand Down Expand Up @@ -87,7 +109,7 @@ overrides = {
## Roadmap

- [x] Add light theme variant
- [ ] Allow to override default color palette
- [x] Allow to override default color palette
- [ ] Add more extra themes
- [ ] bat
- [x] termux
Expand Down
5 changes: 2 additions & 3 deletions lua/sweetie/colors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
local colors = {}

---@class colors.palette
---@alias colors.palette table
---@field dark table<string, string>
---@field light table<string, string>
colors.palette = {
---@field dark table<string, string>
dark = {
bg = "#2a2a3a",
fg = "#fdfffd",
Expand All @@ -27,7 +27,6 @@ colors.palette = {
violet = "#d8b5ff",
cyan = "#b5e9ff",
},
---@field light table<string, string>
light = {
bg = "#dddde7",
fg = "#202023",
Expand Down
4 changes: 4 additions & 0 deletions lua/sweetie/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ local config = {
enable = true,
transparency_amount = 20,
},
palette = {
dark = {},
light = {},
},
overrides = {},
integrations = {
lazy = true,
Expand Down
3 changes: 2 additions & 1 deletion lua/sweetie/highlights/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ local highlights = {}
---@param config table Sweetie configuration
highlights.setup = function(config)
local current_bg = vim.opt.background:get()
local palette = require("sweetie.colors").get_palette(current_bg)
local palettes = vim.tbl_deep_extend("force", require("sweetie.colors").palette, config.palette)
local palette = palettes[current_bg]

--- Highlighting groups
local groups = {
Expand Down

0 comments on commit 7518ba8

Please sign in to comment.