{"id":17982290,"url":"https://github.com/pierrechevalier83/matrix_display","last_synced_at":"2025-03-25T19:31:02.312Z","repository":{"id":57637020,"uuid":"82260438","full_name":"pierrechevalier83/matrix_display","owner":"pierrechevalier83","description":"A rust library to visualise pretty matrixes in cli","archived":false,"fork":false,"pushed_at":"2019-05-12T18:04:26.000Z","size":5233,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-20T17:23:11.762Z","etag":null,"topics":["cli","matrix-display","rust","rust-library","unicode"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pierrechevalier83.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-17T05:25:15.000Z","updated_at":"2025-01-31T09:49:46.000Z","dependencies_parsed_at":"2022-08-30T10:31:05.631Z","dependency_job_id":null,"html_url":"https://github.com/pierrechevalier83/matrix_display","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierrechevalier83%2Fmatrix_display","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierrechevalier83%2Fmatrix_display/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierrechevalier83%2Fmatrix_display/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierrechevalier83%2Fmatrix_display/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pierrechevalier83","download_url":"https://codeload.github.com/pierrechevalier83/matrix_display/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245530076,"owners_count":20630493,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","matrix-display","rust","rust-library","unicode"],"created_at":"2024-10-29T18:13:39.313Z","updated_at":"2025-03-25T19:30:57.304Z","avatar_url":"https://github.com/pierrechevalier83.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/pierrechevalier83/matrix_display.svg?branch=master)](https://travis-ci.org/pierrechevalier83/matrix_display)\n[![Coverage Status](https://coveralls.io/repos/github/pierrechevalier83/matrix_display/badge.svg?branch=master)](https://coveralls.io/github/pierrechevalier83/matrix_display?branch=master)\nMatrix Display\n--------------\nA simple rust library to visualize 2D matrixes in rust.\n\n- Supports 256 terminal colours using AnsiTerm\n- Multiple unicode box character sets supported (plain, retro, thin, rounded, thick, double)\n\nDocumentation\n-------------\n[Click here to access the documentation](https://pierrechevalier83.github.io/matrix_display/)\n\nBuild\n-----\n- `git clone git@github.com:pierrechevalier83/matrix_display.git`\n- `cargo test`\n\nRun\n---\n- `cargo run --example chess`\n- `cargo run --example 2048`\n- `cargo run --example palette`\n\nExample: visualising a chess board\n----------------------------------\n\n```\nextern crate matrix_display;\nuse matrix_display::*;\n\nfn main() {\n    let format = Format::new(7, 3);\n\tlet board = vec!['♜', '♞', '♝', '♛', '♚', '♝', '♞', '♜',\n\t                 '♟', '♟', '♟', '♟', '♟', '♟', '♟', '♟',\n\t\t\t\t\t ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',\n                     ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',\n\t\t\t\t\t ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',\n\t\t\t\t\t ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',\n\t\t\t\t\t '♖', '♘', '♗', '♕', '♔', '♗', '♘', '♖',\n\t\t\t\t\t '♙', '♙', '♙', '♙', '♙', '♙', '♙', '♙']\n        .iter()\n        .enumerate()\n\t\t.map(|(i, x)| {\n            let ansi_fg = 33;\n\t\t\tlet mut ansi_bg = 0;\n\t\t    if i % 2 + (i / 8) % 2 == 1 {\n\t\t\t    ansi_bg = 7;\n\t\t\t}\n\t\t    cell::Cell::new(x.clone(), ansi_fg, ansi_bg)\n\t\t\t})\n        .collect::\u003cVec\u003c_\u003e\u003e();\n    let data = matrix::Matrix::new(8, board);\n    let display = MatrixDisplay::new(format, data);\n\tdisplay.cell_at_cursor_position((13, 6)).color.bg = 10;\n    display.print(\u0026mut std::io::stdout(), \u0026style::BordersStyle::None);\n}\n```\n![alt tag](https://github.com/pierrechevalier83/matrix_display/blob/master/screenshots/chess.png)\n\nFor a working version of the game, see [chess-rs](https://github.com/pierrechevalier83/chess-rs)\n\nExample: visualising a 2048 game\n--------------------------------\n\n```\nextern crate matrix_display;\nuse matrix_display::*;\n\nfn main() {\n    let format = Format::new(7, 3);\n    let colour_theme = vec![247, 78, 222, 220, 214, 208, 202, 196, 162, 160, 126, 90, 88, 54, 53, 52];\n    let board = (0..16)\n        .map(|x| {\n            cell::Cell::new(2_f64.powi(x + 1),\n                      7,\n                      *colour_theme.get(x as usize).unwrap() as u8)\n        })\n        .collect::\u003cVec\u003c_\u003e\u003e();\n    let data = matrix::Matrix::new(4, board);\n    let display = MatrixDisplay::new(format, data);\n    display.print(\u0026mut std::io::stdout(), \u0026style::BordersStyle::Thick);\n}\n```\n\n![alt tag](https://github.com/pierrechevalier83/matrix_display/blob/master/screenshots/2048.png)\n\nFor a working version of the game, see [2048-rs](https://github.com/pierrechevalier83/2048-rs)\n\nExample: visualising a 256 colors palette\n-----------------------------------------\n\n```\nextern crate matrix_display;\nuse matrix_display::*;\n\nfn main() {\n    let format = Format::new(5, 1);\n    let board = (0..256)\n        .map(|x| cell::Cell::new(x, 0, x as u8))\n        .collect::\u003cVec\u003c_\u003e\u003e();\n    let data = matrix::Matrix::new(8, board);\n    let display = MatrixDisplay::new(format, data);\n    display.print(\u0026mut std::io::stdout(), \u0026style::BordersStyle::Thin);\n```\n\n![alt tag](https://github.com/pierrechevalier83/matrix_display/blob/master/screenshots/palette.png)\n\nFor a self contained implementation, see [palette-rs](https://github.com/pierrechevalier83/palette-rs)\n\nTODO\n----\n\n- Leverage fdehau/tui-rs to avoid redrawing the entire screen at every frame\n - Should help with performance issues with [snake-rs](https://github.com/pierrechevalier83/snake-rs), my snake implementations.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierrechevalier83%2Fmatrix_display","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpierrechevalier83%2Fmatrix_display","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierrechevalier83%2Fmatrix_display/lists"}