Stream: beginners

Topic: color text in basic-cli


view this post on Zulip Artur Swiderski (Dec 26 2023 at 19:55):

hi how to color text in basic cli I had example somewhere but I lost it.

view this post on Zulip Isaac Van Doren (Dec 26 2023 at 21:14):

You could use this https://github.com/lukewilliamboswell/roc-ansi

view this post on Zulip Artur Swiderski (Dec 27 2023 at 13:56):

I am working in raw terminal mode so I have also this option

-withColor : Str, [Red, Green, Blue]-> Str
-withColor = \str, color ->
-    when color is
-        Red -> "\u(001b)[31m\(str)\u(001b)[0m"
-        Green -> "\u(001b)[32m\(str)\u(001b)[0m"
-        Blue -> "\u(001b)[34m\(str)\u(001b)[0m"

Above seems a bit hack-y
What I wanted is something more native for basic-cli but also not external dependency
I will think what is better


Last updated: Jul 06 2025 at 12:14 UTC