Skip to content

Commit d2f7748

Browse files
committed
refactor: switch architecture diagram to dark theme and show all roles
**Changed:** - Updated all detail box background and text colors to use a dark theme for better readability and visual consistency across the architecture diagram - Modified generated SVG to use a dark background and light text, updating palette and Mermaid CLI config for dark mode - Changed role listing in detail boxes to show all roles instead of truncating and summarizing with "+N more" - Updated diagram generation script to write a Mermaid config file for dark theme and clean it up after rendering - Improved color contrast and adjusted SVG node and edge styling for dark theme - Removed the "Diagram source" collapsible section from the README and from auto-generated README content for a cleaner appearance **Removed:** - Truncation and "+N more" logic from role display in detail boxes to ensure all roles are listed for each category - "Diagram source" details section from README and generated README content
1 parent 05c7ef0 commit d2f7748

4 files changed

Lines changed: 38 additions & 57 deletions

File tree

.hooks/gen-arch-diagram.py

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,35 @@
2222
"names": ["laps_dc"],
2323
"color": "#f39c12",
2424
"border": "#d68910",
25-
"detail_bg": "#fef9f0",
25+
"detail_bg": "#3d2e0a",
2626
}),
2727
("SCCM", {
2828
"prefixes": ["sccm_"],
2929
"names": [],
3030
"color": "#1abc9c",
3131
"border": "#16a085",
32-
"detail_bg": "#f0fcfa",
32+
"detail_bg": "#0d2e28",
3333
}),
3434
("Vulnerabilities", {
3535
"prefixes": ["vulns_"],
3636
"names": [],
3737
"color": "#9b59b6",
3838
"border": "#8e44ad",
39-
"detail_bg": "#f8f2fc",
39+
"detail_bg": "#2a1a33",
4040
}),
4141
("Security", {
4242
"prefixes": ["security_"],
4343
"names": ["dc_audit_sacl", "ldap_diagnostic_logging"],
4444
"color": "#e67e22",
4545
"border": "#d35400",
46-
"detail_bg": "#fef5ed",
46+
"detail_bg": "#3a2210",
4747
}),
4848
("Settings", {
4949
"prefixes": ["settings_"],
5050
"names": [],
5151
"color": "#3498db",
5252
"border": "#2980b9",
53-
"detail_bg": "#f0f7fd",
53+
"detail_bg": "#132a3d",
5454
}),
5555
("Active Directory", {
5656
"prefixes": [],
@@ -66,7 +66,7 @@
6666
],
6767
"color": "#e74c3c",
6868
"border": "#c0392b",
69-
"detail_bg": "#fdf2f2",
69+
"detail_bg": "#3a1515",
7070
}),
7171
("Server Roles", {
7272
"prefixes": ["mssql_"],
@@ -77,7 +77,7 @@
7777
],
7878
"color": "#2ecc71",
7979
"border": "#27ae60",
80-
"detail_bg": "#f2fdf5",
80+
"detail_bg": "#133320",
8181
}),
8282
]
8383

@@ -137,22 +137,21 @@ def discover_collection(collection_path):
137137
return sorted(roles), sorted(plugins), sorted(playbooks)
138138

139139

140-
def abbreviate_roles(roles, prefixes=None, max_shown=6):
141-
"""Return a string summarising roles for the detail box."""
140+
def abbreviate_roles(roles, prefixes=None):
141+
"""Return a string listing all roles for the detail box."""
142142
def strip_prefix(name):
143143
if prefixes:
144144
for p in prefixes:
145145
if name.startswith(p):
146146
return name[len(p):]
147147
return name
148148

149-
display = [strip_prefix(r) for r in roles[:max_shown]]
150-
suffix = f" +{len(roles) - max_shown} more" if len(roles) > max_shown else ""
151-
# Use bullet separator, ~3 per line via <br/>
149+
display = [strip_prefix(r) for r in roles]
150+
# 3 per line via <br/>
152151
chunks = []
153152
for i in range(0, len(display), 3):
154153
chunks.append(" &bull; ".join(display[i:i + 3]))
155-
return "<br/>".join(chunks) + suffix
154+
return "<br/>".join(chunks)
156155

157156

158157
def generate_mermaid(roles, plugins, playbooks):
@@ -225,7 +224,7 @@ def generate_mermaid(roles, plugins, playbooks):
225224
)
226225
lines.append(
227226
f" style {nid}_detail fill:{cat_cfg['detail_bg']},"
228-
f"stroke:{cat_cfg['border']},color:#333"
227+
f"stroke:{cat_cfg['border']},color:#ccc"
229228
)
230229

231230
return "\n".join(lines)
@@ -245,12 +244,22 @@ def render_svg(mmd_path, svg_path):
245244
return False
246245
cmd = [npx, "--yes", "@mermaid-js/mermaid-cli"]
247246

248-
cmd += ["-i", str(mmd_path), "-o", str(svg_path), "--theme", "default", "-w", "1600"]
247+
# Use dark theme with dark background
248+
config_path = mmd_path.parent / "mermaid-config.json"
249+
config_path.write_text('{"theme":"dark","themeVariables":{"darkMode":true}}\n')
250+
cmd += [
251+
"-i", str(mmd_path), "-o", str(svg_path),
252+
"-c", str(config_path),
253+
"-b", "#1a1a2e",
254+
"-w", "1600",
255+
]
249256
try:
250257
subprocess.run(cmd, check=True, capture_output=True, text=True)
251258
except subprocess.CalledProcessError as exc:
252259
print(f"Error rendering SVG: {exc.stderr}", file=sys.stderr)
253260
return False
261+
finally:
262+
config_path.unlink(missing_ok=True)
254263
return True
255264

256265

@@ -280,20 +289,6 @@ def update_readme(readme_path="README.md"):
280289
281290
![Architecture](docs/architecture.svg)
282291
283-
<details>
284-
<summary>Diagram source</summary>
285-
286-
The diagram is auto-generated from the collection structure by a pre-commit hook.
287-
Source: [`docs/architecture.mmd`](docs/architecture.mmd)
288-
289-
To regenerate manually:
290-
291-
```bash
292-
python .hooks/gen-arch-diagram.py
293-
```
294-
295-
</details>
296-
297292
"""
298293

299294
new_content = content[:start_pos] + new_section + content[end_pos:]

README.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,6 @@ by Orange Cyberdefense.
1212

1313
![Architecture](docs/architecture.svg)
1414

15-
<details>
16-
<summary>Diagram source</summary>
17-
18-
The diagram is auto-generated from the collection structure by a pre-commit hook.
19-
Source: [`docs/architecture.mmd`](docs/architecture.mmd)
20-
21-
To regenerate manually:
22-
23-
```bash
24-
python .hooks/gen-arch-diagram.py
25-
```
26-
27-
</details>
28-
2915
## Requirements
3016

3117
- Ansible >= 2.15

docs/architecture.mmd

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@ graph LR
1010
Collection --> ServerRoles["Server Roles<br/><i>15 roles</i>"]
1111

1212
LAPS -.- LAPS_detail["dc &bull; permissions &bull; server<br/>verify"]
13-
SCCM -.- SCCM_detail["config_accounts &bull; config_boundary &bull; config_client_install<br/>config_client_push &bull; config_discovery &bull; config_naa +8 more"]
14-
Vulnerabilities -.- Vulnerabilities_detail["acls &bull; adcs_templates &bull; administrator_folder<br/>anonymous_enum &bull; autologon &bull; credentials +14 more"]
15-
Security -.- Security_detail["dc_audit_sacl &bull; ldap_diagnostic_logging &bull; account_is_sensitive<br/>asr &bull; audit_policy &bull; enable_run_as_ppl +2 more"]
16-
Settings -.- Settings_detail["adjust_rights &bull; admin_password &bull; copy_files<br/>disable_nat_adapter &bull; enable_nat_adapter &bull; gpmc +7 more"]
17-
ActiveDirectory -.- ActiveDirectory_detail["acl &bull; ad &bull; adcs<br/>adcs_templates &bull; child_domain &bull; dc_dns_conditional_forwarder +15 more"]
18-
ServerRoles -.- ServerRoles_detail["common &bull; commonwkstn &bull; dhcp<br/>elk &bull; fix_dns &bull; iis +9 more"]
13+
SCCM -.- SCCM_detail["config_accounts &bull; config_boundary &bull; config_client_install<br/>config_client_push &bull; config_discovery &bull; config_naa<br/>config_pxe &bull; config_users &bull; install_adk<br/>install_iis &bull; install_mecm &bull; install_prerequisites<br/>install_wsus &bull; pxe"]
14+
Vulnerabilities -.- Vulnerabilities_detail["acls &bull; adcs_templates &bull; administrator_folder<br/>anonymous_enum &bull; autologon &bull; credentials<br/>directory &bull; disable_firewall &bull; enable_credssp_client<br/>enable_credssp_server &bull; enable_llmnr &bull; enable_nbt_ns<br/>files &bull; mssql &bull; ntlmdowngrade<br/>openshares &bull; permissions &bull; schedule<br/>shares &bull; smbv1"]
15+
Security -.- Security_detail["dc_audit_sacl &bull; ldap_diagnostic_logging &bull; account_is_sensitive<br/>asr &bull; audit_policy &bull; enable_run_as_ppl<br/>ensure_kb_not_installed &bull; powershell_restrict"]
16+
Settings -.- Settings_detail["adjust_rights &bull; admin_password &bull; copy_files<br/>disable_nat_adapter &bull; enable_nat_adapter &bull; gpmc<br/>gpo_remove &bull; hostname &bull; keyboard<br/>no_updates &bull; updates &bull; user_rights<br/>windows_defender"]
17+
ActiveDirectory -.- ActiveDirectory_detail["acl &bull; ad &bull; adcs<br/>adcs_templates &bull; child_domain &bull; dc_dns_conditional_forwarder<br/>disable_user &bull; dns_conditional_forwarder &bull; domain_controller<br/>domain_controller_slave &bull; enable_user &bull; gmsa<br/>gmsa_hosts &bull; groups_domains &bull; member_server<br/>move_to_ou &bull; onlyusers &bull; parent_child_dns<br/>password_policy &bull; sync_domains &bull; trusts"]
18+
ServerRoles -.- ServerRoles_detail["common &bull; commonwkstn &bull; dhcp<br/>elk &bull; fix_dns &bull; iis<br/>localusers &bull; logs_windows &bull; mssql<br/>audit &bull; link &bull; reporting<br/>ssms &bull; ps &bull; webdav"]
1919

2020
Collection --> Playbooks["Playbooks<br/><i>1 playbooks</i>"]
2121

2222
style Collection fill:#4a9eff,stroke:#2d7cd4,color:#fff,font-weight:bold
2323
style Playbooks fill:#7f8c8d,stroke:#6c7a7d,color:#fff
2424
style LAPS fill:#f39c12,stroke:#d68910,color:#fff
25-
style LAPS_detail fill:#fef9f0,stroke:#d68910,color:#333
25+
style LAPS_detail fill:#3d2e0a,stroke:#d68910,color:#ccc
2626
style SCCM fill:#1abc9c,stroke:#16a085,color:#fff
27-
style SCCM_detail fill:#f0fcfa,stroke:#16a085,color:#333
27+
style SCCM_detail fill:#0d2e28,stroke:#16a085,color:#ccc
2828
style Vulnerabilities fill:#9b59b6,stroke:#8e44ad,color:#fff
29-
style Vulnerabilities_detail fill:#f8f2fc,stroke:#8e44ad,color:#333
29+
style Vulnerabilities_detail fill:#2a1a33,stroke:#8e44ad,color:#ccc
3030
style Security fill:#e67e22,stroke:#d35400,color:#fff
31-
style Security_detail fill:#fef5ed,stroke:#d35400,color:#333
31+
style Security_detail fill:#3a2210,stroke:#d35400,color:#ccc
3232
style Settings fill:#3498db,stroke:#2980b9,color:#fff
33-
style Settings_detail fill:#f0f7fd,stroke:#2980b9,color:#333
33+
style Settings_detail fill:#132a3d,stroke:#2980b9,color:#ccc
3434
style ActiveDirectory fill:#e74c3c,stroke:#c0392b,color:#fff
35-
style ActiveDirectory_detail fill:#fdf2f2,stroke:#c0392b,color:#333
35+
style ActiveDirectory_detail fill:#3a1515,stroke:#c0392b,color:#ccc
3636
style ServerRoles fill:#2ecc71,stroke:#27ae60,color:#fff
37-
style ServerRoles_detail fill:#f2fdf5,stroke:#27ae60,color:#333
37+
style ServerRoles_detail fill:#133320,stroke:#27ae60,color:#ccc

docs/architecture.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)