summaryrefslogtreecommitdiff
path: root/lib/chessh/utils.ex
diff options
context:
space:
mode:
authorSimponic <loganhunt@simponic.xyz>2023-01-02 19:10:23 -0700
committerSimponic <loganhunt@simponic.xyz>2023-01-02 19:10:23 -0700
commit16281b0e8deb6b3bf86ac0b9381f3fdf89b22b58 (patch)
tree80295ecaaad54c82ea1541d0932f8e8043f88515 /lib/chessh/utils.ex
parent2bf058d5db79cc75f87d9accfeb9773d5bf29686 (diff)
downloadchessh-16281b0e8deb6b3bf86ac0b9381f3fdf89b22b58.tar.gz
chessh-16281b0e8deb6b3bf86ac0b9381f3fdf89b22b58.zip
Now a simple logo draws in the center of the terminal, terminal size is limited, and resizing support
Diffstat (limited to 'lib/chessh/utils.ex')
-rw-r--r--lib/chessh/utils.ex5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/chessh/utils.ex b/lib/chessh/utils.ex
index 1a7f8cf..3e83d5e 100644
--- a/lib/chessh/utils.ex
+++ b/lib/chessh/utils.ex
@@ -6,4 +6,9 @@ defmodule Chessh.Utils do
|> List.delete_at(-1)
|> to_string()
end
+
+ def text_dim(text) do
+ split = String.split(text, "\n")
+ {Enum.reduce(split, 0, fn x, acc -> max(acc, String.length(x)) end), length(split)}
+ end
end