1.1.2 • Published 6 months ago

@jeet-dot-dev/hexcol v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

🎨 @jeetdev/hexcolor

A lightweight and fun utility to generate random hex colors — or get AI-powered hex codes from natural language prompts using Gemini AI.


✨ Features

  • 🔹 Generate a completely random hex color
  • 🤖 Convert natural language like "a soft mint green" into a hex code using Gemini
  • 🟦 Zero dependencies (except Gemini support if you use it)
  • 🟩 TypeScript support included

📦 Installation

npm install @jeetdev/hexcolor


## 1. Generate a random hex color
import { randomHexColor } from "@jeetdev/hexcolor";

const color = randomHexColor();
console.log(color); // 👉 "#a1f2cc"

## 2. Get hex color from prompt (uses Gemini AI)
import { getColorFromPrompt } from "@jeetdev/hexcolor";

  const color = await getColorFromPrompt("Give me a sky blue color with a hint of grey");
  console.log(color);

   // 👉 "#87aabb" (example output)


## Gemini Key
💡 Make sure you set up your .env file with a valid Gemini API key:

## env file look like in react
VITE_API_KEY=your_gemini_api_key_here

🧠 About Gemini Integration We use the @google/genai SDK to call Gemini AI and extract the first valid hex code from the result. You’ll need to:

Enable Google AI Studio

Generate an API key

Set it in your .env

1.1.2

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago