   end
 
   @doc "Sets foreground color."
-  @spec color(0..255) :: String.t
+  @spec color(0..255) :: String.t()
   def color(code) when code in 0..255, do: "\e[38;5;#{code}m"
 
   @doc ~S"""


  Valid values for each color are in the range 0 to 5.
  """
  @spec color_background(0..5, 0..5, 0..5) :: String.t
  def color_background(r, g, b) when r in 0..5 and g in 0..5 and b in 0..5 do
    color_background(16 + (36 * r) + (6 * g) + b)
  end

  @doc "Resets all attributes."
  defsequence :reset, 0

  @doc "Bright (increased intensity) or bold."
  defsequence :bright, 1

  @doc "Faint (decreased intensity). Not widely supported."
  defsequence :faint, 2

  @doc "Italic: on. Not widely supported. Sometimes treated as inverse."
  defsequence :italic, 3

  @doc "Underline: single."
  defsequence :underline, 4

  @doc "Blink: slow. Less than 150 per minute."
  defsequence :blink_slow, 5

  @doc "Blink: rapid. MS-DOS ANSI.SYS; 150 per minute or more; not widely supported."
  defsequence :blink_rapid, 6

  @doc "Image: negative. Swap foreground and background."
  defsequence :inverse, 7

  @doc "Image: negative. Swap foreground and background."
  defsequence :reverse, 7

  @doc "Conceal. Not widely supported."
  defsequence :conceal, 8

  @doc "Crossed-out. Characters legible, but marked for deletion. Not widely supported."
  defsequence :crossed_out, 9

  @doc "Sets primary (default) font."
  defsequence :primary_font, 10

  for font_n <- [1, 2, 3, 4, 5, 6, 7, 8, 9] do
    @doc "Sets alternative font #{font_n}."
    defsequence :"font_#{font_n}", font_n + 10
  end

  @doc "Normal color or intensity."
  defsequence :normal, 22

  @doc "Not italic."
  defsequence :not_italic, 23

  @doc "Underline: none."
  defsequence :no_underline, 24

  @doc "Blink: off."
  defsequence :blink_off, 25

  @doc "Image: positive. Normal foreground and background."
  defsequence :inverse_off, 27

  @doc "Image: positive. Normal foreground and background."
  defsequence :reverse_off, 27

  colors = [:black, :red, :green, :yellow, :blue, :magenta, :cyan, :white]

  for {color, code} <- Enum.with_index(colors) do
    @doc "Sets foreground color to #{color}."
    defsequence color, code + 30

    @doc "Sets foreground color to light #{color}."
    defsequence :"light_#{color}", code + 90

    @doc "Sets background color to #{color}."
    defsequence :"#{color}_background", code + 40

    @doc "Sets background color to light #{color}."
    defsequence :"light_#{color}_background", code + 100
  end

  @doc "Default text color."
  defsequence :default_color, 39

  @doc "Default background color."
  defsequence :default_background, 49

  @doc "Framed."
  defsequence :framed, 51

  @doc "Encircled."
  defsequence :encircled, 52

  @doc "Overlined."
  defsequence :overlined, 53

  @doc "Not framed or encircled."
  defsequence :not_framed_encircled, 54

  @doc "Not overlined."
  defsequence :not_overlined, 55

  @doc "Sends cursor home."
  defsequence :home, "", "H"

  @doc "Clears screen."
  defsequence :clear, "2", "J"

  @doc "Clears line."
  defsequence :clear_line, "2", "K"

  defp format_sequence(other) do
    raise ArgumentError, "invalid ANSI sequence specification: #{inspect other}"
  end

  @doc ~S"""

  end

  defp do_format([], [], acc, true, true) do
    [acc | IO.ANSI.reset()]
  end

  defp do_format([], [], acc, _emit?, _append_reset) do
