Iro started out as an Android app created at FashionTechHackathon 2018 at Kent State University’s Fahsion School. Based on professional color palettes, Iro tells you if 2 colors match or not. I also created a hardware prototype for Iro at the University of Chicago’s Uncommon Hacks 2018, where I built a wearable bracelet with a Lilypad Arduino and color sensors that can make recommendations after sensing colors by flashing LEDs.

Influenced by the large amount of time I spend in the morning choosing what to wear, I created Iro (meaning ‘color’ in Japanese) to solve this problem.

The first manifestation of Iro is an android app. You can use it to pick 2 colors and Iro will let you know if they fit or not, based on professionally chosen color palettes. I would also considered using other methods to choose color matching, such as color wheels, looking at complementary and paired palettes, etc. But eventually decided to choose palettes from fashion professionals.

You can try out Iro yourself by downloading it from Github and running it on your android phone or your laptop using Android Studio

The second incarnation of Iro is a wearable bracelet that senses colors and decides whether they match. The rest of this article is a tutorial on how to make such as wearable device.


First, create a list of color palettes. A set makes the most sense as the data structure to hold a palette in, since sets (and palettes) cannot have repeated items, and set lookups in Python are much faster (\(O(1)\) rather than \(O(n)\) in lists).

palette1 = {'purple', 'violet', 'black', 'yellow', 'white'}
palette2 = {'teal', 'brown', 'navy', 'grey'}
palettes = [palette1, palette2]

When the color sensor detects light, it returns a hex triplet representation of the color. The number of combinations one could have is then \(2^{24}\) or \(16,777,216\) colors; so representing them all in palettes is unrealistic. I decided to use only colors that have names (i.e. violet, teal, green, red, etc.). Luckily, I found webcolor, a python library that has a large number of named colors and their hexcode representation.

Now the only ingredient left is to find the closest named color to the one returned by the color sensor. In this case, we convert the hexcode color to RGB and then use a k-dimensional tree to find the closest neighbour in the 3-dimensional space (the three dimensions being red, green and blue) that is a ‘named’ color in webcolors. In python, this is done using this function:

import webcolors
from scipy.spatial import KDTree

def findColor(hexcode):
    hexnames = webcolors.css3_hex_to_names
    names = [name for name in hexnames.values()]
    positions = [webcolors.hex_to_rgb(hex) for hex in hexnames.keys()]
    spacedb = KDTree(positions)

    # query nearest point
    querycolor = (webcolors.hex_to_rgb('#'+str(hexcode)))
    dist, index = spacedb.query(querycolor)

    return names[index]

Finally, connecting the arduino to a computer using a serial port (e.g. usb cable, but also planning to make this wireless), we can use the following code to sense the colors and return the matching status:

# open up a serial connection to the arduino
import serial
arduino = serial.Serial('/dev/cu.usbmodem269', 9600, timeout=.1)

cols = {}  # a set of colors eventually detected
while True:
    # get data from arduino, for each measurement, it comes in the form:
    # 'lux'
    # 'hexcode'
    data = arduino.readline()
    lux, hexcode = data.split('\n')

    # set a threshold, so only colors at small distances are used
    if lux > 2000:
        # find color from hexcode
        colorname = findColor(hexcode)

    # create a list of detected colors
    for col in set(palettes):
        if col in colorname:
            colorname = col

    # check if detected colors are in the same palette
    for palette in palettes:
        if cols.issubset(palette):
            print('your sense of fashion is ok~')
            print('are you sure? hmmm')

In the future, I’d like to expand this so that it uses bluetooth rather than a usb cable, and to sew it using conductive thread to LEDs, so that it can give feedback on whether colors match using LEDs rather than text (e.g., a green color if 2 colors match), which is something I prototyped at Uncommon Hacks 2018

© Husni Almoubayyed 2018. All rights reserved.