返回资讯中心
外部精选
软件工程
#开发者实时流

开发者用 YAML 配置像写 Matplotlib 绘图一样生成菜品摆盘

来源标题:Show HN: Edit menu food arts like a Matplotlib plot

有人在 Hacker News 的 Show HN 板块展示了一种用 YAML 描述菜品摆盘的方法,食材位置和数量以类似 Matplotlib 绘图参数的坐标形式指定。示例中 Margherita 披萨用 r 值范围定位 7 块 mozzarella,Greek 沙拉则通过 slots 规则在指定 lane 上排列黄瓜、番茄等配料,并支持份量和食材替换选项。

Hacker News 最新fireflysentinel2026/11/12 · 5 天前11 分钟阅读

以下正文由 AI 翻译自 Hacker News 最新(原文版权归原站所有),可能存在偏差,重要内容请以原文为准。

name: Margherita seed: 11 base: {type: pizza, size: 290} toppings: # 从下到上

  • tomato_sauce
  • mozzarella: {count: 7, place: {r: [0.08, 0.86]}}
  • cut: {slices: 8}
  • drizzle: {kind: olive_oil, amount: 0.7, width: 2.4}
  • basil: {count: 5, place: {r: [0.05, 0.8]}} greek.yaml name: Greek id: greek seed: 5 base: {type: salad_bowl, glaze: indigo, inside: porcelain} toppings:
  • greens: {kind: romaine, cut: chopped, amount: 0.9}
  • cucumber: {cut: half_moon, count: 6, place: {rule: slots, lane: 4, start: 2}}
  • tomato: {cut: wedge, count: 6, place: {rule: slots, lane: 0, start: 0}}
  • bell_pepper: {cut: ring, count: 3, color: green, place: {rule: slots, lane: 3, start: 5}}
  • red_onion: {cut: ring, count: 4, size: 32, place: {rule: slots, lane: 5, start: 0}}
  • olive: {cut: half, count: 7, kind: black, place: {rule: slots, lane: 2, start: 4}}
  • feta: {cut: cube, count: 7, place: {rule: slots, lane: 8, start: 3}}
  • oregano: {count: 40} options: portion: regular: [] large: {portion: {size: 240, scale: 1.4}} olives: black: [] green: [{set: olive.kind, to: green}] tomato: wedges: [] cherry: [{swap: tomato, use: cherry_tomato, cut: half}] # swap 会保留 count、lane 和 start:位置不变 select: {portion: regular, olives: black, tomato: wedges} mazesoba.yaml

Mazesoba:粗面条,不带汤,底下有少量酱汁,配料围绕生蛋黄摆放,食用时拌匀。

name: Mazesoba id: mazesoba seed: 72 base: {type: ramen_bowl, size: 205, glaze: porcelain, pattern: raimon, trim: indigo, fill: 0.62} toppings:

  • noodles: {kind: thick, amount: 1.0, submerged: false, heading: 12}
  • nira: {count: 24, place: {at: [10.5, 0.58], spread: 15}}
  • negi: {count: 44, cut: ring, green: 0.9, place: {at: [1.5, 0.60], spread: 16}}
  • kizami_nori: {count: 32, place: {at: [4.6, 0.60], spread: 14}}
  • menma: {count: 5, place: {at: [7.6, 0.62], angle: 84}}
  • soboro: {count: 85, spicy: true, place: {at: [12, 0.0], spread: 25}}
  • egg_yolk: {count: 1}
  • sesame: {count: 40} options: portion: regular: [] large: [{set: noodles.amount, to: 1.3}] spice: 0: [{set: soboro.spicy, to: false}] 1: [] 2: [{add: {rayu: 1.6}, after: noodles}] select: {portion: regular, spice: 1} extras: pork: {add: {use: chashu, id: extra_pork, count: 7, cut: dice, place: {rule: cluster, at: [6.1, 0.34], spread: 15}}, after: menma} egg: {add: {use: ajitama, id: extra_egg, count: 2, cut: half, place: {rule: at, points: [[2.9, 0.62], [12.2, 0.66]], align: tangent}}, after: kizami_nori} hold: [egg_yolk] labels: {egg_yolk: 生蛋黄, egg: 卤蛋, pork: 叉烧丁} description: "无汤粗面,辣味肉末、韭菜、葱花、海苔丝、笋干" # 菜品本身的菜单描述;网站会在其后追加客人所选的选项 menu_cake_v06_victoria_sponge__dusting+strawberry+mint__regular.yaml name: Victoria Sponge seed: 12 base: type: cake_whole ... size: 168 ... layers: # 从下到上
  • {sponge: vanilla, h: 34}
  • {jam: strawberry, h: 4}
  • {cream: whipped, h: 13}
  • {sponge: vanilla, h: 34} under: {type: cake_stand} toppings:
  • dusting: {kind: sugar, amount: 1.0}
  • strawberry: {count: 5, cut: half, size: 29, place: {rule: heap, at: [12, 0.0], spread: 46, sink: 2}}
  • mint: {count: 1, place: {rule: at, points: [[4, 0.2]]}} glazed.yaml

糖霜甜甜圈:酵母发酵的甜甜圈,裹上一层薄薄的糖霜。面团透过糖霜若隐若现。

name: Glazed Ring id: glazed seed: 3 base: {type: donut, size: 96, shape: ring, dough: yeast, fry: 0.5} toppings: # 从下到上

  • icing: {kind: sugar, amount: 1.0, drips: 0.3} options: icing: {sugar: [], chocolate: [{set: icing.kind, to: chocolate}, {set: icing.amount, to: 0.8}], maple: [{set: icing.kind, to: maple}, {set: icing.amount, to: 0.8}]} select: {icing: sugar} extras: # 客人可以加点的小料 sprinkles: {add: {sprinkles: {count: 64}}} nuts: {add: {chopped_nuts: {count: 36, kind: almond}}} labels: {sprinkles: 彩虹糖针, nuts: 杏仁碎} description: "轻盈的酵母发酵甜甜圈" # 单品本身的菜单描述;网站会在其后追加客人所选的选项 choice_labels: {icing: {sugar: 糖霜, chocolate: 巧克力糖衣, maple: 枫糖糖衣}} # 每个选项在印刷菜单上的显示名称 As Served Text set in Plus Jakarta Sans (SIL Open Font License, licence).

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →