Automatic color range detection

Fixes 18.