Set Todoist Label Colors Automatically Using OpenAI Embeddings

By . Updated on

An abstract painting of the Todoist color palette

From the department of things I wouldn't have bothered with a year ago, here's a python script to set Todoist label colors.

Why? I like a productivity environment with some color and flare, and it also helps to visually recognize what a task relates to. But setting label colors is more clicks than I have patience for.

How? Just figure out embeddings for each available color and then for each label. Use cosine similarity to set the color that best suits each label. Colors will stay consistent for existing labels and new ones will get just a dash of semantic meaning in their assignments.

Here's the code (you need an OpenAI API key and a Todoist API token set as environment variables):

Updated 2026-03-07 03:28:

I have been wondering what a Cadillac version of this silly project would look like. The current version gives me colors, but not based on a lot of meaning. I also have to remember to find and run the python script when I add a new label. So I refactored this to run in Google Apps Script and to try and make those colors mean something. This is a two step process. First, the script uses GPT 5.4 to generate a description of each color including cultural significance and the kinds of tasks it might be associated with. Embeddings for these descriptions are cached. Second, the script loads three tasks for each label and finds the most similar color embedding for the sample tasks.

The script is scheduled to run weekly so I don't need to remember to do anything, always a big win.

It might end up being irritating as label colors will change over time. This might convey a subtle sense of what the label currently means, or it might just make it harder to remember the associations. Too soon to tell. In case this is ever helpful to anyone here's the code:

Robert Ellison's blog, I Thought He Came With You, on the Fediverse via fed.brid.gy. Photography, time lapse, programming, politics, hikes and more.

Add Comment

All comments are moderated. Your email address is used to display a Gravatar and optionally for notification of new comments and to sign up for the newsletter.