diff --git a/README.md b/README.md index 88a9451..873ec64 100644 --- a/README.md +++ b/README.md @@ -15,4 +15,5 @@ validates inputs, and exports authored YAML as JSON. See the [CLI contract](docs/build-cli.md) for commands and output behavior, the [plugin guide](docs/plugins.md) to add a renderer, and the [authored report contract](docs/report-contract.md) for report input. The -`AGENTS.md` file is a short implementation manifest for coding agents. +[palette catalog](visual/README.md) lists the themes available to both plugins. +The `AGENTS.md` file is a short implementation manifest for coding agents. diff --git a/docs/build-cli.md b/docs/build-cli.md index b7ad5d5..de4ebc7 100644 --- a/docs/build-cli.md +++ b/docs/build-cli.md @@ -14,7 +14,7 @@ directory and move the completed PDF into place. and writes PDFs beneath `DIR`, preserving each input's relative path and replacing its extension with `.pdf`. It rejects an output inside the input tree. `--force` is forwarded to each render. Diagnostic rendering also accepts -`--author` and `--theme` (`default`, `cic`, `eridani`). +`--author` and `--theme` (a name from [the palette catalog](../visual/README.md)). `analyze` and `analyze-all` produce normalized diagnostic evidence JSON. They require an evidence root, reference time, and producer version. `validate` diff --git a/docs/report-contract.md b/docs/report-contract.md index 8e081e2..35e51ff 100644 --- a/docs/report-contract.md +++ b/docs/report-contract.md @@ -3,8 +3,8 @@ The report plugin accepts YAML or JSON dictionaries. `metadata.Date` and `metadata.Author` are required. The document model supports report-specific fields such as `diagnostics` as well as ordinary sections, findings, actions, -and appendices. Named themes are `default`, `cic`, and `eridani`; a custom theme -dictionary can be provided. The renderer is `plugins/report/`. +and appendices. Named themes are listed in [the palette guide](../visual/README.md); +a custom theme dictionary can also be provided. The renderer is `plugins/report/`. The diagnostic plugin has a separate raw WinDiagnostics input and its own Typst document model. Both plugins import `reporter/visual/elements.typ` for graphical diff --git a/plugins/diagnostics/README.md b/plugins/diagnostics/README.md index a66c4b7..5290b3c 100644 --- a/plugins/diagnostics/README.md +++ b/plugins/diagnostics/README.md @@ -10,7 +10,7 @@ model. From the Reportist repository root: ./build.sh render diagnostic /path/to/capture.json --output diagnostic.pdf --author 'Reviewer' --theme cic ``` -Themes are `default`, `cic`, and `eridani`. +Named themes are listed in [the palette catalog](../../visual/README.md). `./build.sh analyze` produces normalized diagnostic JSON v1 with evidence pointers when needed. Its output is independent of the source-faithful PDF. diff --git a/plugins/diagnostics/render.sh b/plugins/diagnostics/render.sh index 9212257..98e63ed 100755 --- a/plugins/diagnostics/render.sh +++ b/plugins/diagnostics/render.sh @@ -5,7 +5,7 @@ root=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P) source "$root/../../tools/render-common.sh" visual_root=$root/../../visual usage() { - echo "Usage: $0 CAPTURE.json --output PDF [--author NAME] [--theme default|cic|eridani] [--force]" >&2 + echo "Usage: $0 CAPTURE.json --output PDF [--author NAME] [--theme NAME] [--force]" >&2 exit 2 } fail() { @@ -17,7 +17,6 @@ input=${1:-} shift reportist_parse_render_options diagnostic "$@" || usage output=$RENDER_OUTPUT_OPTION author=$RENDER_AUTHOR theme=$RENDER_THEME force=$RENDER_FORCE -[[ "$theme" == default || "$theme" == cic || "$theme" == eridani ]] || fail "unknown theme: $theme" [[ -n "$author" ]] || fail "author is required" [[ ! -L "$input" ]] || fail "input symlinks are not supported" reportist_prepare_render_paths "$input" "$output" "$force" || exit 1 diff --git a/tests/test_plugin.py b/tests/test_plugin.py index bc4cf80..4202e14 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -7,6 +7,26 @@ ROOT = Path(__file__).resolve().parents[1] class ReportPluginTests(unittest.TestCase): + def test_new_palettes_render_in_both_plugins(self): + palettes = ("warm", "steel", "bw", "high-contrast", "yon-sen", "steingrund", "draan") + capture = ROOT / "plugins/diagnostics/tests/fixtures/legacy/windiagnostics-v1.json" + source = (ROOT / "examples/example-report.yaml").read_text() + with tempfile.TemporaryDirectory() as directory: + work = Path(directory) + for theme in palettes: + with self.subTest(theme=theme): + report = work / f"{theme}.yaml" + report.write_text(f"theme: {theme}\n" + source) + for kind, input_path in (("report", report), ("diagnostic", capture)): + output = work / f"{theme}-{kind}.pdf" + arguments = [str(ROOT / "build.sh"), "render", kind, str(input_path), + "--output", str(output)] + if kind == "diagnostic": + arguments.extend(("--theme", theme)) + result = subprocess.run(arguments, text=True, capture_output=True) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertTrue(output.read_bytes().startswith(b"%PDF-")) + def test_public_cli_renders_diagnostic_from_standalone_checkout(self): fixture = ROOT / "plugins/diagnostics/tests/fixtures/legacy/windiagnostics-v1.json" with tempfile.TemporaryDirectory() as directory: diff --git a/visual/README.md b/visual/README.md new file mode 100644 index 0000000..80bc4c0 --- /dev/null +++ b/visual/README.md @@ -0,0 +1,42 @@ +# Built-in color palettes + +Both Reportist plugins read `themes.yaml`. The original `default`, `cic`, and +`eridani` palettes are unchanged. Seven additional color-only palettes were +adapted from [Ravenous `themes.typ`](https://proxy.dandaedre.com/gitea/Ravenous/ravenous_typst/raw/branch/candlelight/setup/theme/themes.typ): + +| Name | Character | +| --- | --- | +| `warm` | parchment, oxblood, and muted gold | +| `steel` | cool gray and blue | +| `bw` | grayscale | +| `high-contrast` | white, dark blue, and red | +| `yon-sen` | warm paper, vermilion, and indigo | +| `steingrund` | cool gray, burgundy, and slate blue | +| `draan` | violet and mineral teal | + +Only colors were adapted. The source file's fonts, heading numbering, symbols, +progress glyphs, attack categories, and layout rules are not part of these +Reportist themes. Existing plugins keep their document structure and font +choices. The source's `ink`, muted ink, border, light parchment, and heading +colors map to Reportist's `ink`, `muted`, `line`, `paper_soft`, and `accent`. +`info`, `warning`, `critical`, and `success` use legible colors chosen from the +same palette. Some monochrome or single-hue palettes intentionally reuse a hue +for more than one status; status text remains explicit. + +An authored report selects a name in its YAML or JSON: + +```yaml +theme: warm +``` + +A diagnostic selects the same catalog at render time: + +```bash +./build.sh render diagnostic capture.json --output diagnostic.pdf --theme warm +``` + +The diagnostic plugin also reads `DIAGNOSTICS_THEME` when `--theme` is omitted. +The report plugin continues to accept a custom theme dictionary in its source. +Add new named palettes to `themes.yaml`, keep all required Reportist color keys, +and verify both plugins can render them. Existing palettes are regression +baselines; do not change their values casually. diff --git a/visual/themes.yaml b/visual/themes.yaml index 9376772..677770f 100644 --- a/visual/themes.yaml +++ b/visual/themes.yaml @@ -39,3 +39,104 @@ eridani: warning: "#8a6829" critical: "#813f32" success: "#49683a" + +# Color-only adaptations of Ravenous themes.typ. The Reportist font, layout, +# symbols, and document models stay with their plugins. The source palettes are +# at https://proxy.dandaedre.com/gitea/Ravenous/ravenous_typst/raw/branch/candlelight/setup/theme/themes.typ +warm: + label: "Warm" + font: "DejaVu Sans" + mono_font: "DejaVu Sans Mono" + ink: "#302c26" + muted: "#716957" + line: "#c9bda4" + paper_soft: "#fbf9f3" + accent: "#7A2424" + info: "#486A73" + warning: "#70582f" + critical: "#7A2424" + success: "#687447" + +steel: + label: "Steel" + font: "DejaVu Sans" + mono_font: "DejaVu Sans Mono" + ink: "#292B32" + muted: "#626873" + line: "#B8C2CC" + paper_soft: "#F7F9FA" + accent: "#526D85" + info: "#465A72" + warning: "#465A72" + critical: "#526D85" + success: "#465A72" + +bw: + label: "Black and White" + font: "DejaVu Sans" + mono_font: "DejaVu Sans Mono" + ink: "#202020" + muted: "#666666" + line: "#b5b5b5" + paper_soft: "#fafafa" + accent: "#202020" + info: "#484848" + warning: "#707070" + critical: "#444444" + success: "#666666" + +high-contrast: + label: "High Contrast" + font: "DejaVu Sans" + mono_font: "DejaVu Sans Mono" + ink: "#111111" + muted: "#333333" + line: "#555555" + paper_soft: "#FFFFFF" + accent: "#003B66" + info: "#005A9C" + warning: "#003B66" + critical: "#A40000" + success: "#005A9C" + +yon-sen: + label: "Yon Sen" + font: "DejaVu Sans" + mono_font: "DejaVu Sans Mono" + ink: "#292724" + muted: "#625D54" + line: "#C8BDA8" + paper_soft: "#FAF6EC" + accent: "#743129" + info: "#304C5E" + warning: "#78633D" + critical: "#8C3029" + success: "#4D5644" + +steingrund: + label: "Steingrund" + font: "DejaVu Sans" + mono_font: "DejaVu Sans Mono" + ink: "#25262B" + muted: "#686A73" + line: "#B5BBC3" + paper_soft: "#F8F9FA" + accent: "#572331" + info: "#53667D" + warning: "#5C6372" + critical: "#6F2535" + success: "#3F6370" + +draan: + label: "Draan" + font: "DejaVu Sans" + mono_font: "DejaVu Sans Mono" + ink: "#25223D" + muted: "#665E82" + line: "#9991A8" + paper_soft: "#F2EDF3" + accent: "#513B72" + info: "#397A76" + warning: "#3F6965" + critical: "#713F70" + success: "#3F6965"