rgb now handles rgb1 colours, too.
Refactor can_only_be_decimal to use can_also_be_decimal
adding the can_also_be_decimal function

heads

tip
browse log

clone

read-only
https://hg.sr.ht/~sietsebb/showcolour
read/write
ssh://hg@hg.sr.ht/~sietsebb/showcolour
Showcolours
===========

Read a list of colours from the command-line, and display them in the browser.

Invocation:

    # red and light green
    ./showcolours.py rgb 255 0  0 128 255 128 > tmp.html && xdg-open tmp.html

    # red and light green
    ./showcolours.py rgb 1 0 0  0.5 1 0.5 > tmp.html && xdg-open tmp.html

    # red and blue
    ./showcolours.py rgb 1 0 0  0 0 1. > tmp.html && xdg-open tmp.html

    # nearly black
    ./showcolours.py rgb 1 0 0  0 0 1 > tmp.html && xdg-open tmp.html

    # red and light green again
    ./showcolours.py hex ff0000 '#88ff88' > tmp.html && xdg-open tmp.html

Run the automated test suite like so:

    py.test

Run the manual-inspection testrun like so:

    ./testrun_showcolours.sh


Sketch of future features
-------------------------

- [x] rgb:

  - [x] interpret as fractions if there is a decimal number anywhere in the
        args
            showcolour rgb 0.1 0.8 0.1  0.2 0.2 0.9
            showcolour rgb 0 1 0  1 1. 0

  - [x] interpret as 0-255 integers otherwise
            showcolour rgb 200 255 255  255 255 200

- [ ] hex:

  - [x] interpret as 'abbreviated notation' if each arg is 3 hex digits
            showcolour hex 123 12f a88

  - [x] interpret as 6-byters if each arg is 6 hex digits
            showcolour hex 112233 #1122ff aa8888

  - [ ] interpret as 12-byters if each arg is 12 hex digits
            showcolour hex 1111aaaaffff 12128900efdf

- [ ] auto:

  - [ ] hex if we see hex marks, decimal if we see decimal marks, fall back on
        rgb.

- [ ] Handle 3-digit hex colours
- [ ] Handle four-channel colours