百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
N

node-vibrant

> 编程语言
开源

从图像中提取突出的颜色

2.4K stars0 点赞1 次浏览
访问官网GitHub

工具介绍

从图像中提取突出的颜色

node-vibrant

<a href="https://bundlephobia.com/package/node-vibrant@latest"" target="_parent"> <a" target="_parent"> 从图像中提取突出的颜色。

  • Node.js、浏览器和工作环境的 API 相同

安装

bash
$ npm install node-vibrant

使用方法

typescript
// Node
import { Vibrant } from "node-vibrant/node";
// Browser
import { Vibrant } from "node-vibrant/browser";
// Web Worker
import { Vibrant } from "node-vibrant/worker";

// Using builder
Vibrant.from("path/to/image")
	.getPalette()
	.then((palette) => console.log(palette));

// Using constructor
let v = new Vibrant("path/to/image", opts);
v.getPalette().then((palette) => console.log(palette));

工作人员使用情况

量化是 node-vibrant 中最耗时的阶段。幸运的是,可以在 WebWorker 中运行量化,以避免冻结 UI 线程。 以下是如何使用此功能:

typescript
import { Vibrant, WorkerPipeline } from "node-vibrant/worker";
import PipelineWorker from "node-vibrant/worker.worker?worker";

Vibrant.use(new WorkerPipeline(PipelineWorker as never));

这需要您的打包工具处理 ?worker 转换 类似于 Vite 的方式

文档

目前,docs文件夹中包含了参考文档和逐步指导。我们还提供了一些examples文件夹,您可以根据自己的需求参考这些示例。欢迎提交 PR 来扩展这些内容!

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptcanvascolorcolourdetection

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言