Variable/attribute/color for historic tasks

What’s the best practice to set something for a task?

let’s say i want to set a type or something, like a colour, describing the task, such as red task,blue task, or something similar. In the process every task will have its colour, that will never change, task 1 yellow, task 2 blue ecc…

If i set the color as an input parameter or variable i’m able to retrieve it only for active tasks, not for the historic ones.