Skip to content

Commit

Permalink
Merge pull request #30 from Aloso/dev
Browse files Browse the repository at this point in the history
Align square with text vertically
  • Loading branch information
Aloso authored Nov 4, 2020
2 parents 1ecac56 + a898b55 commit 4a1441c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

- Align square vertically with text

## [0.3.0] - 2020-11-04

This release completely revamped the command line options, now using subcommands (see [`#21`](https://github.com/Aloso/colo/pull/21)):
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ fn main() -> Result<()> {
size,
} = cli::get_show(&matches)?;

println!();
for (color, input) in colors {
show_color::show(color, input, output, size)?;
}
Expand Down
19 changes: 3 additions & 16 deletions src/show_color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ where
}
writeln!(stdout)?;
}
writeln!(stdout)?;
Ok(())
}

Expand Down Expand Up @@ -158,28 +159,14 @@ pub fn show_text(

/// Generates an ASCII square with the given size
fn make_square(size: u32) -> String {
if size == 0 {
return String::new();
}

let mut s = String::from(" ");
let mut s = String::new();
for _ in 0..size {
s.push('▄');
s.push('▄');
}
s.push('\n');
s.push(' ');
for _ in 0..size - 1 {
s.push(' ');
for _ in 0..size {
s.push('█');
s.push('█');
}
s.push('\n');
s.push(' ');
}
for _ in 0..size {
s.push('▀');
s.push('▀');
}
s
}
Expand Down

0 comments on commit 4a1441c

Please sign in to comment.