update docs for color option

This commit is contained in:
race604 2022-07-20 12:53:55 +08:00
parent af3902dd33
commit 08fb4d0328
4 changed files with 11 additions and 5 deletions

2
Cargo.lock generated
View file

@ -100,7 +100,7 @@ dependencies = [
[[package]] [[package]]
name = "clock-tui" name = "clock-tui"
version = "0.2.0" version = "0.2.1"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "clock-tui" name = "clock-tui"
version = "0.2.0" version = "0.2.1"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
description = "A clock app in terminal" description = "A clock app in terminal"

View file

@ -67,7 +67,7 @@ You can press `Space` key to _pause_ and _resume_ the stopwatch.
You can customize the styles. You can customize the styles.
* Size ### Size
You can use `-s` or `--size` option to custome clock size, for example: You can use `-s` or `--size` option to custome clock size, for example:
@ -75,12 +75,14 @@ You can use `-s` or `--size` option to custome clock size, for example:
$ tclock -s 2 $ tclock -s 2
``` ```
* Color ### Color
You can use `-c` or `--color` to set clock forground color, for exmaple: You can use `-c` or `--color` to set clock forground color, for exmaple:
```shell ```shell
# color name # color name, any one of:
# Black, Red, Green, Yellow, Blue, Magenta, Cyan, Gray, DarkGray, LightRed,
# LightGreen, LightYellow, LightBlue, LightMagenta, LightCyan, White
$ tclock -c yellow $ tclock -c yellow
# or hex color # or hex color

View file

@ -38,8 +38,12 @@ pub(crate) enum Mode {
pub(crate) struct App { pub(crate) struct App {
#[clap(subcommand)] #[clap(subcommand)]
pub mode: Option<Mode>, pub mode: Option<Mode>,
/// Forground color of the clock, possible values are:
/// a) Any one of: Black, Red, Green, Yellow, Blue, Magenta, Cyan, Gray, DarkGray, LightRed, LightGreen, LightYellow, LightBlue, LightMagenta, LightCyan, White.
/// b) Hexadecimal color code: #RRGGBB.
#[clap(short, long, value_parser = parse_color, default_value = "green")] #[clap(short, long, value_parser = parse_color, default_value = "green")]
pub color: Color, pub color: Color,
/// Size of the clock, should be a positive integer (>=1).
#[clap(short, long, value_parser, default_value = "1")] #[clap(short, long, value_parser, default_value = "1")]
pub size: u16, pub size: u16,