///|
pub fn BrandBook::to_accessibility_markdown(self : BrandBook) -> String {
  let lines : Array[String] = [
    "## Accessibility", "", "Contrast reference: ink on paper", "", "| Foreground | Background | Ratio | Grade |",
    "| --- | --- | ---: | --- |",
  ]
  for foreground in self.palette.colors {
    for background in self.palette.colors {
      if foreground.name != background.name &&
        (foreground.name == "ink" || foreground.name == "body") &&
        (background.name == "paper" || background.name == "surface") {
        let pair = foreground.contrast_against(background)
        lines.push(
          "| " +
          foreground.name +
          " | " +
          background.name +
          " | " +
          pair.ratio_x100.to_string() +
          " | " +
          pair.grade.label() +
          " |",
        )
      }
    }
  }
  if lines.length() == 4 {
    lines.push("| (none) | (none) | - | review required |")
  }
  lines.join("\n")
}

///|
pub fn Palette::contrast_pairs(self : Palette) -> Array[ContrastPair] {
  let pairs : Array[ContrastPair] = []
  for foreground in self.colors {
    for background in self.colors {
      if foreground.name != background.name {
        pairs.push(foreground.contrast_against(background))
      }
    }
  }
  pairs
}