Custom Palette color key value

Hello,
I would like to create a chart with Plot and use a custom color palette to assign colors based on the values of my data properties (notebook here, you can unfold code). I applied the method below, which works but seems a bit contrary to the elegance and conciseness of Observable. I must be missing a concept, and I’d love to hear your ideas !

My code :

colorPalette = { return {
  "Ménage par an – effet nouvelle population": "#A6CEE3",  // Bleu pastel
  "Ménage par an – effet déformation pyramide des âges": "#CAB2D6",  // Violet pastel
  "Ménage par an – effet évolution des modes de cohabitation": "#B2DFDB",  // Cyan pastel
  "Renouvellement par an": "#FB9A99",  // Rouge pastel
  "Vacance par an": "#FFEB99",  // Jaune pastel
  "Résidences Secondaires et Logts Occasion. par an": "#B2DF8A"  // Vert pastel
}};

Plot.plot({
  color: {legend: true, domain: Object.keys(colorPalette), range: Object.values(colorPalette)},
  marks: [
    Plot.barY(data_long_ojs.filter(d => d.effet != "Moyenne annuelle Demande Potentielle ménages"), {
      x: "Libellé zonage", 
      y: "valeur", 
      fill: "effet", 
      tip: true
    }) 
  ]
})

It looks good. You can always do it more concisely, but that’s the idea.