#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

#2375 in Command line utilities

47 downloads per month
Used in chessagon-cli

MIT license

11KB
190 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