Hello, thank you for such amazing library, I can't even imagine that something like this exists for elixir!
I noticed that when updating the state, the color of some symbols sometimes changes to white, and I don't understand why. Here's an example to reproduce:
defmodule TestUi.App do
use TermUI.Elm
alias TermUI.Event
alias TermUI.Renderer.Style
def init(_opts), do: %{matrix: generate_matrix()}
def event_to_msg(%Event.Key{key: :up}, _state), do: {:msg, :up}
def event_to_msg(_, _), do: :ignore
def update(:up, state), do: {%{state | matrix: generate_matrix()}, []}
def view(state) do
stack(:vertical, [
Enum.map(state.matrix, fn row ->
letters = Enum.map(row, fn letter -> text("#{letter}", letter_style(letter)) end)
stack(:horizontal, letters)
end)
])
end
defp letter_style("a"), do: Style.new([fg: :green])
defp letter_style("b"), do: Style.new([fg: :yellow])
defp letter_style("c"), do: Style.new([fg: :blue])
defp letter_style("d"), do: Style.new([fg: :red])
defp generate_matrix do
matrix = ["a", "b", "c", "d"]
Enum.map(1..5, fn _ -> Enum.shuffle(matrix) end)
end
def run do
TermUI.Runtime.run(root: __MODULE__)
end
end
The program prints a matrix of colored symbols (the same symbol will always be the same color):
Then, when I press key up for update the matrix I got this:
Look at "a" letter in very last row, now its white. Can you explain why it may happen?
Hello, thank you for such amazing library, I can't even imagine that something like this exists for elixir!
I noticed that when updating the state, the color of some symbols sometimes changes to white, and I don't understand why. Here's an example to reproduce:
The program prints a matrix of colored symbols (the same symbol will always be the same color):
Then, when I press key up for update the matrix I got this:
Look at "a" letter in very last row, now its white. Can you explain why it may happen?