Skip to content

Commit

Permalink
feat: light theme
Browse files Browse the repository at this point in the history
  • Loading branch information
willruggiano committed Jul 14, 2023
1 parent 48857b7 commit 0b2f537
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 13 deletions.
1 change: 1 addition & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tasks:
- i
run:
cmds:
- task: build
- nix run
aliases:
- r
5 changes: 5 additions & 0 deletions plugins/bombadil.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
return function()
vim.opt.background = (function()
local t = os.date "*t"
-- Use light theme between 8am and 8pm, light theme otherwise
return t.hour < 8 or t.hour > 20 and "dark" or "light"
end)()
vim.cmd.colorscheme "flavours"
end
25 changes: 18 additions & 7 deletions plugins/bombadil/lua/flavours.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
local M = {}

local function hi(higroup, val)
vim.api.nvim_set_hl(0, higroup, val)
end

local function link(higroup, link_to)
hi(higroup, { link = link_to })
end

function M.setup()
vim.opt.termguicolors = true

local palette = require "flavours.palette"
local palette = M.palette()

for key, value in pairs(palette) do
hi(key .. "_fg", { fg = value, nocombine = true })
hi(key .. "_bg", { bg = value, nocombine = true })
end

for _, what in ipairs { "vim", "syntax", "diagnostics", "lsp" } do
require("flavours." .. what).setup(palette)
end
end

local function hi(higroup, val)
vim.api.nvim_set_hl(0, higroup, val)
end

local function link(higroup, link_to)
hi(higroup, { link = link_to })
function M.palette()
local mode = vim.opt.background:get() or "dark"
return require("flavours.palette")[mode]
end

M.highlight = setmetatable({}, {
Expand Down
26 changes: 24 additions & 2 deletions plugins/bombadil/lua/flavours/palette.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local colors = {
local dark = {
base00 = "#2d2d2d",
base01 = "#393939",
base02 = "#515151",
Expand All @@ -17,4 +17,26 @@ local colors = {
base0F = "#a3685a",
}

return colors
local light = {
base00 = "#ffffff",
base01 = "#e0e0e0",
base02 = "#d6d6d6",
base03 = "#8e908c",
base04 = "#969896",
base05 = "#4d4d4c",
base06 = "#282a2e",
base07 = "#1d1f21",
base08 = "#c82829",
base09 = "#f5871f",
base0A = "#eab700",
base0B = "#718c00",
base0C = "#3e999f",
base0D = "#4271ae",
base0E = "#8959a8",
base0F = "#a3685a",
}

return {
dark = dark,
light = light,
}
1 change: 1 addition & 0 deletions plugins/bombadil/lua/flavours/syntax.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local M = {}

function M.setup(palette)
-- See: |group-name|
hi.Comment = { fg = palette.base04, italic = true }
hi.Constant = { fg = palette.base09 }
hi.String = { fg = palette.base0B }
-- hi.Character = "Constant"
Expand Down
5 changes: 2 additions & 3 deletions plugins/indent-blankline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ return function()
}

local hi = require("flavours").highlight
local palette = require "flavours.palette"

hi.IndentBlanklineChar = { fg = palette.base02, nocombine = true }
hi.IndentBlanklineContextChar = { fg = palette.base04, nocombine = true }
hi.IndentBlanklineChar = "base02_fg"
hi.IndentBlanklineContextChar = "base04_fg"
end
2 changes: 1 addition & 1 deletion plugins/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ return function()
},
}

local palette = require "flavours.palette"
local palette = require("flavours").palette()
local theme = {
normal = {
a = { fg = palette.base01, bg = palette.base0D },
Expand Down

0 comments on commit 0b2f537

Please sign in to comment.