+ Add Question

API: Color

I am trying to get the color of a project but it comes in Integer format. I was waiting for something like HEX or RGB.

Anyway, what is this Integer and how do I get the color HEX of some project?

All responses

David Trey  staff
Replied on Mar 27, 2013 - 12:26 UTC

Hello Richard,

Todoist has a fixed amount of colors which you can pick for a project (we don't have a free color picker) and therefore each color is a number from 0 to 21. Please right-click on a project and see what colors are available and they're numbered as they are displayed there from 0 in the top-left corner followed by 1 - the next one to the right and so on.

Best regards,

Vitaly Kondratiev  premium
Replied on Dec 24, 2014 - 15:31 UTC

this is how I convert it in JS

var colorConverter = function (colorIndex) {
var todoistColors = [
'#95EF63', '#FF8581', '#FFC471', '#F9EC75', '#A8C8E4',
'#D2B8A3', '#E2A8E4', '#CCCCCC', '#FB886E', '#FFCC00',
'#74E8D3', '#3BD5FB', '#DC4FAD', '#AC193D', '#D24726',
'#82BA00', '#03B3B2', '#008299', '#5DB2FF', '#0072C6',
'#000000', '#777777'

return todoistColors[colorIndex] || '#95EF63';

Aaron Broder
Replied on May 14, 2015 - 21:59 UTC

@David: It would be nice if there were a way get the hex value from the API (either directly on the project, or from a colors endpoint) so that we don't have to worry about the colors changing out from underneath us.