A (javascript) library that makes it easy to create Razer Chroma effects, build on websocket (comes with build-in function to display text)
Try the web simulator if you like! Razer Chroma Preview (Build on RazerSDKjs-0.1)
// Creating an object called 'chroma'
let chroma = new RazerSDKjs({
applicationName: {name of your application},
description: {description of your application},
developer: {developer},
contact: {your contact information (GitHub page)}
});
// Creating a connection with the WebSocket
chroma.createSession().then(
// If a connection was established
function(APIsocket) {
// YOUR CODE
// FROM HERE FOLLOWS THE REST OF THE REST OF THE DOCUMENTATION
}
// If a connection could not be established
function(error) {
window.alert('Razer Synapse with connect plugin was not dedected');
}
);
// Closing the connection with the WebSocket
obj.stopAPI(APIsocket);
obj.sendEffect(APIsocket, deviceType, effectType, scheme);
PARAMETERS
(OFFICIAL RAZER REFERENCE)
deviceType = 'keyboard' (that's the only supported device at the time of writing)
effectType = 'CHROMA_STATIC' (since we're making a static effect)
scheme = [ (A 2-dimensional array that represents every LED on the keyboard) ( ! COLORS ARE BGR ! )
[ 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, 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, 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 ]
];
obj.displayText(APIsocket, AAlevel, delay, string, color);
PARAMETERS
(BETA) AAlevel = INT(1 - 256) (The level of anti-aliasing) (1 = OFF) ( ! 265 will be very CPU intensive and useless ! )
delay = INT(R) (The delay between every shift on the keyboard)
string = STRING({YOUR TEXT}) (The text you want to display on the keyboard)
color = INT(0 - 16777216) || INT(0x000000 - 0xffffff) (The color in which you want the text to be displayed in) ( ! COLORS ARE BGR ! )
obj.parseBGRIntFromCSS(color);
PARAMETERS
color = STRING('#000000' - '#ffffff') (The CSS-color you want to parse into an integer)