Train a classifier to differentiate between dark and light colors.
A machine learning classifier is a function that classifies objects. It is created by training on a set of examples rather than by explicit programming. Training data can be numerical, textual, sounds and images, as well as combinations of these.
Collect training examples
Get a color from its hexadecimal RGB color value:

Get some dark colors:

Get some light colors:

Construct a training set where each training value is assigned the correct class:

Train a classifier
Use the training set to train a classifier:

Test the classifier
Give the classifier a new color. It will infer, based on the training data, how to classify the color:

Get the classifier’s degree of confidence in what it has inferred, expressed as the probabilities of membership in each class:

Classify a list of colors:

Get information about the classifier
Get a report of the properties of the classifier:
