Returns an array of colors from the specified list, with distance calculations
to show how close each match is to the requested colors. When providing multiple
values, the endpoint will find the closest match for each color.
If no colors are provided, returns all colors from the specified list.
When the server has socket.io enabled, this endpoint will also emit a 'colors' event
with the same response data to all connected socket clients.
curl -X GET \
-H "Accept: application/json" \
"https://api.color.pizza/v1/?list=&values=values_example&noduplicates=true&goodnamesonly=true&description=true"
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;
import java.io.File;
import java.util.*;
public class DefaultApiExample {
public static void main(String[] args) {
// Create an instance of the API class
DefaultApi apiInstance = new DefaultApi();
PossibleLists list = ; // PossibleLists | The name of the color name list to use (case-sensitive)
String values = values_example; // String | A comma-separated list of hex values (e.g., `FF0000,00FF00` do not include the `#`)
Boolean noduplicates = true; // Boolean | When true, ensures each color gets a unique name even when colors are similar
Boolean goodnamesonly = true; // Boolean | When true, uses the 'bestOf' list automatically
Boolean description = true; // Boolean | When true, adds a `description` object with words describing each requested color.
Ignored when no `values` are given (full lists).
String xReferrer = my-app-name; // String | Custom header for explicit referrer tracking. When provided, this value is used instead of
standard referrer headers and is included in socket.io event data. Useful for attribution
and analytics, especially in environments where standard referrer headers might be stripped.
try {
ColorResponse result = apiInstance.getColorNames(list, values, noduplicates, goodnamesonly, description, xReferrer);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#getColorNames");
e.printStackTrace();
}
}
}
import org.openapitools.client.api.DefaultApi;
public class DefaultApiExample {
public static void main(String[] args) {
DefaultApi apiInstance = new DefaultApi();
PossibleLists list = ; // PossibleLists | The name of the color name list to use (case-sensitive)
String values = values_example; // String | A comma-separated list of hex values (e.g., `FF0000,00FF00` do not include the `#`)
Boolean noduplicates = true; // Boolean | When true, ensures each color gets a unique name even when colors are similar
Boolean goodnamesonly = true; // Boolean | When true, uses the 'bestOf' list automatically
Boolean description = true; // Boolean | When true, adds a `description` object with words describing each requested color.
Ignored when no `values` are given (full lists).
String xReferrer = my-app-name; // String | Custom header for explicit referrer tracking. When provided, this value is used instead of
standard referrer headers and is included in socket.io event data. Useful for attribution
and analytics, especially in environments where standard referrer headers might be stripped.
try {
ColorResponse result = apiInstance.getColorNames(list, values, noduplicates, goodnamesonly, description, xReferrer);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#getColorNames");
e.printStackTrace();
}
}
}
// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
PossibleLists *list = ; // The name of the color name list to use (case-sensitive) (optional) (default to null)
String *values = values_example; // A comma-separated list of hex values (e.g., `FF0000,00FF00` do not include the `#`) (optional) (default to null)
Boolean *noduplicates = true; // When true, ensures each color gets a unique name even when colors are similar (optional) (default to null)
Boolean *goodnamesonly = true; // When true, uses the 'bestOf' list automatically (optional) (default to null)
Boolean *description = true; // When true, adds a `description` object with words describing each requested color.
Ignored when no `values` are given (full lists).
(optional) (default to null)
String *xReferrer = my-app-name; // Custom header for explicit referrer tracking. When provided, this value is used instead of
standard referrer headers and is included in socket.io event data. Useful for attribution
and analytics, especially in environments where standard referrer headers might be stripped.
(optional) (default to null)
// Get color names for specific hex values
[apiInstance getColorNamesWith:list
values:values
noduplicates:noduplicates
goodnamesonly:goodnamesonly
description:description
xReferrer:xReferrer
completionHandler: ^(ColorResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var ColorNameApi = require('color_name_api');
// Create an instance of the API class
var api = new ColorNameApi.DefaultApi()
var opts = {
'list': , // {PossibleLists} The name of the color name list to use (case-sensitive)
'values': values_example, // {String} A comma-separated list of hex values (e.g., `FF0000,00FF00` do not include the `#`)
'noduplicates': true, // {Boolean} When true, ensures each color gets a unique name even when colors are similar
'goodnamesonly': true, // {Boolean} When true, uses the 'bestOf' list automatically
'description': true, // {Boolean} When true, adds a `description` object with words describing each requested color.
Ignored when no `values` are given (full lists).
'xReferrer': my-app-name // {String} Custom header for explicit referrer tracking. When provided, this value is used instead of
standard referrer headers and is included in socket.io event data. Useful for attribution
and analytics, especially in environments where standard referrer headers might be stripped.
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.getColorNames(opts, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class getColorNamesExample
{
public void main()
{
// Create an instance of the API class
var apiInstance = new DefaultApi();
var list = new PossibleLists(); // PossibleLists | The name of the color name list to use (case-sensitive) (optional) (default to null)
var values = values_example; // String | A comma-separated list of hex values (e.g., `FF0000,00FF00` do not include the `#`) (optional) (default to null)
var noduplicates = true; // Boolean | When true, ensures each color gets a unique name even when colors are similar (optional) (default to null)
var goodnamesonly = true; // Boolean | When true, uses the 'bestOf' list automatically (optional) (default to null)
var description = true; // Boolean | When true, adds a `description` object with words describing each requested color.
Ignored when no `values` are given (full lists).
(optional) (default to null)
var xReferrer = my-app-name; // String | Custom header for explicit referrer tracking. When provided, this value is used instead of
standard referrer headers and is included in socket.io event data. Useful for attribution
and analytics, especially in environments where standard referrer headers might be stripped.
(optional) (default to null)
try {
// Get color names for specific hex values
ColorResponse result = apiInstance.getColorNames(list, values, noduplicates, goodnamesonly, description, xReferrer);
Debug.WriteLine(result);
} catch (Exception e) {
Debug.Print("Exception when calling DefaultApi.getColorNames: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$list = ; // PossibleLists | The name of the color name list to use (case-sensitive)
$values = values_example; // String | A comma-separated list of hex values (e.g., `FF0000,00FF00` do not include the `#`)
$noduplicates = true; // Boolean | When true, ensures each color gets a unique name even when colors are similar
$goodnamesonly = true; // Boolean | When true, uses the 'bestOf' list automatically
$description = true; // Boolean | When true, adds a `description` object with words describing each requested color.
Ignored when no `values` are given (full lists).
$xReferrer = my-app-name; // String | Custom header for explicit referrer tracking. When provided, this value is used instead of
standard referrer headers and is included in socket.io event data. Useful for attribution
and analytics, especially in environments where standard referrer headers might be stripped.
try {
$result = $api_instance->getColorNames($list, $values, $noduplicates, $goodnamesonly, $description, $xReferrer);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->getColorNames: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;
# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();
my $list = ; # PossibleLists | The name of the color name list to use (case-sensitive)
my $values = values_example; # String | A comma-separated list of hex values (e.g., `FF0000,00FF00` do not include the `#`)
my $noduplicates = true; # Boolean | When true, ensures each color gets a unique name even when colors are similar
my $goodnamesonly = true; # Boolean | When true, uses the 'bestOf' list automatically
my $description = true; # Boolean | When true, adds a `description` object with words describing each requested color.
Ignored when no `values` are given (full lists).
my $xReferrer = my-app-name; # String | Custom header for explicit referrer tracking. When provided, this value is used instead of
standard referrer headers and is included in socket.io event data. Useful for attribution
and analytics, especially in environments where standard referrer headers might be stripped.
eval {
my $result = $api_instance->getColorNames(list => $list, values => $values, noduplicates => $noduplicates, goodnamesonly => $goodnamesonly, description => $description, xReferrer => $xReferrer);
print Dumper($result);
};
if ($@) {
warn "Exception when calling DefaultApi->getColorNames: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = openapi_client.DefaultApi()
list = # PossibleLists | The name of the color name list to use (case-sensitive) (optional) (default to null)
values = values_example # String | A comma-separated list of hex values (e.g., `FF0000,00FF00` do not include the `#`) (optional) (default to null)
noduplicates = true # Boolean | When true, ensures each color gets a unique name even when colors are similar (optional) (default to null)
goodnamesonly = true # Boolean | When true, uses the 'bestOf' list automatically (optional) (default to null)
description = true # Boolean | When true, adds a `description` object with words describing each requested color.
Ignored when no `values` are given (full lists).
(optional) (default to null)
xReferrer = my-app-name # String | Custom header for explicit referrer tracking. When provided, this value is used instead of
standard referrer headers and is included in socket.io event data. Useful for attribution
and analytics, especially in environments where standard referrer headers might be stripped.
(optional) (default to null)
try:
# Get color names for specific hex values
api_response = api_instance.get_color_names(list=list, values=values, noduplicates=noduplicates, goodnamesonly=goodnamesonly, description=description, xReferrer=xReferrer)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->getColorNames: %s\n" % e)
extern crate DefaultApi;
pub fn main() {
let list = ; // PossibleLists
let values = values_example; // String
let noduplicates = true; // Boolean
let goodnamesonly = true; // Boolean
let description = true; // Boolean
let xReferrer = my-app-name; // String
let mut context = DefaultApi::Context::default();
let result = client.getColorNames(list, values, noduplicates, goodnamesonly, description, xReferrer, &context).wait();
println!("{:?}", result);
}