Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve terminal #21

Merged
merged 6 commits into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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