This commit is contained in:
Cat /dev/Nulo 2022-04-10 16:24:18 -03:00
commit 53b2f5caad
6 changed files with 135 additions and 0 deletions

59
modules/foot.lua Normal file
View file

@ -0,0 +1,59 @@
local scheme = [[
[colors]
foreground={foreground}
background={background}
regular0={background} # black (or white in a bright theme)
regular1=7f1010 # red
regular2=009A57 # green
regular3=813e00 # yellow
regular4=0186C7 # blue
regular5=721045 # magenta
regular6=00538b # cyan
regular7={background} # white (or black in a bright theme)
bright0=e4e4e4
bright1=ff8686
bright2=bcd2aa
bright3=989838
bright4=00AEFF
bright5=8888CC
bright6=4FA8A8
bright7={foreground}
]]
if theme.kind == "rose-pine" then
scheme = [[
[cursor]
color = {inactive} {text}
[colors]
background = {base}
foreground = {text}
selection-foreground = {text}
selection-background = {highlight}
urls = {iris}
regular0 = {overlay}
regular1 = {love}
regular2 = {pine}
regular3 = {gold}
regular4 = {foam}
regular5 = {iris}
regular6 = {rose}
regular7 = {text}
bright0 = {subtle}
bright1 = {love}
bright2 = {pine}
bright3 = {gold}
bright4 = {foam}
bright5 = {iris}
bright6 = {rose}
bright7 = {text}
]]
end
save_config("foot", scheme, theme)

8
modules/sway.lua Normal file
View file

@ -0,0 +1,8 @@
save_config("sway-colors", [[
set $background #{background}
set $backgroundish #{backgroundish}
set $foreground #{foreground}
set $foregroundish #{foregroundish}
set $accent #{accent}
set $accentish #{accentish}
]], theme)

26
themer.lua Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env lua5.1
local templater = require 'utils/template'
theme = require 'themes/rose-pine-dawn'
local status = os.execute("mkdir -p ~/.cache/themer.lua/")
if not (status == 0) then return status end
function expect_nil(result)
if result then
print("Error: "..result)
os.exit(1)
end
return nil
end
function save_config(name, template, params)
local file, err = io.open("/home/diablo/.cache/themer.lua/"..name, "w+")
if not file then expect_nil(err) end
file:write(templater(template, params))
file:close()
end
require 'modules/sway'
require 'modules/foot'

19
themes/rose-pine-dawn.lua Normal file
View file

@ -0,0 +1,19 @@
local theme = {
base = "faf4ed",
surface = "fffaf3",
overlay = "f2e9de",
inactive = "9893a5",
subtle = "6e6a86",
text = "575279",
love = "b4637a",
gold = "ea9d34",
rose = "d7827e",
pine = "286983",
foam = "56949f",
iris = "907aa9",
highlight = "eee9e6",
highlightInactive = "f2ede9",
highlightOverlay = "e4dfde",
dark = false,
}
return require('utils/rose-pine-convert')(theme)

View file

@ -0,0 +1,14 @@
return function (theme)
local new = {
background = theme.base,
backgroundish = theme.overlay,
foreground = theme.text,
foregroundish = theme.subtle,
accent = theme.love,
accentish = theme.rose,
kind = "rose-pine",
}
for k,v in pairs(theme) do new[k] = v end
return new
end

9
utils/template.lua Normal file
View file

@ -0,0 +1,9 @@
return function (template, params)
local content = string.gsub(template, "{(%w+)}", function (s)
if params[s] == nil then
expect_nil("No variable "..s)
end
return params[s]
end)
return content
end