项目作者: mikemcbride

项目描述 :
Convert color strings between hex, rgb, and hsl right from your terminal
高级语言: JavaScript
项目地址: git://github.com/mikemcbride/convert-color-cli.git
创建时间: 2019-04-24T17:22:20Z
项目社区:https://github.com/mikemcbride/convert-color-cli

开源协议:

下载


convert-color-cli

Convert HEX, RGB, and HSL colors to other formats from the command line.

Install

You can install the package globally to use it anywhere:

  1. npm install -g convert-color-cli # or yarn global add convert-color-cli

Usage

Globally

Convert RGB, HEX, or HSL, including alpha values for all three. You can pass any color code in as the optional first parameter:

  1. $ convert-color 'rgb(40, 42, 54)'
  2. $ convert-color 'rgba(40, 42, 54, 75%)'
  3. $ convert-color ff9afd
  4. $ convert-color '#282a36'
  5. $ convert-color 282a36bf
  6. $ convert-color 'hsl(336, 100%, 50%)'
  7. $ convert-color 'hsla(336, 100%, 50%, 0.75)'

The CLI app will detect the format of the color you input and ask which type you’d like to convert it to:

  1. $ convert-color 'hsl(336, 100%, 50%)'
  2. Convert hsl(336, 100%, 50%) to which format:
  3. HEX
  4. RGB

Upon selecting a format, the converted value will be displayed and the result is copied to your clipboard:

  1. $ convert-color 'hsl(336, 100%, 50%)'
  2. hsl(336, 100%, 50%) converted to RGB is rgb(255, 0, 102).
  3. It has been copied to your clipboard.
  • convert-color-js - the Node module the powers this CLI. You can also use it in the browser.

License

MIT © Mike McBride