A Rust library for drawing grid-based user interfaces using ASCII characters.

Overview

grux

A library for drawing grid-based user interfaces using ASCII characters.

Rust Checks Coverage Status Current Crates.io Version Docs License: MIT

// Provides a uniform interface for drawing to a 2D grid.
use grux::GridWriter;

// Create a 3x3 2D array.
// Alternatives provided by `grux`: `Vec<Vec<T>>` and `String`.
let mut grid = [[' '; 3]; 3];

// Draw some random stuff. In practice, you'd probably use the `Sprite` trait.
grid.set((0, 0), '╔');
grid.set((1, 0), '═');
grid.set((2, 0), '╗');
grid.set((0, 1), '║');
grid.set((2, 1), '║');
grid.set((0, 2), '╚');
grid.set((1, 2), '═');
grid.set((2, 2), '╝');

// Provides a uniform interface for displaying a 2D grid.
use grux::DisplayGrid;

// ╔═╗
// ║ ║
// ╚═╝
println!("{}", grid.to_string().unwrap());

See the examples directory for more, including built-in sprites.

Why Grux?

There are plenty of existing libraries for terminal-based user interfaces, but none of them are quite what I wanted. I wanted a library that would let me draw a grid of cells, each of which could contain a single character.

Importantly, Grux isn't a UI framework.

It doesn't handle input or even output. It just lets you draw to a grid-like structure, which could be:

  • A Vec<Vec<T>>
  • A String
  • A fixed-size 2D array (i.e. [[T; 10]; 10])
  • Your custom data structure (just implement GridWriter and/or DisplayGrid)

tl;dr: Draw to whatever you want, and build on top of it (or replace it).

You might also like...
Rust API Server: A versatile template for building RESTful interfaces, designed for simplicity in setup and configuration using the Rust programming language.
Rust API Server: A versatile template for building RESTful interfaces, designed for simplicity in setup and configuration using the Rust programming language.

RUST API SERVER Introduction Welcome to the Rust API Server! This server provides a simple REST interface for your applications. This README will guid

A library that creates a terminal-like window with feature-packed drawing of text and easy input handling. MIRROR.

BearLibTerminal provides a pseudoterminal window with a grid of character cells and a simple yet powerful API for flexible textual output and uncompli

Rusty fast cross-platform 2D drawing library
Rusty fast cross-platform 2D drawing library

Bly Rusty fast cross-platform 2D graphics library Concept Easy to use Bly is easy to use and yet can be called from various windowing libraries using

A fantastic crate for fmting numbers using the appropriate unciode characters.

fmtastic ✨ A fantastic crate for fmting numbers using the appropriate unicode characters via the Display trait. ✨ Supports vulgar fractions, super- an

Build terminal dashboards using ascii/ansi art and javascript
Build terminal dashboards using ascii/ansi art and javascript

blessed-contrib Build dashboards (or any other application) using ascii/ansi art and javascript. Friendly to terminals, ssh and developers.

a rust crate for drawing fancy pie charts in the terminal
a rust crate for drawing fancy pie charts in the terminal

piechart piechart is a rust crate for drawing fancy pie charts in the terminal. Example usage: use piechart::{Chart, Color, Data}; fn main() { le

Tool to create web interfaces to command-line tools

webgate This command line utility allows you to: serve files and directories listed in a config file remotely run shell commands listed in a config fi

Batteries included command line interfaces.

CLI Batteries Opinionated batteries-included command line interface runtime utilities. To use it, add it to your Cargo.toml [dependencies] cli-batteri

Small CLI for escaping and unescaping characters in strings

🐌 esc Small CLI for escaping characters in strings. Install cargo install esc Usage cat LICENSE-MIT | esc escape | pbcopy pbpaste | esc unescape | pb

Owner
Matan Lurey
Staff Software Engineer I only contribute to fun/personal projects on GitHub and not anything related to my work 😎
Matan Lurey
Tiny Rust library to draw pretty line graphs using ascii characters.

rasciigraph Tiny Rust library to draw pretty line graphs using ascii characters. Usage Add this to your Cargo.toml [dependencies] rasciigraph = "0.1.1

Orhan Balci 54 Jan 6, 2023
Perspective projection of a spinning cube, using just ASCII characters.

Spinning Cube Perspective projection of a spinning cube, using just ASCII characters. spinning_cube.mp4 Instalation cargo install spinning_cube Basic

Guilherme Pagano 5 Aug 31, 2023
`boxy` - declarative box-drawing characters

boxy - declarative box-drawing characters Box-drawing characters are used extensively in text user interfaces software for drawing lines, boxes, and o

Miguel Young 7 Dec 30, 2022
A library for building declarative text-based user interfaces

Intuitive docs.rs Documentation Intuitive is a component-based library for creating text-based user interfaces (TUIs) easily. It is heavily inspired b

Enrico Borba 205 Dec 29, 2022
Build terminal user interfaces and dashboards using Rust

tui-rs tui-rs is a Rust library to build rich terminal user interfaces and dashboards. It is heavily inspired by the Javascript library blessed-contri

Florian Dehau 9.3k Jan 4, 2023
A terminal ASCII media player. View images, gifs, videos, webcam, YouTube, etc.. directly in the terminal as ASCII art.

Terminal Media Player View images, videos (files or YouTube links), webcam, etc directly in the terminal as ASCII. All images you see below are just m

Max Curzi 36 May 8, 2023
Grid-based drum sequencer plugin as MIDI FX in CLAP/VST3 format

dr-seq Grid-based drum sequencer plugin as MIDI FX in CLAP/VST3 format. WARNING: This project is in a very early state. So there is no guarantee for a

Oliver Rockstedt 6 Jan 29, 2023
Rust library for putting things in a grid

rust-term-grid This library arranges textual data in a grid format suitable for fixed-width fonts, using an algorithm to minimise the amount of space

Benjamin Sago 61 Nov 4, 2022
A library for 3D grid coordinates: for games

Positioning rustdocs A library for manipulating coordinates on a 3D grid. This will contain code that I'll often end up repeating in games. Currently,

Samuel Schlesinger 7 Dec 6, 2022
Bevy Meshem is a Rust crate designed to provide meshing algorithms for voxel grids, enabling you to create cohesive 3D mesh structures from a grid of cubic voxels

Bevy Meshem Crates.io, docs Bevy Compatibility: Bevy Version bevy_meshem 0.11 main Bevy Meshem is a Rust crate designed to provide meshing algorithms

Adam 4 Aug 16, 2023