Update templates and the template-generator script.

- Add linear-gradient in the chocolate template
- Add "Tisane de Noël" template
- Add the logic to populate the gradient colors in the script
- Add template definition in the products definitions csv
This commit is contained in:
2025-12-04 17:55:38 +01:00
parent a608e41c6a
commit 97480dedb0
4 changed files with 1604 additions and 53 deletions

View File

@@ -22,6 +22,7 @@ templates = {
'pesto': f"{TEMPLATES_DIR}/Pesto.svg",
'sirop': f"{TEMPLATES_DIR}/Sirop.svg",
'tisane': f"{TEMPLATES_DIR}/Tisane.svg",
'tisanenoel': f"{TEMPLATES_DIR}/Tisane Noël.svg",
'sel': f"{TEMPLATES_DIR}/Sel.svg",
}
@@ -50,11 +51,21 @@ def main():
ingredients = [e if not e.startswith('*') else ALLERGEN_BEGIN_STYLE + e[1:] + ALLERGEN_END_STYLE for e in ingredients]
ingredients_sub = ", ".join(ingredients)
AB_logo_visibility = 'inline' if row[6] == 'True' else 'none'
# Set the 4 linear-gradient stop colors if they are set in the csv, otherwise default to the template's background color
if 7+4 <= len(row):
gradient_color0, gradient_color1, gradient_color2, gradient_color3 = row[7:7+4]
else:
gradient_color0 = gradient_color1 = gradient_color2 = gradient_color3 = row[4]
subs = {
'designation': row[1].strip(),
'ingredients': ingredients_sub,
'description': row[3].strip(),
'color': row[4],
'gradient_color0': gradient_color0,
'gradient_color1': gradient_color1,
'gradient_color2': gradient_color2,
'gradient_color3': gradient_color3,
'AB': AB_logo_visibility,
'designation_fontsize': JAM_DESIGNATION_FONTSIZE_DEFAULT,
}