# cclock

![candy_scrot](assets/candy.png)

This is a silly little console clock using [cfonts](https://crates.io/crates/cfonts)

## About this fork

This was originally forked from [tuime](https://github.com/nthnd/tuime). I use this console clock all the time, and the original repo hasn't been updated in a few years, so I decided to give it some love. I did a lot of refactoring and made some dependency changes that reduced the binary size a bit, such as removing the unnecessary [tokio](https://crates.io/crates/tokio) dependency and replacing [clap](https://crates.io/crates/clap) with [pico-args](https://crates.io/crates/pico-args), in addition to some compiler optimizations.

I also made it what I consider to be more ergonomic to use. The default clock format is 12-hour, the CLI arguments are less verbose and more intuitively named, and you can list the available fonts with their rendered examples using the current time.

I renamed it to `cclock` in reference to `cfonts`, and also because it reminds me of those X11 clocks `xclock` and `oclock` and stuff.

## Installation

### Cargo 
```sh 
cargo install cclock

# or

git clone https://codeberg.org/wisdmm/cclock.git
cd cclock

# compile and install with cargo
cargo install --path .

# or compile with cargo and install manually
cargo build --release
mv ./target/release/cclock ~/.local/bin/cclock
```

### Other
Download the appropriate binary from the [releases section](https://codeberg.org/wisdmm/cclock/releases)

## Usage

```console
 █▀▀ █▀▀ █   █▀█ █▀▀ █▄▀
 █▄▄ █▄▄ █▄▄ █▄█ █▄▄ █ █
cclock 0.3.0

options:

      --format <string> [default: %I:%M]
          format the time strftime(3) style

  -c, --color <string> [default: system]
          give a clock some color
          you can use multiple colors for supported fonts
          see the --font section for the list

          eg:
          cclock -f block -c red -c green

          possible values:
          ■ system (terminal's foreground)
          ■ black
          ■ red
          ■ green
          ■ yellow
          ■ blue
          ■ magenta
          ■ cyan
          ■ white
          ■ bright-black
          ■ bright-red
          ■ bright-green
          ■ bright-yellow
          ■ bright-blue
          ■ bright-magenta
          ■ bright-cyan
          ■ bright-white
          ■ candy (yay)

  -f, --font <string> [default: block]
          set the font

          possible values:
          ■ block        [colors: 2]
          ■ simpleblock  [colors: 1]
          ■ 3d           [colors: 2]
          ■ simple3d     [colors: 1]
          ■ chrome       [colors: 3]
          ■ huge         [colors: 2]
          ■ shade        [colors: 2]
          ■ slick        [colors: 2]
          ■ grid         [colors: 2]
          ■ pallet       [colors: 2]
          ■ simple       [colors: 1]
          ■ tiny         [colors: 1]
          ■ console      [colors: 1]

  -l, --list-fonts
          list and render all the available fonts

  -g, --gradient <quoted hex>
          set an RBG gradient instead of terminal colors

          eg:
          cclock -f chrome -g "#ffaabb" -g "#ee22ff" ...

  -u, --utc-offset <signed int>
          set the utc offset, otherwise use local time

          eg:
          cclock -u "-3600", cclock -u "+7200"

  -s, --screensaver
          screensaver mode

  -h, --help
          print this help message

  -v, --version
          print version
```

### Red and Black with Regular Font
```sh
cclock -c red -c black
```
![red black](assets/NormalRed.png)

### Blue with Shade Font and Formatted time
```sh
cclock -c blue --format "%H:%M:%S" -f shade
```
![blue shade](assets/ShadeBlue.png)

### Colorful with Tiny Font
```sh
cclock -c candy -f tiny
```
![tiny candy](assets/Tiny.png)

### Gradient and 3d Font
```sh
cclock -f simple3d -g '#ffe' -g '#3af'
```
![simple3d](assets/3d-grad.png)
