影像編輯器:JavaScript 程式庫

影像編輯器的資料和輔助函式:調色盤、形狀、顏色轉換和 29 種語言的命名顏色。

  • @openlibsdev/image-editor
  • v1.0.0
  • ES module
  • MIT

安裝

使用打包工具或 Node 風格的匯入:

npm install @openlibsdev/image-editor
import ImageEditor from "@openlibsdev/image-editor";

或直接在頁面中使用,無須建置(jsDelivr 會解析相依套件):

<script type="module">
import ImageEditor from "https://cdn.jsdelivr.net/npm/@openlibsdev/image-editor@1.0.0/+esm";
</script>

用法

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}。

相依套件

程式庫載入的內容與其授權(全部列於「授權條款」頁面)。

名稱版本授權檔案
@openlibsdev/font-forge1.0.0MITGitHub
@openlibsdev/image-forge1.0.0MITGitHub
@imagemagick/magick-wasm0.0.35Apache-2.0 授權 · 原始碼
@imagemagick/magick-wasm0.0.35Apache-2.0 授權 · 原始碼
@simonwep/pickr1.10.2MIT 授權 · 原始碼
@simonwep/pickr1.10.2MIT 授權 · 原始碼
dejavu-fonts-ttf2.37.3Bitstream Vera Fonts License (free, redistributable); DejaVu changes are public domain 授權 · 原始碼
fabric5.3.0MIT 授權 · 原始碼
imagetracerjs1.2.6Unlicense 授權 · 原始碼
jspdf2.5.2MIT 授權 · 原始碼