diff --git a/lib/fmt.lua b/lib/fmt.lua
new file mode 100644
index 0000000..c604cff
--- /dev/null
+++ b/lib/fmt.lua
@@ -0,0 +1,59 @@
+local md_colors = require "md_colors"
+local fmt = {}
+
+function fmt.bold(str)
+ return ""..str..""
+end
+
+function fmt.italic(str)
+ return ""..str..""
+end
+
+function fmt.underline(str)
+ return ""..str..""
+end
+
+function fmt.primary(str)
+ return fmt.colored(str, ui:get_colors().primary_text)
+end
+
+function fmt.secondary(str)
+ return fmt.colored(str, ui:get_colors().secondary_text)
+end
+
+function fmt.colored(str, color)
+ return ""..str..""
+end
+
+function fmt.bg_colored(str, color)
+ return ""..str..""
+end
+
+function fmt.red(str)
+ return fmt.colored(str, md_colors.red_500)
+end
+
+function fmt.green(str)
+ return fmt.colored(str, md_colors.green_500)
+end
+
+function fmt.blue(str)
+ return fmt.colored(str, md_colors.blue_500)
+end
+
+function fmt.space(str)
+ return " "
+end
+
+function fmt.escape(str)
+ return (string.gsub(str, "[}{\">/<'&]", {
+ ["&"] = "&",
+ ["<"] = "<",
+ [">"] = ">",
+ ['"'] = """,
+ ["'"] = "'",
+ ["/"] = "/"
+ }))
+end
+
+return fmt
diff --git a/samples/fmt-test.lua b/samples/fmt-test.lua
new file mode 100644
index 0000000..8bf5093
--- /dev/null
+++ b/samples/fmt-test.lua
@@ -0,0 +1,18 @@
+local fmt = require "fmt"
+
+function on_resume()
+ ui:show_lines{
+ fmt.bold("bold"),
+ fmt.italic("italic"),
+ fmt.underline("underline"),
+ fmt.primary("primary"),
+ fmt.secondary("secondary"),
+ fmt.red("red"),
+ fmt.green("green"),
+ fmt.blue("blue"),
+ fmt.colored("lime", "#00FF00"),
+ fmt.bg_colored(fmt.colored("lime background", "#000000"), "#00FF00"),
+ fmt.space().."start with space",
+ fmt.escape("not parsed"),
+ }
+end