#!/bin/env luajit local themes = {} local current_theme = nil Dsl = {} Dsl.name = function (name) current_theme.name = name end Dsl.author = function (author) current_theme.author = author end Dsl.author_name = function (author_name) current_theme.author_name = author_name end Dsl.author_url = function (author_url) current_theme.author_url = author_url end Dsl.variant = function (variant) current_theme.variant = variant end Dsl.color = function (index) return function (color_code) current_theme.colors[index] = color_code end end Dsl.background = function (color_code) current_theme.background = color_code end Dsl.foreground = function (color_code) current_theme.foreground = color_code end Dsl.cursor = function (cursor) current_theme.cursor = cursor end local theme_listing = io.popen [[ls themes -N1]] for line in theme_listing:lines () do current_theme = { colors = {} } table.insert (themes, current_theme) local script, err = loadfile ("themes/" .. line, "t", Dsl) if not script then return print (err) end script () end local color_swatch = [[
by ]]) :format (theme.author_url)) table.insert (card, theme.author_name) table.insert (card, [[
]]) else table.insert (card, [[by ]]) table.insert (card, theme.author_name) table.insert (card, [[
]]) end end table.insert (card, [[