图像编辑器:JavaScript 库
图像编辑器的数据和辅助函数:调色板、形状、颜色转换和 29 种语言的命名颜色。
@openlibsdev/image-editor- v1.0.0
- ES module
- MIT
安装
使用打包工具或 Node 风格的导入:
npm install @openlibsdev/image-editorimport 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-forge | 1.0.0 | MIT | GitHub |
| @openlibsdev/image-forge | 1.0.0 | MIT | GitHub |
| @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 | 许可证 · 源代码 |