From e0ce4a3068cba9a46f801af61d3df23e5827e949 Mon Sep 17 00:00:00 2001 From: Michael Chris Lopez Date: Mon, 13 Sep 2021 16:31:09 +0800 Subject: [PATCH] separate file for palette and terminal --- colors/zenflesh-lush.lua | 2 +- lua/zenflesh/init.lua | 25 +++++++------------------ lua/zenflesh/palette.lua | 13 +++++++++++++ lua/zenflesh/terminal.lua | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 19 deletions(-) create mode 100644 lua/zenflesh/palette.lua create mode 100644 lua/zenflesh/terminal.lua diff --git a/colors/zenflesh-lush.lua b/colors/zenflesh-lush.lua index 0064e9b..d028b31 100644 --- a/colors/zenflesh-lush.lua +++ b/colors/zenflesh-lush.lua @@ -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. diff --git a/lua/zenflesh/init.lua b/lua/zenflesh/init.lua index 6583afd..2a4b469 100644 --- a/lua/zenflesh/init.lua +++ b/lua/zenflesh/init.lua @@ -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 diff --git a/lua/zenflesh/palette.lua b/lua/zenflesh/palette.lua new file mode 100644 index 0000000..936072d --- /dev/null +++ b/lua/zenflesh/palette.lua @@ -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), +} diff --git a/lua/zenflesh/terminal.lua b/lua/zenflesh/terminal.lua new file mode 100644 index 0000000..40eb469 --- /dev/null +++ b/lua/zenflesh/terminal.lua @@ -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