All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
4 Licensed under MIT License
5 * (c) 2013, Luke Bonham
6 * (c) 2009, Uli Schlachter
11 local beautiful = require("beautiful")
12 local tostring = tostring
13 local setmetatable = setmetatable
15 -- Lain markup util submodule
22 --[[ clean this as soon as you document it
27 |`-- italic() Set italicized text.
28 |`-- strike() Set strikethrough text.
29 |`-- underline() Set underlined text.
30 |`-- monospace() Set monospaced text.
31 |`-- big() Set bigger text.
32 |`-- small() Set smaller text.
33 |`-- font() Set the font of the text.
37 | |`-- color() Set background color.
38 | |`-- focus() Set focus background color.
39 | |`-- normal() Set normal background color.
40 | `-- urgent() Set urgent background color.
44 | |`-- color() Set foreground color.
45 | |`-- focus() Set focus foreground color.
46 | |`-- normal() Set normal foreground color.
47 | `-- urgent() Set urgent foreground color.
49 |`-- focus() Set both foreground and background focus colors.
50 |`-- normal() Set both foreground and background normal colors.
51 `-- urgent() Set both foreground and background urgent colors.
56 function markup.bold(text) return '<b>' .. tostring(text) .. '</b>' end
57 function markup.italic(text) return '<i>' .. tostring(text) .. '</i>' end
58 function markup.strike(text) return '<s>' .. tostring(text) .. '</s>' end
59 function markup.underline(text) return '<u>' .. tostring(text) .. '</u>' end
60 function markup.monospace(text) return '<tt>' .. tostring(text) .. '</tt>' end
61 function markup.big(text) return '<big>' .. tostring(text) .. '</big>' end
62 function markup.small(text) return '<small>' .. tostring(text) .. '</small>' end
65 function markup.font(font, text)
66 return '<span font="' .. tostring(font) .. '">' .. tostring(text) ..'</span>'
69 -- Set the foreground.
70 function fg.color(color, text)
71 return '<span foreground="' .. tostring(color) .. '">' .. tostring(text) .. '</span>'
74 -- Set the background.
75 function bg.color(color, text)
76 return '<span background="' .. tostring(color) .. '">' .. tostring(text) .. '</span>'
80 function fg.focus(text) return fg.color(beautiful.fg_focus, text) end
81 function bg.focus(text) return bg.color(beautiful.bg_focus, text) end
82 function markup.focus(text) return bg.focus(fg.focus(text)) end
85 function fg.normal(text) return fg.color(beautiful.fg_normal, text) end
86 function bg.normal(text) return bg.color(beautiful.bg_normal, text) end
87 function markup.normal(text) return bg.normal(fg.normal(text)) end
90 function fg.urgent(text) return fg.color(beautiful.fg_urgent, text) end
91 function bg.urgent(text) return bg.color(beautiful.bg_urgent, text) end
92 function markup.urgent(text) return bg.urgent(fg.urgent(text)) end
97 -- link markup.{fg,bg}(...) calls to markup.{fg,bg}.color(...)
98 setmetatable(markup.fg, { __call = function(_, ...) return markup.fg.color(...) end })
99 setmetatable(markup.bg, { __call = function(_, ...) return markup.bg.color(...) end })
101 -- link markup(...) calls to markup.fg.color(...)
102 return setmetatable(markup, { __call = function(_, ...) return markup.fg.color(...) end })