Black and White

It's very simple algorithm. The idea is to find length of RGB vector and length of biggest RGB vector (with colors 255, 255, 255) and if length of RGB vector is longer then some threshold (part of biggest RGB vector) - result color is white, black otherwise. So threshold (in percents) is needed to determine which color is black or white.