wp-styler-ai
v0.0.9
Published
Generate WordPress theme.json color palettes from images using AI-powered OCR through the OpenRouter API and Gemini Flash 2.0.
Downloads
569
Maintainers
Readme
Installation
To install wp-styler-ai
, run the following command:
npm install wp-styler-ai
Usage
Here's a quick example of how to use wp-styler-ai
:
import { ocr } from "wp-styler-ai";
async function main() {
const json = await ocr({
filePath: "./test/color-palette.png", // Path to your image
apiKey: process.env.OPENROUTER_API_KEY, // OpenRouter API key
});
console.log(json);
}
main();
This script processes an image and outputs a WordPress theme.json
color palette.
How It Works
wp-styler-ai
uses Google's Gemini Flash 2.0 Experimental model via the OpenRouter API to perform Optical Character Recognition (OCR) on an image. The extracted color data is then formatted into a WordPress theme.json
color palette.
The default model used is google/gemini-2.0-flash-exp:free
.
Roadmap
- [x] Support for local image OCR
- [x] Generate WordPress
theme.json
color palettes - [ ] Add support for typography
Credits
This project was inspired by Llama OCR.