Extract colours into their own little module

This commit is contained in:
Felipe Sere
2016-04-27 20:57:13 +01:00
parent 527b5ea028
commit b01727f9b8
2 changed files with 21 additions and 21 deletions

13
lib/colours.ex Normal file
View File

@@ -0,0 +1,13 @@
defmodule Colours do
alias IO.ANSI
def red(str), do: colourize(ANSI.red, str)
def cyan(str), do: colourize(ANSI.cyan, str)
def green(str), do: colourize(ANSI.green, str)
defp colourize(color, message) do
Enum.join([color, message, ANSI.reset], "")
end
end