A method and apparatus for calculating a composition for a preparation for treating hair fibers. The method comprises: obtaining (330) a target specification, wherein the target specification comprises one or more numerical parameters defining a desired appearance of the hair fibers; providing (340) a first computational model that relates a composition of a preparation to a predicted appearance of the hair fibers when treated by that preparation; and calculating (350), using the first computational model and the target specification, a composition for the preparation that is predicted to produce, if the hair fibers are treated with the preparation, an appearance similar or identical to the desired appearance