Inspiration

People reference the colour of things all the time. People that are colourblind can be left out because of conversations or feel awkward because of this. Sometimes they might also need to identify the colour of something for practical reasons like following instructions.

I am not even colourblind but this project is useful to people like me as well. It tells the true colour of things objectively rather than a human perspective, for example when I use a blue light filter on my devices the colours can be hard to identify. I used to have it even higher and I have misidentified objects in drawing games because of it. This project also allows people to settle their disputes around what colour something is, possibly because its an in between colour or because it is viewed differently by different people psychologically like the infamous dress photo.

Eyedropper tools exist in many places but they usually only give the hexcode or RGB values which are not useful outside of programs, especially to regular people.

What it does

My project detects the colour of the pixel the cursor is point at by taking a screenshot and finds the colour based on a list of predefined colour RGB definitions. It notifies the user of the colour in word form instead of hexcode or RGB. Users can configure in the attached text file whether they want to use basic/detailed colour definitions as well as the key to activate the code.

How we built it

I built it using Python and the following libraries; pyautogui, pymsgbox, keyboard. I took the colour definitions from here.

Challenges we ran into

I had many constraints to work with on this project. I was very limited on time since I arrived late and I had to work on school assignments during the event. I also worked alone since my friends didn't want to join the event and I was arriving late so I didn't want to cause problems for the strangers I would be paired up with. I'm also a lot less knowledgeable and experienced than other programmers at the competition. These constraints caused me to have to make very conservative design decisions.

I wanted to make the project in a lower level language such as C so it would be very optimized. I do have experience using C but I opted to make it in Python. Python allowed me to have easy access to a lot of easy to use libraries as well as not having to worry about implementation details such as string manipulation, formatting or pointers given the constraints on the project. For the same reasons the mechanics of the project are simple.

I also spent a lot of time trying to install the required packages (tried on multiple systems) and looking at alternatives. There were many issues installing pyautogui when I was on Python 3.8 which other people had online but the few solutions available did not work for me. I got it to work by installing Python 3.9.10, Pillow 10.0.0, pyautogui 0.9.53 and PyScreeze 0.1.28 in that order (keyboard package installed every time).

I also thought a lot about calculating which colour would be closest to the detected colour. The 3D Euclidian distance needs to be calculated between the detected colour and every single predefined colour and this has to be calculated on the spot. I did manage to optimize the algorithm by a constant amount but I wish I could have gone further but that would be well above my level. The sqrt in the distance calculation can be omitted since sqrt is a bijective strictly increasing function, the non-sqrt values will rank the same comparatively, I also think sqrt is an expensive computation opposed to simple operators. The computation is still more expensive than I'd like including the screenshot to detect pixel colour so I opted to run the code on key press instead of having it run constantly like I originally imagined.

Accomplishments that we're proud of

I am glad I fully finished the project in time maintaining the key features I was aiming for from the beginning. I also think I optimized it as much as I could given my level and using Python. I also think it was implemented decently.

What we learned

I learned to make effective and realistic design decisions as well as how to troubleshoot package installation which is a problem I run into whenever I start a project. I also learned how to manage my time properly across multiple tasks as well as improving independent working skills.

What's next for Colour Identifier

If I had more time to work on this project I would like to re-implement everything in a lower level language such as C. I would also like to improve the UX, originally I had the idea to have an indicator around the cursor or a stationary GUI but I saved time by opting not to go those routes.

Built With

  • keyboard(library)
  • pyautogui
  • pymsgbox
  • python
Share this project:

Updates