Natural food dyes are gaining in popularity over petroleum-based synthetic dyes (artificial food coloring) for many reasons — health, sustainability and (most important) the beautiful colors that nature provides.
I love baking shows (don’t we all?) and enjoy seeing what food ingredients are used to dye cake batters and frostings. I looked into natural food dyes and decided to store my findings in a Wolfram Language entity store. Here’s how I did it.
I love baking shows (don’t we all?) and enjoy seeing what food ingredients are used to dye cake batters and frostings. I looked into natural food dyes and decided to store my findings in a Wolfram Language entity store. Here’s how I did it.
Colors
Colors
First, I chose colors popular in baking, particularly for birthday cakes and other celebration treats:
In[]:=
Interpreter["Color"][{"Pink","Red","Orange","Yellow","Purple","Green","Brown"}]
Out[]=
{,,,,,,}
The neon yellow and green are perfect for a vibrant Mardi Gras king cake, but I decided to use ColorData to choose softer hues:
In[]:=
Interpreter["Color"][{"Pink","Red","Orange",ColorData["HTML","Gold"],"Purple",ColorData["HTML","ForestGreen"],"Brown"}]
Out[]=
{,,,,,,}
Foods
Foods
Next, I determined what foods would provide these colors and retrieved those food entities from the Wolfram Knowledgebase:
In[]:=
foodEntities=Interpreter["Food"][{"beets","raspberries","pomegranate juice","carrot juice","paprika","turmeric","blueberry juice","spinach","avocado","cinnamon"}]
Amounts
Amounts
I used LLMSynthesize to provide estimates of the amount of each food needed to dye 1 cup of frosting:
In[]:=
LLMSynthesize["How much raspberry puree do I use to dye 1 cup of white frosting pink? Please provide a concise answer. It's okay to estimate."]
Out[]=
Start with about 2 tablespoons of raspberry puree and adjust to reach your desired color.
As the LLM reminded me, the amount will vary depending upon the color I want — a subtle shade or a bold, bright pink.
Calories
Calories
Using the estimated amounts, I retrieved the calories for each food from the Wolfram Knowledgebase:
In[]:=
EntityValueEntityInstance,,"AbsoluteTotalCaloriesContent"
Out[]=
Pigments
Pigments
In[]:=
pigmentFinder=LLMFunction["name of the primary pigment in `1`"]
Out[]=
LLMFunction
In[]:=
pigmentFinder[{"beets","raspberries","pomegranate juice","carrot juice","paprika","turmeric","blueberry juice","spinach","avocado","cinnamon"}]
Out[]=
beets - Betaninraspberries - Anthocyaninspomegranate juice - Anthocyaninscarrot juice - Beta-carotenepaprika - Capsanthinturmeric - Curcuminblueberry juice - Anthocyaninsspinach - Chlorophyllavocado - Chlorophyllcinnamon - Cinnamaldehyde
Molecules
Molecules
I used each pigment’s SMILES string to display its molecule structure with MoleculePlot3D. This is betanin, the pigment in beets:
In[]:=
MoleculePlot3D[Molecule["C1[C@H](N=C(C=C1/C=C/N2[C@@H](CC3=CC(=C(C=C32)O)O[C@H]4[C@@H]([C@H]([C@@H]([C@H](O4)CO)O)O)O)C(=O)O)C(=O)O)C(=O)O"]]
Out[]=
Entity Store
Entity Store
I compiled all of my data into an EntityStore that I can use as a reference now and continue to expand in the future:
customEntityStore=EntityStore
Out[]=
EntityStore
I registered my new “NaturalFoodDyes” entity store, then checked for the entities and properties I created:
In[]:=
EntityRegister[customEntityStore]
Out[]=
{NaturalFoodDyes}
In[]:=
EntityList["NaturalFoodDyes"]
Out[]=
,,,,,,,,,
In[]:=
EntityProperties["NaturalFoodDyes"]
Out[]=
,,,,
Dataset
Dataset
I was ready to display my new entity store as a dataset:
In[]:=
Labeled[EntityValue["NaturalFoodDyes","Dataset"],"To Dye 1 Cup White Frosting",Top]
Out[]=
To Dye 1 Cup White Frosting |
Examples
Examples
With my entity store complete, I began retrieving and visualizing the natural food dye entities and properties.
Retrieved all associations for a named property:
Found entities with a specific property value:
Retrieved the amounts and calories for a sample of food dyes:
Created a plot of the calories to dye 1 cup frosting, matching the color of the data points to their dye color:
Retrieved pigments and their 3D molecule structures:
Conclusion
Conclusion
Have ideas for building your own food and nutrition entity store? There are many great topics to explore. I’m considering food preservatives, thickeners and emulsifiers. What about vitamins and minerals? I look forward to seeing what you create!
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Pretty in pink: creating an Entity Store of natural food dyes
by Gay Wilson
Wolfram Community, STAFF PICKS, April 10, 2024
https://community.wolfram.com/groups/-/m/t/3156436
by Gay Wilson
Wolfram Community, STAFF PICKS, April 10, 2024
https://community.wolfram.com/groups/-/m/t/3156436
