# 图像编辑器 — 开发者库

图像编辑器的数据和辅助函数：调色板、形状、颜色转换和 29 种语言的命名颜色。

## 安装

```sh
npm install @openlibsdev/image-editor
```

```js
import ImageEditor from "https://cdn.jsdelivr.net/npm/@openlibsdev/image-editor@1.0.0/+esm";
```

## 用法

```js
import ImageEditor from "@openlibsdev/image-editor";

console.log(ImageEditor.toHex("rgb(13, 110, 253)"));   // "#0d6efd"
console.log(ImageEditor.hexA("#0d6efd", 0.5));
const color = await ImageEditor.findNamedColor("dark blue", "en");
```

## API

### `ImageEditor.toHex(c)`

任意 CSS 颜色 → #rrggbb。

### `ImageEditor.hexA(hex, a)`

带透明度的颜色。

### `ImageEditor.PALETTE`

默认调色板。

### `ImageEditor.SHAPES`

形状。

### `ImageEditor.starPoints()`

星形的顶点。

### `ImageEditor.findNamedColor(text, lang)`

按指定语言的颜色名称查找命名颜色（“深蓝色”→ #00008b）。

### `ImageEditor.listNamedColors(lang)`

列出命名颜色及其在指定语言中的名称。

### `ImageEditor.EXTRA`

除标准属性（名称、锁定、id、混合模式）外随项目保存的对象属性名称。

### `ImageEditor.LBL`

按对象类型的默认图层名称（矩形、椭圆、文本、图像、组、…）。

### `ImageEditor.namedColorTexts(lang)`

指定语言的颜色字段标签（取色器的文本），缺少该语言时为英文。

### `ImageEditor.textFontData`

文本和字体区块的数据：字体列表、加载字形样式、添加字体文件、某种语言的区块标签以及默认值。

### `ImageEditor.APP`

库的名称和版本：{name, version}。

## 依赖

- @imagemagick/magick-wasm 0.0.35 (Apache-2.0)
- @imagemagick/magick-wasm 0.0.35 (Apache-2.0)
- @simonwep/pickr 1.10.2 (MIT)
- @simonwep/pickr 1.10.2 (MIT)
- dejavu-fonts-ttf 2.37.3 (Bitstream Vera Fonts License (free, redistributable); DejaVu changes are public domain)
- fabric 5.3.0 (MIT)
- imagetracerjs 1.2.6 (Unlicense)
- jspdf 2.5.2 (MIT)

- GitHub: https://github.com/OpenLibsDev/image-editor
- npm: https://www.npmjs.com/package/@openlibsdev/image-editor
- 打开应用: https://openlibs.dev/zh-Hans/app/image-editor/
