thiagomajesk
Hi, I have been experiencing some problems using on Windows regarding iex output coloring.
Since I’ve been using CMDER as my main console for some time, I only noticed this problem today trying to use iex through Visual Studio Code’s integrated terminal.
After searching a lot about this, I was unable to find the right cause or solutions to this problem, so I don’t know if this is a problem on the REPL by itself or at the OS level, so I was hoping someone could help me with that.
This is what I’m getting using this config on my .iex.exs:
Application.put_env(:elixir, :ansi_enabled, true)
IEx.configure(
colors: [
enabled: true,
eval_result: [:cyan, :bright],
eval_info: [:blue, :bright],
eval_error: [:magenta, :bright],
doc_title: [:reverse, :yellow, :bright],
doc_headings: [:yellow, :bright],
doc_inline_code: [:magenta, :bright],
ls_directory: [:green, :bright],
stack_app: [:green, :bright],
stack_info: [:red, :bright]
]
)
Powershell, CMD and CMDER (Powershell)
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 9- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
NobbZ
Windows command line and Powershell simply are not capable of ANSI. They do understand another set of commands though, which is not implemented in elixir so far.
thiagomajesk
I found this PS function that can translate ANSI color escapes: Write-ANSI.psm1 - Pastebin.com.
Maybe some Powershell expert in the forum could help integrate this into iex as a workaround.
OvermindDL1
@Nobbz Actually windows commandline and powershell are capable of ANSI just fine (and I’ve used many times), however they are just ‘shells’, not the terminals, it is up to the terminal to display the colors. The standard terminal built in to Windows is, well, a huge piece of ****, Cmder on the other hand is far more capable. On Win10 at work I use ConEmu and both the Windows Command Prompt and Powershell display all colors just fine.
I.E. it’s not the shell’s fault, it’s the terminal you are using, use a better one.
thiagomajesk
I’ve searched a little bit more about this and found that Windows 10 had ANSI support. Now it’s disabled by default (because of inconsistent behavior).
So, the solution now is for vendors to enable it (like people made for Symphony).
Some explanations and references in this SO answer.
@josevalim Could you check if this something that is worth search into for iex?
josevalim
If you know of a way of checking it programatically, we could do that. That’s what we do in the other operating systems:
https://github.com/elixir-lang/elixir/blob/2f03f4603e6dbb4117d3bd0db2a3f9f6c55ff3ac/bin/elixir#L112
thiagomajesk
I found a way to enable this flag using Powershell (in theory). Although it doesn’t seem to work for iex, can someone else try this too? The expected behavior should be that the output is colored after running:
)
(curl http://wttr.in/ -UserAgent "curl" ).Content. (Remember to check before cuz I forgotOvermindDL1
It doesn’t work in
iexbecause it is per-process, not per-terminal, soiexitself (I.E. the BEAM) would have to make those calls. Someone could probably make a NIF do it though.thiagomajesk
That makes sense @OvermindDL1.
.
I’d love to make any significant contribution but my knowledge of Windows specifics is too shallow
OvermindDL1
Well getting a NIF built and then just googl’ing for the command needed to call into the winapi might be useful for those people, just prebuild it for them since they often don’t have a full C building environment set up and then it should ‘just work’ (might need to auto-select 32-bit or 64-bit depending?).