xlsx/cell-fill-pattern

A workbook applies a <patternFill> to cell A1 using each of the 16 ST_PatternType values that carry foreground/background colours, paired with five colour families.

Cases (80)

Feature IDAxis bindingspython-xlsxxlsxjs
xlsx/cell-fill-pattern--black-white--dark-downcolor=black-white, pattern=dark-downpass
xlsx/cell-fill-pattern--black-white--dark-graycolor=black-white, pattern=dark-graypass
xlsx/cell-fill-pattern--black-white--dark-gridcolor=black-white, pattern=dark-gridpass
xlsx/cell-fill-pattern--black-white--dark-horizontalcolor=black-white, pattern=dark-horizontalpass
xlsx/cell-fill-pattern--black-white--dark-trelliscolor=black-white, pattern=dark-trellispass
xlsx/cell-fill-pattern--black-white--dark-upcolor=black-white, pattern=dark-uppass
xlsx/cell-fill-pattern--black-white--dark-verticalcolor=black-white, pattern=dark-verticalpass
xlsx/cell-fill-pattern--black-white--light-downcolor=black-white, pattern=light-downpass
xlsx/cell-fill-pattern--black-white--light-graycolor=black-white, pattern=light-graypass
xlsx/cell-fill-pattern--black-white--light-gridcolor=black-white, pattern=light-gridpass
xlsx/cell-fill-pattern--black-white--light-horizontalcolor=black-white, pattern=light-horizontalpass
xlsx/cell-fill-pattern--black-white--light-trelliscolor=black-white, pattern=light-trellispass
xlsx/cell-fill-pattern--black-white--light-upcolor=black-white, pattern=light-uppass
xlsx/cell-fill-pattern--black-white--light-verticalcolor=black-white, pattern=light-verticalpass
xlsx/cell-fill-pattern--black-white--medium-graycolor=black-white, pattern=medium-graypass
xlsx/cell-fill-pattern--black-white--solidcolor=black-white, pattern=solidpass
xlsx/cell-fill-pattern--blue-yellow--dark-downcolor=blue-yellow, pattern=dark-downpass
xlsx/cell-fill-pattern--blue-yellow--dark-graycolor=blue-yellow, pattern=dark-graypass
xlsx/cell-fill-pattern--blue-yellow--dark-gridcolor=blue-yellow, pattern=dark-gridpass
xlsx/cell-fill-pattern--blue-yellow--dark-horizontalcolor=blue-yellow, pattern=dark-horizontalpass
xlsx/cell-fill-pattern--blue-yellow--dark-trelliscolor=blue-yellow, pattern=dark-trellispass
xlsx/cell-fill-pattern--blue-yellow--dark-upcolor=blue-yellow, pattern=dark-uppass
xlsx/cell-fill-pattern--blue-yellow--dark-verticalcolor=blue-yellow, pattern=dark-verticalpass
xlsx/cell-fill-pattern--blue-yellow--light-downcolor=blue-yellow, pattern=light-downpass
xlsx/cell-fill-pattern--blue-yellow--light-graycolor=blue-yellow, pattern=light-graypass
xlsx/cell-fill-pattern--blue-yellow--light-gridcolor=blue-yellow, pattern=light-gridpass
xlsx/cell-fill-pattern--blue-yellow--light-horizontalcolor=blue-yellow, pattern=light-horizontalpass
xlsx/cell-fill-pattern--blue-yellow--light-trelliscolor=blue-yellow, pattern=light-trellispass
xlsx/cell-fill-pattern--blue-yellow--light-upcolor=blue-yellow, pattern=light-uppass
xlsx/cell-fill-pattern--blue-yellow--light-verticalcolor=blue-yellow, pattern=light-verticalpass
xlsx/cell-fill-pattern--blue-yellow--medium-graycolor=blue-yellow, pattern=medium-graypass
xlsx/cell-fill-pattern--blue-yellow--solidcolor=blue-yellow, pattern=solidpass
xlsx/cell-fill-pattern--green-white--dark-downcolor=green-white, pattern=dark-downpass
xlsx/cell-fill-pattern--green-white--dark-graycolor=green-white, pattern=dark-graypass
xlsx/cell-fill-pattern--green-white--dark-gridcolor=green-white, pattern=dark-gridpass
xlsx/cell-fill-pattern--green-white--dark-horizontalcolor=green-white, pattern=dark-horizontalpass
xlsx/cell-fill-pattern--green-white--dark-trelliscolor=green-white, pattern=dark-trellispass
xlsx/cell-fill-pattern--green-white--dark-upcolor=green-white, pattern=dark-uppass
xlsx/cell-fill-pattern--green-white--dark-verticalcolor=green-white, pattern=dark-verticalpass
xlsx/cell-fill-pattern--green-white--light-downcolor=green-white, pattern=light-downpass
xlsx/cell-fill-pattern--green-white--light-graycolor=green-white, pattern=light-graypass
xlsx/cell-fill-pattern--green-white--light-gridcolor=green-white, pattern=light-gridpass
xlsx/cell-fill-pattern--green-white--light-horizontalcolor=green-white, pattern=light-horizontalpass
xlsx/cell-fill-pattern--green-white--light-trelliscolor=green-white, pattern=light-trellispass
xlsx/cell-fill-pattern--green-white--light-upcolor=green-white, pattern=light-uppass
xlsx/cell-fill-pattern--green-white--light-verticalcolor=green-white, pattern=light-verticalpass
xlsx/cell-fill-pattern--green-white--medium-graycolor=green-white, pattern=medium-graypass
xlsx/cell-fill-pattern--green-white--solidcolor=green-white, pattern=solidpass
xlsx/cell-fill-pattern--purple-white--dark-downcolor=purple-white, pattern=dark-downpass
xlsx/cell-fill-pattern--purple-white--dark-graycolor=purple-white, pattern=dark-graypass
xlsx/cell-fill-pattern--purple-white--dark-gridcolor=purple-white, pattern=dark-gridpass
xlsx/cell-fill-pattern--purple-white--dark-horizontalcolor=purple-white, pattern=dark-horizontalpass
xlsx/cell-fill-pattern--purple-white--dark-trelliscolor=purple-white, pattern=dark-trellispass
xlsx/cell-fill-pattern--purple-white--dark-upcolor=purple-white, pattern=dark-uppass
xlsx/cell-fill-pattern--purple-white--dark-verticalcolor=purple-white, pattern=dark-verticalpass
xlsx/cell-fill-pattern--purple-white--light-downcolor=purple-white, pattern=light-downpass
xlsx/cell-fill-pattern--purple-white--light-graycolor=purple-white, pattern=light-graypass
xlsx/cell-fill-pattern--purple-white--light-gridcolor=purple-white, pattern=light-gridpass
xlsx/cell-fill-pattern--purple-white--light-horizontalcolor=purple-white, pattern=light-horizontalpass
xlsx/cell-fill-pattern--purple-white--light-trelliscolor=purple-white, pattern=light-trellispass
xlsx/cell-fill-pattern--purple-white--light-upcolor=purple-white, pattern=light-uppass
xlsx/cell-fill-pattern--purple-white--light-verticalcolor=purple-white, pattern=light-verticalpass
xlsx/cell-fill-pattern--purple-white--medium-graycolor=purple-white, pattern=medium-graypass
xlsx/cell-fill-pattern--purple-white--solidcolor=purple-white, pattern=solidpass
xlsx/cell-fill-pattern--red-white--dark-downcolor=red-white, pattern=dark-downpass
xlsx/cell-fill-pattern--red-white--dark-graycolor=red-white, pattern=dark-graypass
xlsx/cell-fill-pattern--red-white--dark-gridcolor=red-white, pattern=dark-gridpass
xlsx/cell-fill-pattern--red-white--dark-horizontalcolor=red-white, pattern=dark-horizontalpass
xlsx/cell-fill-pattern--red-white--dark-trelliscolor=red-white, pattern=dark-trellispass
xlsx/cell-fill-pattern--red-white--dark-upcolor=red-white, pattern=dark-uppass
xlsx/cell-fill-pattern--red-white--dark-verticalcolor=red-white, pattern=dark-verticalpass
xlsx/cell-fill-pattern--red-white--light-downcolor=red-white, pattern=light-downpass
xlsx/cell-fill-pattern--red-white--light-graycolor=red-white, pattern=light-graypass
xlsx/cell-fill-pattern--red-white--light-gridcolor=red-white, pattern=light-gridpass
xlsx/cell-fill-pattern--red-white--light-horizontalcolor=red-white, pattern=light-horizontalpass
xlsx/cell-fill-pattern--red-white--light-trelliscolor=red-white, pattern=light-trellispass
xlsx/cell-fill-pattern--red-white--light-upcolor=red-white, pattern=light-uppass
xlsx/cell-fill-pattern--red-white--light-verticalcolor=red-white, pattern=light-verticalpass
xlsx/cell-fill-pattern--red-white--medium-graycolor=red-white, pattern=medium-graypass
xlsx/cell-fill-pattern--red-white--solidcolor=red-white, pattern=solidpass

Aggregate

LibraryPassFailPending
python-xlsx0080
xlsxjs8000

Parameter axes

Spec notes

ST_PatternType (ECMA-376 Part 1 clause 18.18.55) defines 19 pattern type values for <patternFill>. This manifest covers the 16 that accept foreground and background colours: solid, mediumGray, darkGray, lightGray, darkHorizontal, darkVertical, darkDown, darkUp, darkGrid, darkTrellis, lightHorizontal, lightVertical, lightDown, lightUp, lightGrid, lightTrellis. The three omitted values (none, gray0625, gray125) are pattern-only and do not meaningfully carry colours. Each pattern is paired with five colour families (fg/bg hex pairs). One manifest file expands into 16 x 5 = 80 concrete fixture cases. Axis ordering is alphabetised by ooxml_validate.expand_manifest, so fixture names are `<id>--<color.id>--<pattern.id>`.

Generator source

scripts/gen_cell_fill_pattern.py — runs with --arg_template --pattern {pattern.val} --fg {color.fg} --bg {color.bg} --out fixtures/xlsx/cell-fill-pattern--{color.id}--{pattern.id}.xlsx

#!/usr/bin/env python3
"""Generate a fixtures/xlsx/cell-fill-pattern--<color>--<pattern>.xlsx fixture."""
from __future__ import annotations

import argparse
import datetime as _dt
from pathlib import Path

from xlsx import Workbook
from xlsx.styles import PatternFill

_REPRODUCIBLE_DT = _dt.datetime(2000, 1, 1, 0, 0, 0)
_REPO_ROOT = Path(__file__).resolve().parent.parent


def main() -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument("--pattern", required=True)
    parser.add_argument("--fg", required=True)
    parser.add_argument("--bg", required=True)
    parser.add_argument("--out", required=True)
    args = parser.parse_args()

    out_path = Path(args.out)
    if not out_path.is_absolute():
        out_path = _REPO_ROOT / out_path

    wb = Workbook()
    ws = wb.active
    ws["A1"] = "Filled cell"
    ws["A1"].fill = PatternFill(
        patternType=args.pattern,
        fgColor=args.fg,
        bgColor=args.bg,
    )
    out_path.parent.mkdir(parents=True, exist_ok=True)
    wb.save(out_path, zip_date_time=_REPRODUCIBLE_DT)
    print(out_path)
    return 0


if __name__ == "__main__":
    raise SystemExit(main())

Manifest (parent, unexpanded)

{
  "$schema": "../manifest.schema.json",
  "id": "xlsx/cell-fill-pattern",
  "kind": "parameterised",
  "title": "Cell fill pattern (16 ST_PatternType values x 5 colour pairs)",
  "format": "xlsx",
  "category": "cell-formatting",
  "summary": "A workbook applies a <patternFill> to cell A1 using each of the 16 ST_PatternType values that carry foreground/background colours, paired with five colour families.",
  "spec": {
    "source": "ecma-376-5-part-1",
    "clause": "18.8.20",
    "element": "patternFill",
    "rnc_reference": "spec/ecma-376-5/part-1/rnc/SpreadsheetML.rnc",
    "xsd_reference": "spec/ecma-376-5/part-1/xsd/sml.xsd",
    "notes": "ST_PatternType (ECMA-376 Part 1 clause 18.18.55) defines 19 pattern type values for <patternFill>. This manifest covers the 16 that accept foreground and background colours: solid, mediumGray, darkGray, lightGray, darkHorizontal, darkVertical, darkDown, darkUp, darkGrid, darkTrellis, lightHorizontal, lightVertical, lightDown, lightUp, lightGrid, lightTrellis. The three omitted values (none, gray0625, gray125) are pattern-only and do not meaningfully carry colours. Each pattern is paired with five colour families (fg/bg hex pairs). One manifest file expands into 16 x 5 = 80 concrete fixture cases. Axis ordering is alphabetised by ooxml_validate.expand_manifest, so fixture names are `<id>--<color.id>--<pattern.id>`."
  },
  "fixtures": {
    "machine": "xlsx/cell-fill-pattern"
  },
  "generator": {
    "python": "scripts/gen_cell_fill_pattern.py",
    "arg_template": "--pattern {pattern.val} --fg {color.fg} --bg {color.bg} --out fixtures/xlsx/cell-fill-pattern--{color.id}--{pattern.id}.xlsx"
  },
  "parameters": {
    "pattern": [
      {
        "id": "solid",
        "val": "solid"
      },
      {
        "id": "medium-gray",
        "val": "mediumGray"
      },
      {
        "id": "dark-gray",
        "val": "darkGray"
      },
      {
        "id": "light-gray",
        "val": "lightGray"
      },
      {
        "id": "dark-horizontal",
        "val": "darkHorizontal"
      },
      {
        "id": "dark-vertical",
        "val": "darkVertical"
      },
      {
        "id": "dark-down",
        "val": "darkDown"
      },
      {
        "id": "dark-up",
        "val": "darkUp"
      },
      {
        "id": "dark-grid",
        "val": "darkGrid"
      },
      {
        "id": "dark-trellis",
        "val": "darkTrellis"
      },
      {
        "id": "light-horizontal",
        "val": "lightHorizontal"
      },
      {
        "id": "light-vertical",
        "val": "lightVertical"
      },
      {
        "id": "light-down",
        "val": "lightDown"
      },
      {
        "id": "light-up",
        "val": "lightUp"
      },
      {
        "id": "light-grid",
        "val": "lightGrid"
      },
      {
        "id": "light-trellis",
        "val": "lightTrellis"
      }
    ],
    "color": [
      {
        "id": "red-white",
        "fg": "FF0000",
        "bg": "FFFFFF"
      },
      {
        "id": "blue-yellow",
        "fg": "0000FF",
        "bg": "FFFF00"
      },
      {
        "id": "black-white",
        "fg": "000000",
        "bg": "FFFFFF"
      },
      {
        "id": "green-white",
        "fg": "00FF00",
        "bg": "FFFFFF"
      },
      {
        "id": "purple-white",
        "fg": "800080",
        "bg": "FFFFFF"
      }
    ]
  },
  "assertions_template": [
    {
      "id": "pattern-{pattern.id}-{color.id}",
      "part": "xl/styles.xml",
      "namespaces": {
        "x": "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
      },
      "xpath": "//x:fills/x:fill/x:patternFill[@patternType='{pattern.val}']",
      "must": "exist",
      "description": "The styles part must contain a <patternFill> with the expected ST_PatternType value."
    }
  ],
  "render_assertions_template": [
    {
      "id": "cell-text-{pattern.id}-{color.id}",
      "kind": "css_selector",
      "selector": "section.xlsx td",
      "must": "exist",
      "description": "The rendered sheet must contain the cell with the pattern fill applied."
    },
    {
      "id": "sheet-count-{pattern.id}",
      "kind": "css_selector",
      "selector": "section.xlsx",
      "must": "equal-count",
      "count": 1,
      "description": "Exactly one rendered sheet section per case. Catches renderers that emit zero sheets (hard failure)."
    }
  ]
}