@devicechain/brand

中文文档
1.4.0发布于 2026/11/12Apache-2.0ES Module零依赖构建来源已验证近 30 天下载 4509

Canonical DeviceChain brand tokens, plus the generated per-consumer stylesheets.

原始使用文档
文档目录7 节
  1. Using it
  2. Working on it
  3. Why three stylesheets and not one
  4. Why the values are stored as hex
  5. The one rule
  6. What verify is for, and what it is not
  7. Migration status

@devicechain/brand

The canonical DeviceChain brand values, and the generated stylesheets each consumer actually needs.

tokens.json is the source of truth. Everything in css/ and tokens.generated.json is generated from it and carries a do-not-hand-edit header.

Using it

npm install @devicechain/brand
/* whichever vocabulary your app speaks — see the table below */
@import '@devicechain/brand/css/shadcn.css';
import tokens from '@devicechain/brand/tokens';

There is no build step and no JavaScript to run: the stylesheets and the generated token JSON are shipped as-is.

Working on it

npm run generate -w @devicechain/brand         # regenerate after editing tokens.json
npm run check:generated -w @devicechain/brand  # fail if the committed output is stale
npm run verify -w @devicechain/brand           # report consumers that disagree

# the marketing site lives in a separate repo, so point at it explicitly
DC_WEBSITE=../devicechain-website npm run verify -w @devicechain/brand

Why three stylesheets and not one

The three consumers do not share a vocabulary, and a single stylesheet cannot serve them:

consumerfilevocabularyvalue format
marketing sitecss/brand.css--brand, --ink, --bg, accentshex
consolecss/shadcn.css--primary, --ring, --sidebar-*bare H S% L% triples
docscss/infima.css--ifm-color-primary*hex, plus a five-step ramp

Two details that are easy to get wrong:

  • The console's triples have no hsl() wrapper. shadcn composes them as hsl(var(--primary) / <alpha>), so wrapping them breaks every alpha variant.
  • Infima wants a five-step ramp either side of primary. It is generated from the single canonical value so the steps cannot drift out of order, which is the usual failure mode of a hand-written ramp.

css/shadcn.css and css/infima.css deliberately cover brand-derived tokens only. The console still owns the rest of its shadcn scale (card, popover, chart-*, sidebar-* surfaces) and the docs site still owns its own background theming.

Why the values are stored as hex

The brandmark artwork is hex (branding/logos/logo.svg), so hex is the origin and every other form is derived. This is not cosmetic. The console previously declared the brand blue as the rounded triple 197 71% 42%, which renders #1f8cb7 — not the #208cb7 in the artwork. One channel out of 255, invisible to the eye, and still two different colours claiming to be the same one. Deriving removes that entire class of mismatch.

The one rule

core.primary is the only colour that ever means interactive. The four accents (aqua → violet → magenta → amber, in pipeline order: ingest, detect, react, command) identify an area. They never mark a link, a button or a control. Break that and a page stops being navigable.

What verify is for, and what it is not

"Keep it in step with the console" was a comment in three files, not a guarantee — and it had already failed twice by the time this package was written. verify turns that comment into something a CI job can enforce.

It is deliberately read-only. It prints what disagrees and exits non-zero; it never rewrites a consumer. Changing a shipped colour is a visual decision, so migrate consumers one at a time and look at the result. Do not bulk-rewrite to silence the script.

Migration status

The console and dashboard viewer import css/shadcn.css; the docs site imports css/infima.css. These consumers use the generated values directly. The marketing site lives in a separate repository; use DC_WEBSITE with verify to check its current values.

版本与发布记录

@devicechain/brand 共发布 48 个版本,首次发布于 2026/09/02;过去 12 个月发布了 48 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.4.0latest2026/11/12今天
1.4.0-rc.2next2026/11/11今天
1.4.0-rc.12026/11/111 天前
1.3.02026/11/092 天前
1.3.0-rc.12026/11/092 天前
1.2.02026/11/083 天前

关于 @devicechain/brand 的常见问题

@devicechain/brand 是什么?

Canonical DeviceChain brand tokens, plus the generated per-consumer stylesheets.

如何安装 @devicechain/brand?

在项目目录运行 npm install @devicechain/brand,或使用 pnpm add / yarn add / bun add。

@devicechain/brand 支持 TypeScript 吗?

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

@devicechain/brand 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@devicechain/brand 可以商用吗?

@devicechain/brand 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@devicechain/brand 的下载量有多少?

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

@devicechain/brand 还在维护吗?

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