GithubHelp home page GithubHelp logo

colo's People

Contributors

aloso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

colo's Issues

Provide binaries for Windows and macOS

I currently don't have access to a Windows or macOS machine, so I'd have to cross-compile from Linux, or somehow use GitHub actions. I haven't investigated this yet, if you have experience with this, please let me know!

[feature] `gray` color space

Add a gray color space that has only one component, the luminance (which is equivalent to the 3rd component of hsl). This will make it easy to convert a color to grayscale.

Color picker

For more advanced terminal features, such as a color picker, I suggest to use the console crate.

There should be different color pickers for different color spaces:

  • sRGB, CMY: 3 sliders
  • CMYK: 4 sliders
  • HSL, HSV: Hue/saturation rectangle + 1 slider
  • CIELAB: Rectangle with chromaticity plane + lightness slider
  • ...

The MVP only has to implement a single color picker. It can be refactored later to use traits and generics, so it's easily extendable.

Color input for all commands

There should be two new magic keywords when parsing a list of colors:

  • pick: this will read a color from the color picker
  • - (dash/hyphen): this will read a color from stdin

Examples:

$ colo contrast rand pick  # first color is random, second color is entered in the color picker
$ colo s pick              # equivalent to `colo pick`
$ colo textcolor -         # equivalent to `colo textcolor` when behind pipe

Document color spaces

There should be a document where each color space is explained, with examples and external links. This can be a markdown file, linked from the README.

Test coverage

There are currently very few tests. For the next release, I'd like most modules to be unit tested.

Additionally, we should test the command-line interface in CI. I'm not sure what the easiest way to do this is, or if it's even feasible. If you have experience, let me know!

[proposal] DSL for advanced computations

Imagine you want to make the color #aacc66 more saturated. You could do

$ colo s aacc66 -o hsl
hsl(80, 50%, 60%)

$ colo s "hsl(80, 80%, 60%)"
#b4eb47

Then you finally have the more saturated color #b4eb47. However, colo could offer a DSL (domain specifc language) to do this in one command, e.g.

colo s "AACC66 as hsl +0.3l"

The alternative is to use pipes, like pastel:

$ pastel color aacc66 | pastel saturate 0.3

Create random color

Possible syntax:

$ colo s rand   # equivalent to
$ colo s 'rgb(rand, rand, rand)'

Or more fine-grained:

$ colo s 'hsl(30..60, 0.7..1, rand)'

Add support for LAB

I think this tool would be even more powerful with the implementation of the CIELAB color space in the pick subcommand. Thanks for this great tool. :><3

Structure CLI arguments better

Currently, the CLI arguments are confusing, as some arguments require other arguments, and some conflict with each other. To simplify things, colo should use subcommands for different tasks:

  • colo <COLOR>... or echo <COLOR>... | colo (no subcommand) outputs a color
  • colo print <TEXT> <COLOR>... or echo <TEXT> | colo print <COLOR>... prints the text in a certain color
  • colo term shows the terminal colors
  • colo libs shows the dependency tree
  • potentially more...

Printf command

The printf subcommand formats a text with format tags. Example:

echo "Hello {b}{fg red}world {i}Hello{/b} world" | colo printf

Format tags are:

  • {fg <text_color>} sets the text (foreground) color
  • {bg <background_color>} sets the background color
  • {b}, {i}, {u} make the text bold, italic or underlined, respectively
  • {/b}, {/i}, {/u}, {/fg}, {/bg} resets the respective style to the default

Mix colors

Add command to mix an arbitrary number of colors in a given color space. The default color space should be Lab.

[feature] Pipe input to colo

Pipe input to colo, for example:

$ echo "rgb(255, 0, 127), hsl(30, 1, .5)" | colo
$ echo "Hello world" | colo print red

This requires

  • Detecting if colo is used behind a pipe (this is possible with atty)
  • Adjust the CLAP arguments in case colo is behind a pipe
  • Read the input from stdin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.