Skip to main content

Themes & Design Systems (theme)

In Scapius, Themes allow you to package and reuse comprehensive visual design systems across multiple architecture models and workspaces.

Themes can be defined as standalone .theme files (e.g. default.theme, dark.theme, enterprise.theme) or declared inline within architecture documents.

# default.light.theme
theme light {
style capability {
shape "rounded_rectangle"
fill "#ede9fe"
stroke "#a78bfa"
stroke_width "1.5px"
color "#4c1d95"
}

style system {
shape "rounded_rectangle"
fill "#e0f2fe"
stroke "#38bdf8"
stroke_width "2px"
color "#0369a1"
}
}

# default.dark.theme
theme dark {
style system {
fill "#0f172a"
stroke "#38bdf8"
stroke_width "2px"
color "#f8fafc"
}
}

1. Referencing Themes in Workspaces​

To apply a theme to your architecture workspace, reference it inside the root styles { ... } block using the theme statement. You can specify a built-in theme name (e.g. theme "material"), a standalone .theme file path, or both:

workspace my_architecture "Corporate Architecture" {
# Architecture entities...

styles {
# 1. Base Built-in Theme: Material Design 3
theme "material"

# 2. Optional: Custom domain-specific theme file overlay
theme "themes/security-overlay.theme"

# 3. Optional: Import custom CSS stylesheets
import_css "./branding.css"

# 4. Optional: Workspace-level override rules (applied on top of the theme cascade)
style system where tier == "Tier-1" {
stroke "#ef4444"
stroke_width "3px"
icon "shield-alert"
}
}
}

Built-in Themes​

Scapius ships with built-in architecture themes that can be referenced directly without creating external .theme files:

Theme NameDescriptionSupported Modes
materialModern Material Design 3 tonal surfaces, elevation, container tokens, and rounded cards.light, dark
defaultClean, balanced pastel color scheme across enterprise architecture layers.light, dark
archimateStandard Open Group ArchiMate layer colors (Business, Application, Technology, Motivation).light, dark
c4Simon Brown's C4 model visual notation and container hierarchy.light, dark
blueprintTechnical engineering cyan and navy drafting grid aesthetic.light, dark

CLI Theme Utilities​

Use the Scapius CLI to explore and export built-in themes:

# List all available built-in themes
scapius theme list

# List themes in JSON format
scapius theme list --format json

# Eject a built-in theme into a local .theme file to customize it
scapius theme eject material -o ./themes/my-material.theme

2. Standalone .theme File Structure​

A .theme file consists of a top-level theme "<name>" { ... } block enclosing a collection of style rules.

Typical Theme Layer Mapping Conventions​

A well-structured enterprise theme establishes consistent visual language across architectural layers:

theme "corporate-palette" {

# ========================================================
# 1. Strategy & Motivation Layer (Violet / Purple Family)
# ========================================================
style capability {
shape "rounded_rectangle"
fill "#ede9fe"
stroke "#a78bfa"
stroke_width "1.5px"
color "#4c1d95"
}

style goal {
shape "rounded_rectangle"
fill "#fce7f3"
stroke "#f472b6"
stroke_width "1.5px"
color "#831843"
}

style kpi {
shape "octagon"
fill "#dcfce7"
stroke "#4ade80"
stroke_width "1.5px"
color "#14532d"
}

# ========================================================
# 2. Business Architecture Layer (Warm / Amber Family)
# ========================================================
style actor {
shape "person"
fill "#ffedd5"
stroke "#fb923c"
stroke_width "2px"
color "#7c2d12"
}

style process {
shape "chevron"
fill "#fef3c7"
stroke "#f59e0b"
stroke_width "1.5px"
color "#92400e"
}

# ========================================================
# 3. Application Layer (Sky Blue / Cyan Family)
# ========================================================
style system {
shape "rounded_rectangle"
fill "#e0f2fe"
stroke "#38bdf8"
stroke_width "2px"
color "#0369a1"
}

style app {
shape "rounded_rectangle"
fill "#f0f9ff"
stroke "#0ea5e9"
stroke_width "1.5px"
color "#0c4a6e"
}

style component {
shape "rounded_rectangle"
fill "#ffffff"
stroke "#94a3b8"
stroke_width "1px"
color "#334155"
}

# ========================================================
# 4. Data Layer (Teal / Emerald Family)
# ========================================================
style data_object {
shape "cylinder"
fill "#ccfbf1"
stroke "#2dd4bf"
stroke_width "1.5px"
color "#115e59"
}

# ========================================================
# 5. Technology Layer (Slate / Neutral Family)
# ========================================================
style infrastructure {
shape "cylinder"
fill "#f1f5f9"
stroke "#64748b"
stroke_width "1.5px"
color "#1e293b"
}

style environment {
shape "rounded_rectangle"
fill "#f8fafc"
stroke "#94a3b8"
stroke_style "dashed"
color "#334155"
}

# ========================================================
# 6. Security & Governance Layer
# ========================================================
style trust_boundary {
shape "rectangle"
stroke "#f59e0b"
stroke_width "2px"
stroke_style "dashed"
}

style threat {
shape "octagon"
fill "#fee2e2"
stroke "#ef4444"
color "#991b1b"
}

style control {
shape "shield"
fill "#dcfce7"
stroke "#22c55e"
color "#15803d"
}

# ========================================================
# 7. Clusters & Bounding Boxes
# ========================================================
style cluster {
shape "rounded_rectangle"
fill "rgba(241, 245, 249, 0.4)"
stroke "#94a3b8"
stroke_width "1.5px"
stroke_style "dashed"
border_radius "8px"
color "#475569"
}

# ========================================================
# 8. Default Relationship Edge Styling
# ========================================================
style realizes {
stroke "#10b981"
stroke_width "1.5px"
}

style flows_to {
stroke "#0ea5e9"
stroke_width "2px"
}

style depends_on {
stroke "#64748b"
stroke_width "1.5px"
stroke_style "dashed"
}

style targets {
stroke "#ef4444"
stroke_width "2px"
}

style mitigates {
stroke "#22c55e"
stroke_width "2px"
}
}

3. Style Cascade & Precedence​

Scapius applies styling rules according to a strict cascading hierarchy:

Default Engine Presets
↓ (overridden by)
Base Theme (.theme file or theme statement)
↓ (overridden by)
Workspace-Level Styles Block (styles { ... })
↓ (overridden by)
View-Scoped Style Rules (views { landscape v1 { style ... } })
  1. Base Theme: Sets baseline shapes, stroke widths, palette colors, and typography.
  2. Workspace Styles: Overrides base theme properties for domain-specific models (e.g. conditional rules on tier == "Tier-1").
  3. View-Level Rules: The most specific rules, applied exclusively to diagrams projected in that single view.

4. Light and Dark Theme Switching​

When you declare mode-specific themes, the frontend web UI and rendering pipeline automatically fetch the matching theme when toggling between light and dark modes:

my-enterprise/
├── architecture.ea
├── default.light.theme
└── default.dark.theme
# In architecture.ea:
styles {
theme "default.light.theme"
theme "default.dark.theme"
}

Rule Resolution & Cascading Semantics​

  1. Universal Rules (theme { ... } / theme "base" { ... }): Rules defined without a mode apply to both light and dark themes.
  2. Mode Rules (theme light { ... } / theme dark { ... }): Applied only when that specific mode is active, layered on top of universal rules.
  3. Conflicting Properties (Last One Wins): If multiple matching rules target the same entity property, the later declaration in the stylesheet cascade takes precedence.
  4. API Query Contract: Theme endpoints require a mode parameter (GET /api/workspaces/{id}/theme?mode=light|dark) to guarantee deterministic styling for each color scheme.