View Source Owl.Palette (Owl v0.12.0)
Poor man's color picker.
Summary
Functions
@spec codes() :: Owl.Data.t()
Returns palette with codes from 0 to 255.
Owl.Palette.codes() |> Owl.IO.puts()
Selected color can be used as follows
# print "test" using foreground color with code 161
"test" |> Owl.Data.tag(IO.ANSI.color(161)) |> Owl.IO.puts
# print "test" using background color with code 161
"test" |> Owl.Data.tag(IO.ANSI.color_background(161)) |> Owl.IO.puts
@spec named() :: Owl.Data.t()
Returns palette with named codes.
Owl.Palette.named() |> Owl.IO.puts()
Selected color can be used as follows:
# print "test" using cyan foreground color
"test" |> Owl.Data.tag(:cyan) |> Owl.IO.puts
# print "test" using light_green foreground color
"test" |> Owl.Data.tag(:light_green) |> Owl.IO.puts
# print "test" using light_green background color
"test" |> Owl.Data.tag(:light_green_background) |> Owl.IO.puts
# print "test" using a faint cyan foreground color
"test" |> Owl.Data.tag([:faint, :cyan]) |> Owl.IO.puts
Note that :faint
is not supported in all terminals.
@spec rgb() :: Owl.Data.t()
Returns palette with individual RGB values.
Owl.Palette.rgb() |> Owl.IO.puts()
Selected color can be used as follows
# print "test" using foreground color RGB(4, 3, 2)
"test" |> Owl.Data.tag(IO.ANSI.color(4, 3, 2)) |> Owl.IO.puts
# print "test" using background color RGB(4, 3, 2)
"test" |> Owl.Data.tag(IO.ANSI.color_background(4, 3, 2)) |> Owl.IO.puts