wp-styler-ai
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

WPStylerAI

An npm library for WordPress theme creators: Easily convert image-based color palettes into theme.json structures using this Node.js library powered by AI through the OpenRouter API and Google: Gemini Flash 2.0 Experimental.

Current version


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.

Dependents (0)

Package Sidebar

Install

npm i wp-styler-ai

Weekly Downloads

569

Version

0.0.9

License

MIT

Unpacked Size

209 kB

Total Files

10

Last publish

Collaborators

  • hosseinkarami