added documentation for several files
This commit is contained in:
parent
f300979b3a
commit
ab4b459004
5 changed files with 11 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
//! utility types and functions for color operations
|
||||||
|
|
||||||
use termion::color::{ Bg, Fg, Rgb, Reset };
|
use termion::color::{ Bg, Fg, Rgb, Reset };
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! render handling code
|
||||||
|
|
||||||
use std::io::{ self, Write };
|
use std::io::{ self, Write };
|
||||||
|
|
||||||
use termion::{
|
use termion::{
|
||||||
|
@ -18,6 +20,7 @@ use crate::{
|
||||||
pub static BLOCK: &str = "█";
|
pub static BLOCK: &str = "█";
|
||||||
pub static UHALF: &str = "▀";
|
pub static UHALF: &str = "▀";
|
||||||
|
|
||||||
|
/// prints a provided vec of lines to stdout
|
||||||
pub fn draw_lines(lines: Vec<String>, hold: bool) {
|
pub fn draw_lines(lines: Vec<String>, hold: bool) {
|
||||||
let mut stdout = io::stdout().into_raw_mode().unwrap();
|
let mut stdout = io::stdout().into_raw_mode().unwrap();
|
||||||
|
|
||||||
|
@ -44,6 +47,7 @@ pub fn draw_lines(lines: Vec<String>, hold: bool) {
|
||||||
stdout.flush().ok();
|
stdout.flush().ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// generates lines for foreground colors provided as a vec of strings for the draw_lines method
|
||||||
pub fn fg_stripes(colors: Vec<Fg<Rgb>>, width: u16, height: u16) -> Vec<String> {
|
pub fn fg_stripes(colors: Vec<Fg<Rgb>>, width: u16, height: u16) -> Vec<String> {
|
||||||
let width = width as usize;
|
let width = width as usize;
|
||||||
let height = height as usize;
|
let height = height as usize;
|
||||||
|
@ -68,6 +72,7 @@ pub fn fg_stripes(colors: Vec<Fg<Rgb>>, width: u16, height: u16) -> Vec<String>
|
||||||
|
|
||||||
output
|
output
|
||||||
}
|
}
|
||||||
|
/// generates lines for background colors provided as a vec of strings for the draw_lines method
|
||||||
pub fn bg_stripes(colors: Vec<Bg<Rgb>>, width: u16, height: u16) -> Vec<String> {
|
pub fn bg_stripes(colors: Vec<Bg<Rgb>>, width: u16, height: u16) -> Vec<String> {
|
||||||
let width = width as usize;
|
let width = width as usize;
|
||||||
let height = height as usize;
|
let height = height as usize;
|
||||||
|
@ -92,6 +97,7 @@ pub fn bg_stripes(colors: Vec<Bg<Rgb>>, width: u16, height: u16) -> Vec<String>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Flag {
|
impl Flag {
|
||||||
|
/// renders a flag to stdout
|
||||||
pub fn draw(self, hold: bool) {
|
pub fn draw(self, hold: bool) {
|
||||||
let lines = match self {
|
let lines = match self {
|
||||||
Flag::Stripes(colors)
|
Flag::Stripes(colors)
|
||||||
|
|
|
@ -72,7 +72,7 @@ pub fn bisexual() -> Flag {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn demigender_base(color: Color) -> Vec<Color> {
|
fn demigender_base(color: Color) -> Colors {
|
||||||
let grey = rgb(0x7F7F7F);
|
let grey = rgb(0x7F7F7F);
|
||||||
let gray = rgb(0xC3C3C3);
|
let gray = rgb(0xC3C3C3);
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! main method module
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
io::{ stdout, IsTerminal },
|
io::{ stdout, IsTerminal },
|
||||||
process::exit
|
process::exit
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//! utility functions for working with ansi strings
|
||||||
|
|
||||||
/// gets the substring of displayed characters of an ANSI formatted string
|
/// gets the substring of displayed characters of an ANSI formatted string
|
||||||
pub fn ansi_substr(source: &str, start: usize, end: usize) -> String {
|
pub fn ansi_substr(source: &str, start: usize, end: usize) -> String {
|
||||||
|
|
Loading…
Reference in a new issue