{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/color","auth":"required","examples":{"codes":[{"code":"curl \"https://api.lifx.com/v1/color?string=green\" \\\n     -H \"Authorization: Bearer [[app:Token]]\"","language":"curl"},{"language":"php","code":"<?php\n\n$string = '#674322'\n$link = \"https://api.lifx.com/v1/color?string=\";\n$authToken = \"[[app:Token]]\";\n\n$headers = array('Authorization: Bearer ' . $authToken);\n\n$ch = curl_init($link . urlencode($string));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n$response = curl_exec($ch);\n\n?>"},{"code":"import requests\n\ntoken = \"[[app:Token]]\"\n\nheaders = {\n    \"Authorization\": \"Bearer %s\" % token,\n}\n\nstring = \"hue:120 saturation:1.0 brightness:0.5\"\n\nresponse = requests.get('https://api.lifx.com/v1/color', data={'string': string}, headers=headers)","language":"python"}]},"method":"get","params":[{"name":"string","type":"string","default":"","desc":"Color string you'd like to validate","required":true,"in":"query","ref":"","_id":"55f63d46fe4cce21005c785f"}],"results":{"codes":[{"status":200,"language":"json","code":"// `red` was passed as `string`\n{\n\t\"hue\": 0,\n  \"saturation\": 1.0,\n  \"brightness\": null,\n  \"kelvin\": null\n}","name":""},{"status":422,"language":"json","code":"// This is returned if the color string is not valid\n// Example: \"saturation:2\"\n{\n\t\"error\": \"saturation is outside of range: 0–1\"\n}"}]},"settings":""},"next":{"description":"","pages":[]},"title":"Validate Color","type":"endpoint","slug":"validate-color","excerpt":"Validate a color string","body":"This endpoint lets you validate a user's color string and return the hue, saturation, brightness and kelvin values that the API will interpret as.","updates":[],"order":15,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"55f63d46fe4cce21005c785e","__v":1,"version":{"version":"1","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["55f28172f9f3991900f38a14","55f28172f9f3991900f38a15","55f28172f9f3991900f38a16","55f66acb297b37170058accb","5d229ff5e59b8e003ab3a9da"],"_id":"55f28172f9f3991900f38a13","project":"54ebb40d6423300d003672c0","releaseDate":"2015-09-11T07:23:30.065Z","createdAt":"2015-09-11T07:23:30.065Z","__v":3},"editedParams2":true,"project":"54ebb40d6423300d003672c0","createdAt":"2015-09-14T03:21:42.414Z","editedParams":true,"githubsync":"","user":"5580f88e8625220d00429b74","category":{"sync":{"isSync":false,"url":""},"pages":["55f28173f9f3991900f38a1d","55f28173f9f3991900f38a1e","55f28173f9f3991900f38a1f","55f28173f9f3991900f38a20","55f28173f9f3991900f38a21","55f28173f9f3991900f38a22","55f28173f9f3991900f38a23","55f28173f9f3991900f38a24","55f28173f9f3991900f38a25","55f28173f9f3991900f38a26","55f28173f9f3991900f38a27","55f63d46fe4cce21005c785e","55f65cc16be5ea0d00bbbf4c"],"title":"API Endpoints","slug":"api-endpoints","order":2,"from_sync":false,"reference":false,"_id":"55f28172f9f3991900f38a16","__v":3,"createdAt":"2015-06-17T05:23:31.147Z","project":"54ebb40d6423300d003672c0","version":"55f28172f9f3991900f38a13"},"parentDoc":null}

getValidate Color

Validate a color string

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Query Params

string:
required
string
Color string you'd like to validate

Examples


Result Format


Documentation

This endpoint lets you validate a user's color string and return the hue, saturation, brightness and kelvin values that the API will interpret as.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}