Skip to content

Commit

Permalink
Merge pull request #21 from Aloso/improve-terminal
Browse files Browse the repository at this point in the history
Improve terminal
  • Loading branch information
Aloso authored Nov 2, 2020
2 parents 47dc0ec + 92ede0d commit e5447a4
Show file tree
Hide file tree
Showing 30 changed files with 1,199 additions and 773 deletions.
41 changes: 39 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

#### Additions
This release completely revamped the command line options, now using subcommands:

- `colo show` (or short `colo s`) shows one or more colors, which are entered consecutively. You'll notice that the output is now more space efficient and informative. I hope you like the new layout!

The flag to specify the color space was removed, now it can be entered as `'rgb(0, 50, 150)'`. Note that the parentheses and commas are optional for your convenience. For example, you could type:

```fish
colo s rgb 0 50 150, cmy .5 .2 0
```

The `--out` flag accepts two additional formats, `hex` and `html`. If converting the color to an HTML color name fails, it defaults to `hex`. Note that this flag is only really useful when piping to another command, e.g.

```fish
colo s orange red fuchsia -o cmy > somefile.txt
```

The output format is no longer JSON, but the human-readable format, which is also used by HTML and can be parsed by `colo`. If you needed JSON output, please file an issue so we can add this functionality again.

When displaying certain color values, percentage values are now used, for example for saturation and light.
- `colo print` displays some text in a certain color. A second color can be specified for the background. There are also the following flags to alter the text style:
- `-b` for bold text
- `-i` for italic text
- `-u` for underlined text
- `-n` to _not_ print a new line afterwards – this is useful to change the style in the middle of a line:

```fish
colo print -n "Hello " orange && colo print "world!" red
```
- `colo term` replaces `colo --term`. It is used to print the default terminal colors.
- `colo libs` replaces `colo --libs`. It prints the dependency tree `colo` was compiled with.
- `colo help` prints help information. Use `colo help <subcommand>` to show help for a subcommand. Use `colo --help` or `colo <subcommand> --help` for a more detailed help message.
- The version flag `-v` was renamed to `-V` again.

#### Bug fixes

- Converting a color to CMYK used to output `cmyk(0, 0, 0, 0)` for any input

#### Internal

- Add `--text`/`-x` option to print colored text
- The `crossterm` dependency was replaced with `colored`, which improved compile times.

## [0.2.2] - 2020-10-31

Expand Down
208 changes: 44 additions & 164 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "colo"
version = "0.2.3"
version = "0.3.0"
authors = ["Ludwig Stecher <[email protected]>"]
description = "CLI tool to show and convert colors between various color spaces"
categories = ["command-line-interface"]
Expand All @@ -18,7 +18,9 @@ license = "MIT"
lto = "thin"

[dependencies]
crossterm = "0.18.1"
colored = "2.0.0"
clap = "2"
atty = "0.2"
color_space = "^0.5.3"
anyhow = "1"
thiserror = "1"
Loading

0 comments on commit e5447a4

Please sign in to comment.