diff --git a/src/color.rs b/src/color.rs index 55a7c9e..ca58981 100644 --- a/src/color.rs +++ b/src/color.rs @@ -1,3 +1,4 @@ +//! utility types and functions for color operations use termion::color::{ Bg, Fg, Rgb, Reset }; diff --git a/src/draw.rs b/src/draw.rs index 7ae7ff6..3ebf02f 100644 --- a/src/draw.rs +++ b/src/draw.rs @@ -1,3 +1,5 @@ +//! render handling code + use std::io::{ self, Write }; use termion::{ @@ -18,6 +20,7 @@ use crate::{ pub static BLOCK: &str = "█"; pub static UHALF: &str = "▀"; +/// prints a provided vec of lines to stdout pub fn draw_lines(lines: Vec, hold: bool) { let mut stdout = io::stdout().into_raw_mode().unwrap(); @@ -44,6 +47,7 @@ pub fn draw_lines(lines: Vec, hold: bool) { 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>, width: u16, height: u16) -> Vec { let width = width as usize; let height = height as usize; @@ -68,6 +72,7 @@ pub fn fg_stripes(colors: Vec>, width: u16, height: u16) -> Vec output } +/// generates lines for background colors provided as a vec of strings for the draw_lines method pub fn bg_stripes(colors: Vec>, width: u16, height: u16) -> Vec { let width = width as usize; let height = height as usize; @@ -92,6 +97,7 @@ pub fn bg_stripes(colors: Vec>, width: u16, height: u16) -> Vec } impl Flag { + /// renders a flag to stdout pub fn draw(self, hold: bool) { let lines = match self { Flag::Stripes(colors) diff --git a/src/flag.rs b/src/flag.rs index 76796cf..6db07aa 100644 --- a/src/flag.rs +++ b/src/flag.rs @@ -72,7 +72,7 @@ pub fn bisexual() -> Flag { } -fn demigender_base(color: Color) -> Vec { +fn demigender_base(color: Color) -> Colors { let grey = rgb(0x7F7F7F); let gray = rgb(0xC3C3C3); diff --git a/src/main.rs b/src/main.rs index 51efe80..808f662 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,5 @@ +//! main method module + use std::{ io::{ stdout, IsTerminal }, process::exit diff --git a/src/util.rs b/src/util.rs index cd198d9..533e327 100644 --- a/src/util.rs +++ b/src/util.rs @@ -1,3 +1,4 @@ +//! utility functions for working with ansi strings /// gets the substring of displayed characters of an ANSI formatted string pub fn ansi_substr(source: &str, start: usize, end: usize) -> String {