gol_lib/ansi_rust.rs
1// copyright Damien Lejosne 2021. See LICENSE for more informations
2//! This crate will be usefull to play with diplaying on the terminal
3
4///Reverse the color of the text which will be write on the screen
5pub fn reverse(){
6 print!("\x1b[7m");
7}
8///Underline the text which will be write on the screen
9pub fn underline(){
10 print!("\x1b[4m");
11}
12///Reset every display attributes
13pub fn reset(){
14 print!("\x1b[0m");
15}
16///Print a caracter at pos x,y
17pub fn show(c:char, x:usize, y:usize){
18 print!("\x1B[{};{}H{}", y, x , c);
19}
20///Clear the screen
21pub fn clear(){
22 print!("\x1B[2J");
23}
24///Refresh the screen e.g. show it
25pub fn refresh(){
26 println!()
27}