{"__v":0,"_id":"55f63d46fe4cce21005c785e","category":{"__v":3,"_id":"55f28172f9f3991900f38a16","pages":["55f28173f9f3991900f38a1d","55f28173f9f3991900f38a1e","55f28173f9f3991900f38a1f","55f28173f9f3991900f38a20","55f28173f9f3991900f38a21","55f28173f9f3991900f38a22","55f28173f9f3991900f38a23","55f28173f9f3991900f38a24","55f28173f9f3991900f38a25","55f28173f9f3991900f38a26","55f28173f9f3991900f38a27","55f63d46fe4cce21005c785e","55f65cc16be5ea0d00bbbf4c"],"project":"54ebb40d6423300d003672c0","version":"55f28172f9f3991900f38a13","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-06-17T05:23:31.147Z","from_sync":false,"order":2,"slug":"api-endpoints","title":"API Endpoints"},"editedParams":true,"editedParams2":true,"project":"54ebb40d6423300d003672c0","user":"5580f88e8625220d00429b74","version":{"__v":2,"_id":"55f28172f9f3991900f38a13","project":"54ebb40d6423300d003672c0","createdAt":"2015-09-11T07:23:30.065Z","releaseDate":"2015-09-11T07:23:30.065Z","categories":["55f28172f9f3991900f38a14","55f28172f9f3991900f38a15","55f28172f9f3991900f38a16","55f66acb297b37170058accb"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-09-14T03:21:42.414Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"curl","code":"curl \"https://api.lifx.com/v1/color?string=green\" \\\n     -H \"Authorization: Bearer [[app:Token]]\""},{"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?>","language":"php"},{"language":"python","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)"}]},"method":"get","results":{"codes":[{"name":"","code":"// `red` was passed as `string`\n{\n\t\"hue\": 0,\n  \"saturation\": 1.0,\n  \"brightness\": nil,\n  \"kelvin\": nil\n}","language":"json","status":200},{"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}","language":"json","status":422}]},"settings":"","auth":"optional","params":[{"_id":"55f63d46fe4cce21005c785f","ref":"","in":"query","required":true,"desc":"Color string you'd like to validate","default":"","type":"string","name":"string"}],"url":"/color"},"isReference":false,"order":10,"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.","excerpt":"Validate a color string","slug":"validate-color","type":"endpoint","title":"Validate Color"}

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 }}