Examples¶
Import to your project¶
For almost all cases, call the new()
factory function,
then get the colour value from the color()
method:
import WhatColorIsX
brick = WhatColorIsX.new('brick')
brick_color = brick.color()
fish = WhatColorIsX.new('fish')
fish_color_bright = fish.color(bright_hue=True)
If you already have PIL images that you want to process, you can use the same syntax:
from WhatColorIsX import whatcoloris_image
from PIL import Image
img = Image.open('images/cat.jpg')
cat = WhatColorIsX.new(img)
cat_color = cat.color()
Run from the command line¶
Use the whatcoloris command:
$ whatcoloris sky
#769ab8
$ whatcoloris images/dog.png
#6c5a47
$ whatcoloris grass -b
#65ff00
Visual Demo¶
Using this python script, a folder of image files can be composited along with their calculated colours. The main function of WhatColorIsX is to do this without a source image, using only a string.
See an example output here.