Agent skill that turns natural language, code, Terraform/K8s, SQL, OpenAPI, AsyncAPI, Protobuf and GraphQL sources into editable, tested draw.io architecture diagrams: incremental sync, multi-view projection, drift diff, CI architecture tests, whiteboard derasterize, interactive HTML/PPTX/Mermaid exports.
Python agent-skillsarchitecturearchitecture-diagramasyncapibpmnc4-modelclaude-codediagramdiagrams-as-codedrawioflowchartgithub-actionsgraphqlimage-to-diagramkubernetesmcp-serverprotobufsysmlterraformuml
feat: colorblind-safe + dark built-in presets, dark-palette schema support, legend recipe (v1.19.0) (#63)
Agents365.ai48452fdb0879
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 49304ff..b8e17b9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,6 +4,21 @@ All notable changes to **drawio-skill** are documented here. The format is basedon [Keep a Changelog](https://keepachangelog.com/), and the project followssemantic-ish versioning (the `version:` field in `skills/drawio-skill/SKILL.md`).+## [1.19.0] — 2026-07-03+### Added+- **Accessibility built-in presets**: `colorblind-safe` (Okabe-Ito palette —+ all seven role colors distinguishable under color-vision deficiency, plus+ `strokeWidth=2`) and `dark` (dark fills + dark page background, light+ strokes/text) join `default` / `corporate` / `handdrawn`.+- **Schema + application-rule support for dark palettes**: optional+ `extras.background` / `extras.fontColor` / `extras.edgeColor` (backwards+ compatible); `style-presets.md` documents how each maps to styles and why+ dark exports must not use `-t` (transparent PNG).+- **Legend guidance**: `references/xml-authoring.md` gains a+ "Legend (auto-generate from the palette)" section — mechanical swatch ++ role-label recipe for diagrams using 3+ semantic colors.+- Built-in preset conformance test (suite now 46).+## [1.18.0] — 2026-07-03### Added- **Mermaid authoring path** (draw.io CLI ≥ 30, discovered viadiff --git a/README.md b/README.mdindex 0515f8c..d7a99d9 100644--- a/README.md+++ b/README.md@@ -253,7 +253,7 @@ python3 scripts/aiicons.py "openai" --embed # self-contained data URI## 🎨 Style Presets-Capture a visual style once, reuse it everywhere. Three presets are built in — `default`, `corporate`, `handdrawn` — and you can teach the skill your own style from a `.drawio` file or a flat image:+Capture a visual style once, reuse it everywhere. Five presets are built in — `default`, `corporate`, `handdrawn`, `colorblind-safe` (Okabe-Ito palette), `dark` — and you can teach the skill your own style from a `.drawio` file or a flat image:```Draw a microservices architecture using my "corporate" stylediff --git a/README_CN.md b/README_CN.mdindex fb682db..250f532 100644--- a/README_CN.md+++ b/README_CN.md@@ -251,7 +251,7 @@ python3 scripts/aiicons.py "openai" --embed # 内联为自包含 data URI## 🎨 样式预设-把视觉风格"教"给 Skill 一次,所有图表自动复用。内置三种预设:`default`、`corporate`、`handdrawn`;也可以从 `.drawio` 文件或图片学习你的风格:+把视觉风格"教"给 Skill 一次,所有图表自动复用。内置五种预设:`default`、`corporate`、`handdrawn`、`colorblind-safe`(Okabe-Ito 色盲安全色板)、`dark`;也可以从 `.drawio` 文件或图片学习你的风格:```画一个微服务架构图,使用我的 "corporate" 样式diff --git a/docs/STYLE_PRESETS.md b/docs/STYLE_PRESETS.mdindex 8380b0a..edc0689 100644--- a/docs/STYLE_PRESETS.md+++ b/docs/STYLE_PRESETS.md@@ -11,6 +11,8 @@ Style presets let you capture and reuse a visual style across diagrams. When a p| `default` | Clean blue/green/yellow palette matching the built-in conventions || `corporate` | Muted, professional palette suited for business presentations || `handdrawn` | Sketch-style strokes for informal or whiteboard-style diagrams |+| `colorblind-safe` | Okabe-Ito palette — all seven roles distinguishable under color-vision deficiency; thicker strokes |+| `dark` | Dark fills + dark page background, light strokes/text — for dark-mode docs and slides |## Apply a preset to a diagramdiff --git a/docs/STYLE_PRESETS_CN.md b/docs/STYLE_PRESETS_CN.mdindex 4ce3428..b5eadd1 100644--- a/docs/STYLE_PRESETS_CN.md+++ b/docs/STYLE_PRESETS_CN.md@@ -11,6 +11,8 @@| `default` | 干净的蓝/绿/黄配色,与内置规范保持一致 || `corporate` | 低饱和度专业配色,适合商务演示 || `handdrawn` | 手绘描边风格,适合非正式或白板式图表 |+| `colorblind-safe` | Okabe-Ito 色板 —— 七个角色色在色觉障碍下均可区分;描边加粗 |+| `dark` | 深色填充 + 深色页面背景、浅色描边/文字 —— 适合暗色文档和幻灯片 |## 将预设应用到图表diff --git a/skills/drawio-skill/SKILL.md b/skills/drawio-skill/SKILL.mdindex 6cee149..9b27f02 100644--- a/skills/drawio-skill/SKILL.md+++ b/skills/drawio-skill/SKILL.md@@ -1,12 +1,12 @@---name: drawio-skill-version: 1.18.0+version: 1.19.0description: Use when the user requests diagrams, flowcharts, architecture diagrams, ER diagrams, UML / sequence / class diagrams, network topology, cloud architecture from Terraform or Kubernetes manifests, ML/DL model figures (Transformer/CNN/LSTM), mind maps, or any visualization. Also use proactively when explaining systems with 3+ components, complex data flows, or relationships that benefit from visual representation. Best suited when the diagram needs custom styling, rich shape vocabulary, swimlanes, or exportable images (PNG/SVG/PDF/JPG). Generates .drawio XML and exports locally via the native draw.io desktop CLI.license: MIThomepage: https://github.com/Agents365-ai/drawio-skillcompatibility: Requires draw.io desktop app CLI on PATH (macOS/Linux/Windows). Self-check step requires a vision-enabled model (e.g., Claude Sonnet/Opus); gracefully skipped if unavailable. Optional auto-layout (scripts/autolayout.py) needs Graphviz (dot).platforms: [macos, linux, windows]-metadata: {"openclaw":{"requires":{"anyBins":["draw.io","drawio"]},"emoji":"📐","os":["darwin","linux","win32"],"install":[{"id":"brew-drawio","kind":"brew","formula":"drawio","bins":["drawio"],"label":"Install draw.io via Homebrew","os":["darwin"]},{"id":"brew-graphviz","kind":"brew","formula":"graphviz","bins":["dot"],"label":"Install Graphviz for optional autolayout.py","os":["darwin"],"optional":true}]},"hermes":{"tags":["drawio","diagram","flowchart","architecture","visualization","uml"],"category":"design","requires_tools":["drawio","draw.io"],"related_skills":["mermaid","excalidraw","plantuml"]},"author":"Agents365-ai","version":"1.18.0"}+metadata: {"openclaw":{"requires":{"anyBins":["draw.io","drawio"]},"emoji":"📐","os":["darwin","linux","win32"],"install":[{"id":"brew-drawio","kind":"brew","formula":"drawio","bins":["drawio"],"label":"Install draw.io via Homebrew","os":["darwin"]},{"id":"brew-graphviz","kind":"brew","formula":"graphviz","bins":["dot"],"label":"Install Graphviz for optional autolayout.py","os":["darwin"],"optional":true}]},"hermes":{"tags":["drawio","diagram","flowchart","architecture","visualization","uml"],"category":"design","requires_tools":["drawio","draw.io"],"related_skills":["mermaid","excalidraw","plantuml"]},"author":"Agents365-ai","version":"1.19.0"}---# Draw.io Diagrams@@ -174,7 +174,7 @@ A **style preset** is a named JSON file capturing a user's visual preferences (p**Lookup order** when SKILL.md's Step 0 resolves a preset name:1. `~/.drawio-skill/styles/<name>.json` — user presets (survive `git pull`)-2. `<this-skill-dir>/styles/built-in/<name>.json` — shipped built-ins (`default`, `corporate`, `handdrawn`)+2. `<this-skill-dir>/styles/built-in/<name>.json` — shipped built-ins (`default`, `corporate`, `handdrawn`, `colorblind-safe`, `dark`)Always lowercase the user-provided name before any file operation — the schema enforces lowercase.diff --git a/skills/drawio-skill/references/style-presets.md b/skills/drawio-skill/references/style-presets.mdindex d809507..164bd0e 100644--- a/skills/drawio-skill/references/style-presets.md+++ b/skills/drawio-skill/references/style-presets.md@@ -11,7 +11,7 @@ Read this file when:## Locations and lookup order1. `~/.drawio-skill/styles/<name>.json` — user presets (survive `git pull`).-2. `<this-skill-dir>/styles/built-in/<name>.json` — built-ins shipped with the skill (`default`, `corporate`, `handdrawn`).+2. `<this-skill-dir>/styles/built-in/<name>.json` — built-ins shipped with the skill (`default`, `corporate`, `handdrawn`, `colorblind-safe` — Okabe-Ito palette, distinguishable under color-vision deficiency, thicker strokes; `dark` — dark fills + page background, light strokes, needs the `extras.fontColor`/`edgeColor`/`background` rules below).A user preset shadows a built-in of the same name.@@ -42,6 +42,9 @@ When SKILL.md's Step 0 identified a preset, it fully replaces the built-in palet**Extras.**- `preset.extras.sketch === true` → append `sketch=1` to every vertex style and every edge style.- `preset.extras.globalStrokeWidth !== 1` (any value other than the drawio default of 1, including `0.5`) → append `strokeWidth=<n>` to every vertex style and every edge style.+- `preset.extras.fontColor` (present) → append `fontColor=<hex>` to every vertex and container style. Required for dark palettes — without it, dark fills render unreadable black text.+- `preset.extras.edgeColor` (present) → append `strokeColor=<hex>;fontColor=<hex>` to every edge style (edges otherwise default to black, invisible on dark backgrounds).+- `preset.extras.background` (present) → set `background="<hex>"` on the `<mxGraphModel>` element, and export PNG **without** `-t` (transparent) so the background is actually painted — a dark diagram on a transparent PNG looks broken in white viewers.**Interaction with diagram-type presets** (ERD / UML / Sequence / ML / Flowchart). Diagram-type presets set structural style keywords that the user preset must preserve (e.g. ERD tables rely on `shape=table;startSize=30;container=1;childLayout=tableLayout;...`). The rule: keep the diagram-type preset's structural keywords, then layer the user preset's color / font / edge / extras on top. When a diagram-type preset hardcodes a color (`fillColor=#dae8fc`, etc.) that conflicts with the user preset, the user preset's color wins. Exception: `fillColor=none` is structural — do not replace it with a palette color.diff --git a/skills/drawio-skill/references/xml-authoring.md b/skills/drawio-skill/references/xml-authoring.mdindex d02f289..8791444 100644--- a/skills/drawio-skill/references/xml-authoring.md+++ b/skills/drawio-skill/references/xml-authoring.md@@ -151,6 +151,26 @@ When multiple edges connect to the same shape, assign different entry/exit point| Grey | `#f5f5f5` | `#666666` | external/neutral || Purple | `#e1d5e7` | `#9673a6` | security, auth |+### Legend (auto-generate from the palette)++When a diagram uses 3+ semantic colors, add a legend so the color coding is self-explanatory. Generate it mechanically from the roles actually present — never invent legend entries that aren't in the diagram:++```xml+<!-- Legend container: place in a corner clear of the diagram (e.g. below-left) -->+<mxCell id="legend" value="Legend" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#666666;verticalAlign=top;fontStyle=1;" vertex="1" parent="1">+ <mxGeometry x="40" y="720" width="180" height="110" as="geometry"/>+</mxCell>+<!-- One swatch + label pair per used role, 24px row pitch, children of the legend -->+<mxCell id="leg1" value="" style="rounded=0;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="legend">+ <mxGeometry x="10" y="30" width="30" height="16" as="geometry"/>+</mxCell>+<mxCell id="leg1t" value="Service" style="text;html=1;align=left;verticalAlign=middle;" vertex="1" parent="legend">+ <mxGeometry x="50" y="28" width="120" height="20" as="geometry"/>+</mxCell>+```++Rules: swatch colors come from the active palette (preset or the table above) with the **role name** as the label (Service, Database, Queue, …); height = `30 + 24 × rows`; the legend is a container (`parent="legend"`, relative coordinates); skip it entirely for single-color diagrams.+### Layout tips**Spacing — scale with complexity:**diff --git a/skills/drawio-skill/styles/built-in/colorblind-safe.json b/skills/drawio-skill/styles/built-in/colorblind-safe.jsonnew file mode 100644index 0000000..612703d--- /dev/null+++ b/skills/drawio-skill/styles/built-in/colorblind-safe.json@@ -0,0 +1,49 @@+{+ "$schema": "../schema.json",+ "name": "colorblind-safe",+ "version": 1,+ "default": false,+ "source": { "type": "built-in" },+ "confidence": "high",+ "palette": {+ "primary": { "fillColor": "#ccedff", "strokeColor": "#0072b2" },+ "success": { "fillColor": "#ccfff1", "strokeColor": "#009e73" },+ "warning": { "fillColor": "#fff8cc", "strokeColor": "#8f7c00" },+ "accent": { "fillColor": "#ffefcc", "strokeColor": "#e69f00" },+ "danger": { "fillColor": "#ffe3cc", "strokeColor": "#d55e00" },+ "neutral": { "fillColor": "#e6e6e6", "strokeColor": "#555555" },+ "secondary": { "fillColor": "#f1dae7", "strokeColor": "#cc79a7" }+ },+ "roles": {+ "service": "primary",+ "database": "success",+ "queue": "warning",+ "gateway": "accent",+ "error": "danger",+ "external": "neutral",+ "security": "secondary"+ },+ "shapes": {+ "service": "rounded=1",+ "database": "shape=cylinder3",+ "queue": "rounded=1",+ "decision": "rhombus",+ "external": "rounded=1;dashed=1",+ "container": "swimlane;startSize=30"+ },+ "font": {+ "fontFamily": "Helvetica",+ "fontSize": 12,+ "titleFontSize": 14,+ "titleBold": true+ },+ "edges": {+ "style": "edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1",+ "arrow": "endArrow=classic;endFill=1",+ "dashedFor": ["external"]+ },+ "extras": {+ "sketch": false,+ "globalStrokeWidth": 2+ }+}diff --git a/skills/drawio-skill/styles/built-in/dark.json b/skills/drawio-skill/styles/built-in/dark.jsonnew file mode 100644index 0000000..5ad6b7a--- /dev/null+++ b/skills/drawio-skill/styles/built-in/dark.json@@ -0,0 +1,52 @@+{+ "$schema": "../schema.json",+ "name": "dark",+ "version": 1,+ "default": false,+ "source": { "type": "built-in" },+ "confidence": "high",+ "palette": {+ "primary": { "fillColor": "#004870", "strokeColor": "#33b6ff" },+ "success": { "fillColor": "#007052", "strokeColor": "#33ffc7" },+ "warning": { "fillColor": "#5a4916", "strokeColor": "#d7b85b" },+ "accent": { "fillColor": "#705100", "strokeColor": "#ffc633" },+ "danger": { "fillColor": "#502220", "strokeColor": "#c4716e" },+ "neutral": { "fillColor": "#383838", "strokeColor": "#999999" },+ "secondary": { "fillColor": "#3d2c45", "strokeColor": "#a182b0" }+ },+ "roles": {+ "service": "primary",+ "database": "success",+ "queue": "warning",+ "gateway": "accent",+ "error": "danger",+ "external": "neutral",+ "security": "secondary"+ },+ "shapes": {+ "service": "rounded=1",+ "database": "shape=cylinder3",+ "queue": "rounded=1",+ "decision": "rhombus",+ "external": "rounded=1;dashed=1",+ "container": "swimlane;startSize=30"+ },+ "font": {+ "fontFamily": "Helvetica",+ "fontSize": 12,+ "titleFontSize": 14,+ "titleBold": true+ },+ "edges": {+ "style": "edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1",+ "arrow": "endArrow=classic;endFill=1",+ "dashedFor": ["external"]+ },+ "extras": {+ "sketch": false,+ "globalStrokeWidth": 1,+ "background": "#1e1e1e",+ "fontColor": "#f0f0f0",+ "edgeColor": "#bbbbbb"+ }+}diff --git a/skills/drawio-skill/styles/schema.json b/skills/drawio-skill/styles/schema.jsonindex 6e7ac4a..0d4dedf 100644--- a/skills/drawio-skill/styles/schema.json+++ b/skills/drawio-skill/styles/schema.json@@ -3,110 +3,262 @@"$id": "https://github.com/Agents365-ai/drawio-skill/styles/schema.json","title": "drawio-skill preset","type": "object",- "required": ["name", "version", "palette", "roles", "shapes", "font", "edges"],+ "required": [+ "name",+ "version",+ "palette",+ "roles",+ "shapes",+ "font",+ "edges"+ ],"additionalProperties": false,"properties": {- "$schema": { "type": "string" },- "name": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]*$" },- "version": { "type": "integer", "const": 1 },- "default": { "type": "boolean" },- "confidence": { "type": "string", "enum": ["low", "medium", "high"] },+ "$schema": {+ "type": "string"+ },+ "name": {+ "type": "string",+ "pattern": "^[a-z0-9][a-z0-9_-]*$"+ },+ "version": {+ "type": "integer",+ "const": 1+ },+ "default": {+ "type": "boolean"+ },+ "confidence": {+ "type": "string",+ "enum": [+ "low",+ "medium",+ "high"+ ]+ },"source": {"type": "object","additionalProperties": false,"properties": {- "type": { "type": "string", "enum": ["xml", "image", "built-in", "hand-authored"] },- "path": { "type": "string" },- "extracted_at": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }+ "type": {+ "type": "string",+ "enum": [+ "xml",+ "image",+ "built-in",+ "hand-authored"+ ]+ },+ "path": {+ "type": "string"+ },+ "extracted_at": {+ "type": "string",+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$"+ }}},"palette": {"type": "object","additionalProperties": false,- "required": ["primary", "success", "warning", "accent", "danger", "neutral", "secondary"],+ "required": [+ "primary",+ "success",+ "warning",+ "accent",+ "danger",+ "neutral",+ "secondary"+ ],"properties": {- "primary": { "$ref": "#/$defs/colorPair" },- "success": { "$ref": "#/$defs/colorPair" },- "warning": { "$ref": "#/$defs/colorPair" },- "accent": { "$ref": "#/$defs/colorPair" },- "danger": { "$ref": "#/$defs/colorPair" },- "neutral": { "$ref": "#/$defs/colorPair" },- "secondary": { "$ref": "#/$defs/colorPair" }+ "primary": {+ "$ref": "#/$defs/colorPair"+ },+ "success": {+ "$ref": "#/$defs/colorPair"+ },+ "warning": {+ "$ref": "#/$defs/colorPair"+ },+ "accent": {+ "$ref": "#/$defs/colorPair"+ },+ "danger": {+ "$ref": "#/$defs/colorPair"+ },+ "neutral": {+ "$ref": "#/$defs/colorPair"+ },+ "secondary": {+ "$ref": "#/$defs/colorPair"+ }}},"roles": {"type": "object","additionalProperties": false,"properties": {- "service": { "$ref": "#/$defs/slotName" },- "database": { "$ref": "#/$defs/slotName" },- "queue": { "$ref": "#/$defs/slotName" },- "gateway": { "$ref": "#/$defs/slotName" },- "error": { "$ref": "#/$defs/slotName" },- "external": { "$ref": "#/$defs/slotName" },- "security": { "$ref": "#/$defs/slotName" }+ "service": {+ "$ref": "#/$defs/slotName"+ },+ "database": {+ "$ref": "#/$defs/slotName"+ },+ "queue": {+ "$ref": "#/$defs/slotName"+ },+ "gateway": {+ "$ref": "#/$defs/slotName"+ },+ "error": {+ "$ref": "#/$defs/slotName"+ },+ "external": {+ "$ref": "#/$defs/slotName"+ },+ "security": {+ "$ref": "#/$defs/slotName"+ }}},"shapes": {"type": "object",- "additionalProperties": { "type": "string" },+ "additionalProperties": {+ "type": "string"+ },"properties": {- "service": { "type": "string" },- "database": { "type": "string" },- "queue": { "type": "string" },- "decision": { "type": "string" },- "external": { "type": "string" },- "container": { "type": "string" }+ "service": {+ "type": "string"+ },+ "database": {+ "type": "string"+ },+ "queue": {+ "type": "string"+ },+ "decision": {+ "type": "string"+ },+ "external": {+ "type": "string"+ },+ "container": {+ "type": "string"+ }}},"font": {"type": "object","additionalProperties": false,- "required": ["fontFamily", "fontSize"],+ "required": [+ "fontFamily",+ "fontSize"+ ],"properties": {- "fontFamily": { "type": "string" },- "fontSize": { "type": "integer", "minimum": 8, "maximum": 36 },- "titleFontSize": { "type": "integer", "minimum": 8, "maximum": 48 },- "titleBold": { "type": "boolean" }+ "fontFamily": {+ "type": "string"+ },+ "fontSize": {+ "type": "integer",+ "minimum": 8,+ "maximum": 36+ },+ "titleFontSize": {+ "type": "integer",+ "minimum": 8,+ "maximum": 48+ },+ "titleBold": {+ "type": "boolean"+ }}},"edges": {"type": "object","additionalProperties": false,- "required": ["style", "arrow"],+ "required": [+ "style",+ "arrow"+ ],"properties": {- "style": { "type": "string" },- "arrow": { "type": "string" },- "dashedFor": { "type": "array", "items": { "type": "string" } }+ "style": {+ "type": "string"+ },+ "arrow": {+ "type": "string"+ },+ "dashedFor": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }}},"extras": {"type": "object","additionalProperties": false,"properties": {- "sketch": { "type": "boolean" },- "globalStrokeWidth": { "type": "number", "minimum": 0.5, "maximum": 6 }+ "sketch": {+ "type": "boolean"+ },+ "globalStrokeWidth": {+ "type": "number",+ "minimum": 0.5,+ "maximum": 6+ },+ "background": {+ "type": "string",+ "pattern": "^#[0-9A-Fa-f]{6}$"+ },+ "fontColor": {+ "type": "string",+ "pattern": "^#[0-9A-Fa-f]{6}$"+ },+ "edgeColor": {+ "type": "string",+ "pattern": "^#[0-9A-Fa-f]{6}$"+ }}}},"$defs": {"colorPair": {"oneOf": [- { "type": "null" },+ {+ "type": "null"+ },{"type": "object","additionalProperties": false,- "required": ["fillColor", "strokeColor"],+ "required": [+ "fillColor",+ "strokeColor"+ ],"properties": {- "fillColor": { "type": "string", "pattern": "^#[0-9A-Fa-f]{6}$" },- "strokeColor": { "type": "string", "pattern": "^#[0-9A-Fa-f]{6}$" }+ "fillColor": {+ "type": "string",+ "pattern": "^#[0-9A-Fa-f]{6}$"+ },+ "strokeColor": {+ "type": "string",+ "pattern": "^#[0-9A-Fa-f]{6}$"+ }}}]},"slotName": {"type": "string",- "enum": ["primary", "success", "warning", "accent", "danger", "neutral", "secondary"]+ "enum": [+ "primary",+ "success",+ "warning",+ "accent",+ "danger",+ "neutral",+ "secondary"+ ]}}}diff --git a/tests/test_scripts.py b/tests/test_scripts.pyindex 7dea903..0d36e17 100644--- a/tests/test_scripts.py+++ b/tests/test_scripts.py@@ -220,6 +220,33 @@ class TestAutolayoutColor(unittest.TestCase):self.assertIn(""", out)+class TestBuiltinPresets(unittest.TestCase):+ STYLES = os.path.join(ROOT, "skills", "drawio-skill", "styles", "built-in")++ def test_presets_conform(self):+ import glob+ import re+ hexpat = re.compile(r"^#[0-9A-Fa-f]{6}$")+ files = sorted(glob.glob(os.path.join(self.STYLES, "*.json")))+ names = {os.path.basename(f)[:-5] for f in files}+ self.assertLessEqual({"default", "corporate", "handdrawn",+ "colorblind-safe", "dark"}, names)+ for f in files:+ with open(f, encoding="utf-8") as fh:+ d = json.load(fh)+ self.assertEqual(d["name"], os.path.basename(f)[:-5])+ self.assertFalse(d.get("default"), f) # built-ins never default+ for slot in ("primary", "success", "warning", "accent",+ "danger", "neutral", "secondary"):+ pair = d["palette"][slot]+ if pair is not None:+ self.assertRegex(pair["fillColor"], hexpat)+ self.assertRegex(pair["strokeColor"], hexpat)+ for key in ("background", "fontColor", "edgeColor"):+ if key in d.get("extras", {}):+ self.assertRegex(d["extras"][key], hexpat)++class TestValidateCli(unittest.TestCase):GOOD = ('<mxfile><diagram name="P1"><mxGraphModel><root>''<mxCell id="0"/><mxCell id="1" parent="0"/>'