rrggbb-to-vtrgb

Transform HTML-style color codes into three lines of comma-separated decimal number, suitable for vtrgb. (man 1 setvtrgb)

Usage no npm install needed!

<script type="module">
  import rrggbbToVtrgb from 'https://cdn.skypack.dev/rrggbb-to-vtrgb';
</script>

README



rrggbb-to-vtrgb

Transform HTML-style color codes into three lines of comma-separated decimal number, suitable for vtrgb. (man 1 setvtrgb)

API

This module exports one function:

vtrgb(colors)

colors should be an array or string with color codes in RRGGBB hexadecimal format. Color codes may optionally be prefixed with # (U+0023 number sign). The string can use space and/or comma as separator.

Returns an array [r, g, b], where r is a string that consists of each color's red component, glued together with commas. g is likewise for the green components, and b for the blue components.

Usage

see the tests.

Known issues

  • Needs more/better tests and docs.

 

License

ISC