# 影像編輯器 — 開發人員程式庫

影像編輯器的資料和輔助函式：調色盤、形狀、顏色轉換和 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-Hant/app/image-editor/
