Razer Chroma SDK  v3.2
Razer Chroma SDK REST Documentation
Creating effects on Keyboards

Creating effects on Keyboards by sending PUT or POST to the URI. POST will return an effect id.

Endpoint

/keyboard

Remarks

Each parameters are different depending on the types of effect. Data parameters closely represented by the data structures in the C++ interface defined in RzChromaSDKTypes.h.


To turn off effect use CHROMA_NONE.

Method

PUT/POST

JSON Data

Field Description Type
"effect" Effect type String
{
    "effect": "CHROMA_NONE"
}

Response (PUT):

Field Description Type
"result" Error code defined in RzErrors.h Number
{
    "result" : 0
}

Response (POST):

Field Description Type
"result" Error code defined in RzErrors.h. Number
"id" An identifier associated with the effect String
{
    "result" : 0
    "id": "9E61C0E2-9E46-4EC9-962C-9E36C7FE20C3"
}

To create a static effect use CHROMA_STATIC and specify the color value.

Method

PUT/POST

JSON Data

Field Description Type
"effect" Effect type. String
"param" Effect definition Object
"color" Color value in BGR format Number
{
    "effect": "CHROMA_STATIC",
    "param": {
        "color": 255
    }
}

Response (PUT):

Field Description Type
"result" Error code defined in RzErrors.h Number
{
    "result" : 0
}

Response (POST):

Field Description Type
"result" Error code defined in RzErrors.h. Number
"id" An identifier associated with the effect String
{
    "result" : 0
    "id": "9E61C0E2-9E46-4EC9-962C-9E36C7FE20C3"
}

To create custom effects for newer keyboards, use CHROMA_CUSTOM2. Set the colors in the color array and the keys color in the key array.

Method

PUT/POST

JSON Data

Field Description Type
"effect" Effect type. String
"param" 2 sets of 2 dimensional arrays of size 8 rows by 24 columns each. Object
"color" 8 by 24 columns of array containing the value of color in BGR format Array
"key" 6 by 22 columns of array containing the value of color on the specific key at the location in BGR format. Specify a bit mask of 0x01000000 (16777216) with the color value for each keys that has an effect. Array
{
    "effect":"CHROMA_CUSTOM_KEY",
    "param":{
        "color":[
            [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535, 65535, 65535],
            [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535, 65535, 65535],
            [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535, 65535, 65535],
            [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535, 65535, 65535],
            [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535, 65535, 65535],
            [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535, 65535, 65535]
        ],
        "key":[
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, (16777216 | ~255), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, (16777216 | ~255), (16777216 | ~255), (16777216 | ~255), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (16777216 | ~16776960), 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (16777216 | ~16776960), (16777216 | ~16776960), (16777216 | ~16776960), 0, 0, 0, 0]
        ]
    }
}

Response (PUT):

Field Description Type
"result" Please refer to RzError.h Number
{
    "result" : 0
}

Response (POST):

Field Description Type
"result" Error code defined in RzErrors.h. Number
"id" An identifier associated with the effect String
{
    "result" : 0
    "id": "9E61C0E2-9E46-4EC9-962C-9E36C7FE20C3"
}

To create a custom effect use CHROMA_CUSTOM and fill in the colors in each element in the array.

Method

PUT/POST

JSON Data

Field Description Type
"effect" Effect type. String
"param" 2 dimensional array of size 6 rows by 22 columns. Each cell contains the color value in BGR format Array
{
    "effect":"CHROMA_CUSTOM",
    "param":[
        [ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 ],
        [ 65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280 ],
        [ 16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680 ],
        [ 65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535 ],
        [ 16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960 ],
        [ 16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935 ]
    ]
}

Response (PUT):

Field Description Type
"result" Error code defined in RzErrors.h. Number
{
    "result" : 0
}

Response (POST):

Field Description Type
"result" Error code defined in RzErrors.h. Number
"id" An identifier associated with the effect String
{
    "result" : 0
    "id": "9E61C0E2-9E46-4EC9-962C-9E36C7FE20C3"
}

To create a custom effect with keys use CHROMA_CUSTOM_KEY.Specify in the colors in the color array and the keys color in the key array.

Method

PUT/POST

JSON Data

Field Description Type
"effect" Effect type. String
"param" 2 sets of 2 dimensional arrays of size 6 rows by 22 columns each. Object
"color" 6 by 22 columns of array containing the value of color in BGR format Array
"key" 6 by 22 columns of array containing the value of color on the specific key at the location in BGR format. Specify a bit mask of 0x01000000 (16777216) with the color value for each keys that has an effect. Array
{
    "effect":"CHROMA_CUSTOM_KEY",
    "param":{
        "color":[
            [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535],
            [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535],
            [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535],
            [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535],
            [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535],
            [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535]
        ],
        "key":[
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, (16777216 | ~255), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, (16777216 | ~255), (16777216 | ~255), (16777216 | ~255), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (16777216 | ~16776960), 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (16777216 | ~16776960), (16777216 | ~16776960), (16777216 | ~16776960), 0, 0, 0, 0]
        ]
    }
}

Response (PUT):

Field Description Type
"result" Please refer to RzError.h Number
{
    "result" : 0
}

Response (POST):

Field Description Type
"result" Error code defined in RzErrors.h. Number
"id" An identifier associated with the effect String
{
    "result" : 0
    "id": "9E61C0E2-9E46-4EC9-962C-9E36C7FE20C3"
}

Creating a group of effects.

Method

POST

JSON Data

Field Description Type
"effects" Array of effect definitions Array
{
    "effects":[
        {
            "effect":"CHROMA_NONE"
        },
        {
            "effect":"CHROMA_STATIC",
            "param":{
                "color":255
            }
        },
        {
            "effect":"CHROMA_CUSTOM",
            "param":[
                [ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 ],
                [ 65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280,65280 ],
                [ 16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680,16711680 ],
                [ 65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535 ],
                [ 16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960,16776960 ],
                [ 16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935,16711935 ]
            ]
        },
        {
            "effect":"CHROMA_CUSTOM_KEY",
            "param":{
                "color":[
                    [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535],
                    [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535],
                    [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535],
                    [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535],
                    [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535],
                    [255, 255, 255, 255, 255, 65280, 65280, 65280, 65280, 65280, 16711680, 16711680, 16711680, 16711680, 16711680, 16776960, 16776960, 16776960, 65535, 65535, 65535, 65535]
                ],
                "key":[
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, (16777216 | ~255), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, (16777216 | ~255), (16777216 | ~255), (16777216 | ~255), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (16777216 | ~16776960), 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (16777216 | ~16776960), (16777216 | ~16776960), (16777216 | ~16776960), 0, 0, 0, 0]
                ]
            }
        }
    ]
}

Response:

Field Description Type
"results" Array of results with effect ids Array
"id" An identifier associated with the effect String
"result" Error code defined in RzErrors.h. Number
{
    "results": [
        {
            "id": "CD4A68DA-061C-458B-B910-169AA22FF55B",
            "result": 0
        },
        {
            "id": "CB08DF54-7D0A-461A-8675-9D1BD2748C99",
            "result": 0
        },
        {
            "id": "F29AAC23-71AE-4ADE-9482-325FF1E6F92D",
            "result": 0
        },
        {
            "id": "EC11E17F-EEDE-4693-AA6D-74C92B48773E",
            "result": 0
        }
    ]
}