# @ensdomains/etherloom 中文文档

规范地址：https://npmcn.com/package/%40ensdomains/etherloom/

版本：0\.1\.0-alpha\.4
npm 元数据更新时间：2026-11-13T23:49:31.524Z
中文译文更新时间：2026-11-14T05:12:06.510Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40ensdomains/etherloom
原文对照：https://npmcn.com/package/%40ensdomains/etherloom/?lang=original
项目主页：https://github.com/ensdomains/etherloom#readme
源码仓库：https://github.com/ensdomains/etherloom

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：22.1 kB，5 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=18
- 运行依赖：0 个
- 首次发布：2026-06-26T10:34:36.591Z
- 最新版本发布：2026-07-13T11:57:06.788Z
- 近 30 天下载量：2300（2026-10-14 至 2026-11-12，npm 官方下载统计）
- 已发布版本数：4（近 12 个月 4 个）

## 中文简介

由Ethereum地址生成的定型 SVG 编织图案 .

## 安装

```sh
npm install @ensdomains/etherloom
```

也可以使用：`pnpm add @ensdomains/etherloom`、`yarn add @ensdomains/etherloom`、`bun add @ensdomains/etherloom`

## README

# 乙醇

决定性 SVG **eNS 名称的编织图案** - 基因,在链上准备 每个名字都用阿凡达 同一个名字总是出现 同一个身份,不同的 名字会变成不同的布,所以 `nick.eth` 财务报告和审定财务报表 `vibes.eth` 即时 可以区分 将一个名字绑入其所有者, 织件在名称被重新编织时 换手.

-   **(原始内容存档于2018-10-21). ENS-native.** 从名字的种子 `namehash` 所以每个名字都有自己的编织; 和主人结合 **地址** 因此,模式在转移时发生变化,或者使用 单凭身份身份 就可以继续转移.
-   **平地埃特鲁姆的地址也是.** 没有ENS名字吗? 传一个空地址给 经典钱包身份标识 - 同文库,没有附加设置,输出不变.
-   这个 **身份** 选择编织 **颜色** 是一个参数,您通过 永远不会 更改结构( 随意重新显示任何身份) .
-   **18个命名的织物**,两个渲染样式: `tiles` (默认, 图标外观 - 二通 软框上纵向药丸)和 `threads` (浓密的布料).
-   有效 **每个身份的独特性**:它决定了选择18个织物之一 (通过) `patternForIdentity` 编号 : `generateIdenticon`和种子每个变体,所以 不同的身份不会碰撞 见 [身份](https://npmcn.com/package/%40ensdomains/etherloom/#readme-identity-an-ens-name-an-address-or-both)。 。 。 .

## 使用量

```ts
import {
  generateIdenticon,
  patternForIdentity,
  generatePattern,
  generatePatternDataURI,
  generateAllPatterns,
  listPatterns,
} from "./etherloom";
import { namehash } from "viem/ens";

// ENS-native: one woven avatar per name (color is required, #RGB or #RRGGBB).
generateIdenticon({ namehash: namehash("vitalik.eth") }, "#f03090");

// Bind the name to its owner so the weave changes hands with the name.
generateIdenticon({ address: "0xd8dA…6045", namehash: namehash("vitalik.eth") }, "#f03090");

// No ENS name? A bare address still works - the classic wallet identicon.
generateIdenticon("0xd8dA…6045", "#f03090");

// Which weave a name maps to, and picking the weave yourself:
patternForIdentity({ namehash: namehash("nick.eth") });                        // -> "Herringbone", etc.
generatePattern({ namehash: namehash("nick.eth") }, "Herringbone", "#f03090"); // explicit weave override

// options: backgroundColor, style ("tiles" | "threads"), width, height, cellSize
generatePattern({ namehash: namehash("nick.eth") }, "2-2 Twill", "#3366cc", { width: 240, height: 240, cellSize: 24 });
generatePattern("0xd8dA…6045", "Herringbone", "#f03090", { style: "threads" });

generateAllPatterns({ namehash: namehash("nick.eth") }, "#2e9e5b");                    // all 18 as SVG
generatePatternDataURI({ namehash: namehash("nick.eth") }, "Basket Weave", "#ff9800"); // data: URI for <img>
```

## 身份:ENS名称、地址或两者兼有

每个入口都有一个身份 ENS - 本地路径是一个名字 **`namehash`** - 预算 `bytes32` 节点从 [维姆](https://viem.sh/)是因为 `namehash()` 或者说 `@ensdomains/ensjs`。这个库将保持无依赖性,永远不会 将名称本身正常化,所以您要通过节点,而不是名称字符串:

```ts
import { namehash } from "viem/ens";

// Name only: one avatar per name, stable across ownership transfers.
generateIdenticon({ namehash: namehash("vitalik.eth") }, "#f03090");

// Name + owner: the weave is re-woven if the name changes hands.
generateIdenticon({ address: "0xd8dA…6045", namehash: namehash("vitalik.eth") }, "#f03090");

// Power user / no ENS: a bare address string, or a zero / omitted namehash -
// the classic wallet identicon, byte-for-byte unchanged.
generateIdenticon("0xd8dA…6045", "#f03090");
generateIdenticon({ address: "0xd8dA…6045", namehash: "0x0" }, "#f03090"); // same as above
```

| `namehash` | `address` | 结果 |
| --- | --- | --- |
| 设定 | 删除 | 名字阿凡达, **各种转让之间稳定** (ENS-内在) |
| 设定 | 设定 | 名称为阿凡达 **更改所有者** |
| 零 / 省略 | 设定 | 地址标识( 功率用户/ 无 ENS) |

这个 `0x` 前缀和大小写无关紧要,全零 ENS 根 节点( e)`0x0`)是"无名"的哨来回倒入地址唯一的种子.

## 脚本

```bash
pnpm install
pnpm test        # node:test suite
pnpm demo        # console demo
pnpm gallery     # write gallery.html and open it  (optional:  pnpm gallery 0xAddr "#color")
```

## 交互式演示

`docs/` 有两个静态页面 - 输入 **ENS 名称或 Ethereum 地址** (已解决 [维姆](https://viem.sh/))和一个颜色:

-   **`identicon.html`** - 一个身份驱动编织(`generateIdenticon`(中文(简体) )
-   **`index.html`** - 所有18种模式的比较

```bash
pnpm build:web
pnpm dlx serve docs
# identicon -> http://localhost:3000/identicon.html
# all patterns -> http://localhost:3000/
```

## 模式

马特·里布(Matt Rib Irrrent ) · ENS 垂直对等 · 平地织布(Plain Weave) · 曲折平地 · 织布 常规 · 萨丁织布 · 猎犬牙 · 萨丁织布 · 皇家牛津 2–2 Twill 3–3 Twill 织接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接接 圆角-窗帘-红外骨-738对角+

## 许可证

麻省理工学院

## 常见问题

### @ensdomains/etherloom 是什么？

由Ethereum地址生成的定型 SVG 编织图案 \.

### 如何安装 @ensdomains/etherloom？

在项目目录运行 npm install @ensdomains/etherloom，或使用 pnpm add / yarn add / bun add。

### @ensdomains/etherloom 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @ensdomains/etherloom 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @ensdomains/etherloom 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=18。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @ensdomains/etherloom 可以商用吗？

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

### @ensdomains/etherloom 的下载量有多少？

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

### @ensdomains/etherloom 还在维护吗？

最新版本 0\.1\.0-alpha\.4 发布于 2026/07/13（4 个月前）；至今共发布 4 个版本，其中过去 12 个月发布了 4 个；首次发布于 2026/06/26。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

