Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Conditional Formatting

БесплатноБез исполняемых скриптовНе проверен

Data-driven conditional formatting, live data binding, and dynamic diagram updates for draw.io

TheLobbiот TheLobbi★ 22 звезды на GitHub

Об этом скилле

Conditional Formatting and Data-Driven Diagrams

Custom Properties with Object Tags

Wrap mxCell in an <object> tag to attach arbitrary key-value metadata to any diagram element:

<object label="Service A" id="2"
        service-id="svc-api-gateway"
        status="healthy"
        latency="45ms"
        uptime="99.97%"
        owner="platform-team"
        environment="production"
        region="us-east-1">
  <mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;"
          vertex="1" parent="1">
    <mxGeometry x="100" y="100" width="120" height="60" as="geometry"/>
  </mxCell>
</object>

Key points:

  • label replaces value as the display text
  • id moves from mxCell to <object>
  • Any attribute name is valid (use lowercase with hyphens)
  • Properties are visible in draw.io's Edit Data dialog (Ctrl+M)
  • Properties are searchable via Edit > Find/Replace

Placeholder Variables

Display property values dynamically inside labels using %property% syntax. Enable with placeholders=1 in the style:

<object label="%name%&lt;br&gt;Status: %status%&lt;br&gt;Latency: %latency%"
        id="3" placeholders="1"
        name="API Gateway"
        status="healthy"
        latency="42ms">
  <mxCell style="rounded=1;whiteSpace=wrap;html=1;placeholders=1;fillColor=#dae8fc;strokeColor=#6c8ebf;"
          vertex="1" parent="1">
    <mxGeometry x="100" y="100" width="160" height="80" as="geometry"/>
  </mxCell>
</object>

Rendered label:

API Gateway
Status: healthy
Latency: 42ms

Built-in Placeholders

Placeholder Value
%label% Cell label
%id% Cell ID
%date% Current date
%time% Current time
%timestamp% ISO timestamp
%page% Page number
%pagenumber% Page number (alias)
%pagecount% Total pages
%filename% File name

File-Level Variables

Set global variables at the <mxfile> level, accessible by all cells:

<mxfile vars='{"env":"production","version":"2.1.0","region":"us-east-1","last_updated":"2026-03-14"}'>
  <diagram id="page1" name="Status Dashboard">
    <mxGraphModel>
      <root>
        <mxCell id="0"/>
        <mxCell id="1" parent="0"/>
        <object label="Environment: %env%&lt;br&gt;Version: %version%&lt;br&gt;Region: %region%"
                id="header" placeholders="1">
          <mxCell style="text;fontSize=14;fontStyle=1;placeholders=1;" vertex="1" parent="1">
            <mxGeometry x="20" y="20" width="300" height="60" as="geometry"/>
          </mxCell>
        </object>
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>

File-level variables are inherited by all cells that use placeholders=1 and do not have a local property with the same name.

Conditional Formatting Rules

Status to Color Mapping

The most common pattern: map a property value to fill/stroke colors.

Status Fill Color Stroke Color Icon
healthy / up / ok #D5E8D4 #82B366 Green
warning / degraded #FFF2CC #D6B656 Yellow
critical / down / error #F8CECC #B85450 Red
maintenance / paused #E1D5E7 #9673A6 Purple
unknown / pending #F5F5F5 #666666 Gray
info / active #DAE8FC #6C8EBF Blue

Threshold-Based Color Gradients

Map numeric values to colors using thresholds:

Metric Green Yellow Red
Latency < 100ms 100-500ms > 500ms
CPU < 60% 60-85% > 85%
Error Rate < 1% 1-5% > 5%
Uptime > 99.9% 99-99.9% < 99%
Disk < 70% 70-90% > 90%

Boolean Visibility

Show or hide elements based on boolean properties:

Condition Visible Style Hidden Style
Feature enabled opacity=100; opacity=20;dashed=1;
Service active Normal styles strokeColor=#CCCCCC;fillColor=#F5F5F5;fontColor=#999999;
Deprecated Normal + label dashed=1;dashPattern=8 4;fontStyle=2; (italic)

Enumeration to Shape/Icon

Map state values to different visual representations:

State Visual
running Green circle icon
stopped Red square icon
starting Yellow spinner icon
terminating Orange triangle icon

Python Update Script

Full-featured script that reads a data source and updates diagram XML:

#!/usr/bin/env python3
"""
update_diagram.py - Update draw.io diagram with live data.

Usage:
    python update_diagram.py --input arch.drawio --output arch-live.drawio --data-url https://api.example.com/health
    python update_diagram.py --input arch.drawio --output arch-live.drawio --data-file status.json
"""

import xml.etree.ElementTree as ET
import json
import argparse
import re
import sys
import urllib.request
import urllib.error
import base64
import zlib
from datetime import datetime, timezone


# Status-
Полный SKILL.md на GitHub

Установить Conditional Formatting в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Conditional Formatting?

Data-driven conditional formatting, live data binding, and dynamic diagram updates for draw.io

Как установить скилл Conditional Formatting?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Conditional Formatting запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Conditional Formatting с