@bpmn-io/c4-theme

中文文档
0.3.3发布于 2026/10/30MIT零依赖近 30 天下载 3万

A Camunda Design System theme for bpmn.io

原始使用文档
文档目录3 节
  1. Usage
  2. Build and Run
  3. License

@bpmn-io/c4-theme

CI

Makes bpmn.io look like the Camunda Design System (C4).

It works by re-pointing the @bpmn-io/theme semantic tokens at C4 tokens, so one import themes every bpmn.io component at once. Colour always comes from C4; the structure it implies — radii, spacing, control heights, ghost buttons — follows the shadcn/ui conventions C4 is built on.

Usage

Put .c4-ui on your application root (it carries the design system's tokens), load the base component CSS, then the shared tokens and the adapter for each component in use. The theme is scoped to .c4-ui, so importing the stylesheet is the only opt-in:

<body class="c4-ui">
  <div id="canvas"></div>
  <div id="properties-panel"></div>
</body>
import '@camunda/design-system/styles.css';
import '@bpmn-io/properties-panel/dist/assets/properties-panel.css';
import '@bpmn-io/c4-theme/assets/tokens.css';
import '@bpmn-io/c4-theme/assets/properties-panel.css';

Each adapter loads after the base CSS of the component it themes. To also theme the diagram surfaces — the palette, the search pad and the popup editor (the create, append and replace menus) — load diagram.css after the bpmn-js stylesheets:

import 'bpmn-js/dist/assets/diagram-js.css';
import 'bpmn-js/dist/assets/bpmn-js.css';
import '@bpmn-io/c4-theme/assets/tokens.css';
import '@bpmn-io/c4-theme/assets/diagram.css';

Dark mode follows the design system's own dark class — the theme carries no palette of its own, so it inherits whatever C4 resolves to.

Build and Run

Prepare the project by installing all dependencies:

npm install

Then, depending on your use-case, you may run any of the following commands:

# lint and run all tests
npm run all

# run all tests
npm test

# spin up the canonical playground to try the theme end-to-end
npm start

# capture side-by-side theme comparison screenshots into .captures/
npm run capture

To explore a narrower surface, it.only a scenario spec or spin up one of the component-specific playgrounds:

npm run start:properties-panel
npm run start:diagram
npm run start:bpmn
npm run start:dmn

License

MIT

版本与发布记录

@bpmn-io/c4-theme 共发布 7 个版本,首次发布于 2026/09/17;过去 12 个月发布了 7 个版本。

版本发布日期距今
0.3.3latest2026/10/309 天前
0.3.22026/10/2612 天前
0.3.12026/10/2018 天前
0.3.02026/10/1326 天前
0.2.02026/10/1326 天前
0.1.02026/09/221 个月前

其他发布通道:alpha → 0.0.1-alpha.0。

关于 @bpmn-io/c4-theme 的常见问题

@bpmn-io/c4-theme 是什么?

A Camunda Design System theme for bpmn.io

如何安装 @bpmn-io/c4-theme?

在项目目录运行 npm install @bpmn-io/c4-theme,或使用 pnpm add / yarn add / bun add。

@bpmn-io/c4-theme 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/bpmn-io__c4-theme 是否存在。

@bpmn-io/c4-theme 可以商用吗?

@bpmn-io/c4-theme 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@bpmn-io/c4-theme 的下载量有多少?

根据 npm 官方下载统计,@bpmn-io/c4-theme 在 2026/10/09 – 2026/11/07 这 30 天内被下载 30,437 次,日均约 1,015 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bpmn-io/c4-theme 还在维护吗?

最新版本 0.3.3 发布于 2026/10/30(9 天前);至今共发布 7 个版本,其中过去 12 个月发布了 7 个;首次发布于 2026/09/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。