#terminal #terminal-text #hexagon #ascii

hext-boards

A small library that renders hexagonal boards with text on the terminal

6 releases (breaking)

new 0.5.0 Jan 17, 2025
0.4.0 Jan 15, 2025
0.3.0 Nov 19, 2023
0.2.0 Sep 22, 2023
0.1.1 Dec 25, 2022

#2395 in Command line utilities

Download history 1/week @ 2024-09-29 12/week @ 2024-12-08 6/week @ 2024-12-15 167/week @ 2025-01-12

167 downloads per month
Used in chessagon-cli

MIT license

11KB
198 lines

hext-boards

A small library to render hexagonal boards on the terminal.

Example

use hext_boards::HexagonalBoard;

let board = HexagonalBoard::from([
    ([0, 0], 'a'),
    ([1, 0], 'b'),
    ([0, 1], 'c'),
    ([-1, -1], 'd'),
]);

let output = board.to_string();

// Also works
println!("{board}");

/* Output is the following:

 /---\     /---\
⟨  b  ⟩---⟨  c  ⟩
 \---⟨  a  ⟩---/
      ⟩---⟨
     ⟨  d  ⟩
      \---/
*/

Dependencies

~3.5MB
~118K SLoC