TBK145
Having colours in remote consoles
Hi all,
I was looking around in our deployment process and found out we deploy a file .iex.exs. Upon inspection this file only does Application.put_env(:elixir, :ansi_enabled, true). So I understand that this file is what enables colour when we use the remote_console. Now I don’t really like deploying this file just for that reason, so I started digging around how this works.
I found out that when starting a release, elixir decides to pass -elixir ansi_enabled true when stdin and stdout are both opened in a terminal. But because we start our release using systemd, the flag is not passed (at least I assume that’s the reason).
Although when running the remote_console I can see the flag is being passed to the that elixir process, but (I guess) because the release has ansi_enabled: false configured, there’s no colour.
So my question is in two-fold:
- Can the remote_console have colour based on it’s own ansi_enabled flag?
- Is it safe to just configure
ansi_enabled: truein the release config?
Most Liked
jg-made
You can configure your own colours like this:
IEx.configure(
colors: [
syntax_colors: [
number: :light_yellow,
atom: :light_cyan,
string: :light_black,
boolean: :red,
nil: [:magenta, :bright],
],
ls_directory: :cyan,
ls_device: :yellow,
doc_code: :green,
doc_inline_code: :magenta,
doc_headings: [:cyan, :underline],
doc_title: [:cyan, :bright, :underline],
]
)
Just put that in .iex.exs
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









