separate file for palette and terminal

This commit is contained in:
Michael Chris Lopez
2021-09-13 16:31:09 +08:00
parent b9caa4189f
commit e0ce4a3068
4 changed files with 54 additions and 19 deletions

View File

@@ -1,7 +1,7 @@
vim.opt.background = "light"
vim.g.colors_name = "zenflesh-lush"
require("zenbones.terminal").setup()
require("zenflesh.terminal").setup()
-- By setting our module to nil, we clear lua's cache,
-- which means the require ahead will *always* occur.

View File

@@ -1,16 +1,5 @@
local lush = require "lush"
local hsluv = lush.hsluv
local c = {
sand = hsluv(39, 8, 10),
stone = hsluv(230, 7, 75),
leaf = hsluv(103, 65, 54),
water = hsluv(236, 80, 53),
rose = hsluv(4, 40, 53),
wood = hsluv(26, 58, 54),
blossom = hsluv(318, 34, 56),
sky = hsluv(204, 76, 58),
}
local c = require "zenflesh.palette"
local normal_bg = c.sand
local diff_bg_l = 0
@@ -20,7 +9,7 @@ if darkness == "stark" then
normal_bg = normal_bg.abs_da(3)
diff_bg_l = -3
elseif darkness == "warm" then
normal_bg = normal_bg.abs_li(3)
normal_bg = normal_bg.abs_li(3).de(16)
diff_bg_l = 3
elseif darkness ~= nil then
local error_msg = "Unknown zenflesh_darkness value: " .. vim.inspect(darkness)
@@ -56,7 +45,7 @@ local theme = lush(function()
Conceal { fg = c.stone.da(20), gui = "bold,italic" }, -- placeholder characters substituted for concealed text (see 'conceallevel')
Cursor { bg = c.stone.li(20), fg = c.sand.da(20) }, -- character under the cursor
lCursor { Cursor, bg = Cursor.bg.da(20) }, -- the character under the cursor when |language-mapping| is used (see 'guicursor')
lCursor { Cursor, bg = Cursor.bg.da(35) }, -- the character under the cursor when |language-mapping| is used (see 'guicursor')
-- CursorIM { }, -- like Cursor, but used when in IME mode |CursorIM|
TermCursor { Cursor }, -- cursor in a focused terminal
TermCursorNC { lCursor }, -- cursor in an unfocused terminal
@@ -65,10 +54,10 @@ local theme = lush(function()
CursorColumn { CursorLine }, -- Screen-column at the cursor, when 'cursorcolumn' is set.
ColorColumn { bg = c.wood.de(40).da(28) }, -- used for the columns set with 'colorcolumn'
DiffAdd { bg = c.leaf.de(10).da(38).abs_da(diff_bg_l) }, -- diff mode: Added line |diff.txt|
DiffChange { bg = c.water.de(14).da(41).abs_da(diff_bg_l) }, -- diff mode: Changed line |diff.txt|
DiffDelete { bg = c.rose.de(19).da(44).abs_da(diff_bg_l) }, -- diff mode: Deleted line |diff.txt|
DiffText { bg = c.water.de(20).da(18).abs_da(diff_bg_l), fg = c.stone }, -- diff mode: Changed text within a changed line |diff.txt|
DiffAdd { bg = c.leaf.de(18).da(38).abs_da(diff_bg_l) }, -- diff mode: Added line |diff.txt|
DiffChange { bg = c.water.de(22).da(41).abs_da(diff_bg_l) }, -- diff mode: Changed line |diff.txt|
DiffDelete { bg = c.rose.de(27).da(44).abs_da(diff_bg_l) }, -- diff mode: Deleted line |diff.txt|
DiffText { bg = c.water.de(28).da(18).abs_da(diff_bg_l), fg = c.stone }, -- diff mode: Changed text within a changed line |diff.txt|
LineNr { fg = Normal.bg.li(28) }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set.
SignColumn { LineNr }, -- column where |signs| are displayed

13
lua/zenflesh/palette.lua Normal file
View File

@@ -0,0 +1,13 @@
local lush = require "lush"
local hsluv = lush.hsluv
return {
sand = hsluv(39, 10, 10),
stone = hsluv(230, 7, 75),
leaf = hsluv(103, 65, 54),
water = hsluv(236, 80, 53),
rose = hsluv(4, 40, 53),
wood = hsluv(26, 58, 54),
blossom = hsluv(318, 34, 56),
sky = hsluv(204, 76, 58),
}

33
lua/zenflesh/terminal.lua Normal file
View File

@@ -0,0 +1,33 @@
local lush = require "lush"
local c = require "zenflesh.palette"
local colors = {
c.stone,
c.rose,
c.leaf,
c.wood,
c.water,
c.blossom,
c.sky,
c.sand,
c.stone.da(16),
c.rose.sa(20).li(10),
c.leaf.sa(20).li(10),
c.wood.sa(18).li(10),
c.water.sa(20).li(10),
c.blossom.sa(24).li(10),
c.sky.sa(20).li(10),
c.sand.sa(4).li(10),
}
local M = {}
M.colors = colors
function M.setup()
for i, v in ipairs(colors) do
vim.g["terminal_color_" .. (i - 1)] = v.hex
end
end
return M