Wrapping your IO.inspect
and IO.puts
in vibrant colors since 2018.
No external dependencies.
Add {:io_color, "~> 0.2.0"}
to your dependencies.
def deps do
[
{:io_color, "~> 0.2.0"}
]
end
list = [
%{"name" => "Vincent", age: 18},
%{"name" => "Teemo", age: 21},
%{"name" => "Clara", age: 23}
]
IOC.inspect(list, "Optional Label")
What it looks like:
What your current IO.inspect looks like:
All of these will work, choose whichever you like!
IOC.insp(list, "something")
IOC.inspect(list, "something")
IOColor.insp(list, "something")
IOColored.insp(list, "something")
IOColor.inspect(list, "something")
IOColored.inspect(list, "something")
# `IO.puts`: accepts one arg only
IOC.puts("Some string")
IOColor.puts("Some string")
IOColored.puts("Some string")
Of course!
conn
|> Map.get(:body_params)
|> IOC.insp("Incoming Body Params")
|> process_body_params
|> IOC.insp("Process result")
|> case do
# ...
end
I'm currently putting this here for my personal convenience. Yeah I'm lazy to copy a single module file across all my projects, I know. But if it'll be useful to you to see more features, feel free to put in an issue and pull request, and I'll help what I can. Just saying, it seems that supporting presets (soft or hard) may be better than just custom colors, because the colour combinations are hard to get right.
# install erlang, elixir
git clone https://github.com/Seiyial/elix_io_color.git
cd io_color
iex -S mix run