# Text to Color API

> Text to Color converts color names and descriptive color text into hexadecimal color codes. CSS names, hex/rgb()/hsl() values and about 900 everyday color names such as burgundy, charcoal or navy blue resolve to their real color; other text is hashed to a stable color. Paid plans add RGB, HSL, and CMYK formats.

**Endpoint:** `GET https://api.apiverve.com/v1/texttocolor`  
**Category:** Data Conversion  
**Cost:** 1 credit per call  
**Canonical page:** https://apiverve.com/marketplace/texttocolor

## Overview

Text to Color works by analyzing the text provided and converting it to a color code. It uses advanced algorithms to convert the text to a color code and returns the color code.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl "https://api.apiverve.com/v1/texttocolor?color=turquoise" \
  -H "x-api-key: YOUR_API_KEY"
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `color` | string | Yes | The text to convert the color from. length 1-inf |

## Response fields

- `color` — string · The color name derived from the natural language input
- `hex` — string · The hexadecimal color code representation
- `rgb` — string · The RGB color code representation as comma separated values · (premium)
- `hsl` — string · The HSL color code representation as comma separated values · (premium)
- `cmyk` — string · The CMYK color code representation as comma separated values · (premium)
- `ansi16` — number · The ANSI 16-color code representation of the color · (premium)
- `channels` — object · The number of channels each returned color model uses
  - `channels.rgbChannels` — number · Number of channels in the RGB color model
  - `channels.cmykChannels` — number · Number of channels in the CMYK color model
  - `channels.ansiChannels` — number · Number of channels in the ANSI color model
  - `channels.hexChannels` — number · Number of channels in the hexadecimal color model
  - `channels.hslChannels` — number · Number of channels in the HSL color model

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "color": "turquoise",
    "hex": "#66c8b8",
    "rgb": "102, 200, 184",
    "hsl": "170, 47, 59",
    "cmyk": "49, 0, 8, 22",
    "ansi16": 96,
    "channels": {
      "rgbChannels": 3,
      "cmykChannels": 4,
      "ansiChannels": 1,
      "hexChannels": 1,
      "hslChannels": 3
    }
  }
}
```

## Use cases

- **E-Commerce Product Tagging** — Online retailers map user-submitted garment color descriptions directly to standardized hex codes for accurate catalog search filters.
- **Generative Prompt Styling** — When users specify scene themes using casual phrases like ocean blue, design tools resolve the exact hex codes for canvas backgrounds.
- **Chatbot UI Customization** — Transform conversational customer preferences into hex values on the fly to preview customized dashboard themes in client settings.
- **Form Input Normalization** — Validate freeform color inputs from creative survey responses by converting spoken or written hues into unambiguous hexadecimal codes.

## SDKs

- **npm** — `npm install @apiverve/texttocolor` (https://www.npmjs.com/package/@apiverve/texttocolor)
- **PyPI** — `pip install apiverve-texttocolor` (https://pypi.org/project/apiverve-texttocolor/)
- **NuGet** — `dotnet add package APIVerve.API.TexttoColor` (https://www.nuget.org/packages/APIVerve.API.TexttoColor)
- **Source** — https://github.com/apiverve/texttocolor-api

## More

- Full reference: https://docs.apiverve.com/ref/texttocolor
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
