Skip to content

A (javascript) library that makes it easy to create Razer Chroma effects, build on websocket (comes with build-in function to display text)

License

Notifications You must be signed in to change notification settings

bimsie20-IT/RazerSDKjs-3.0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

RazerSDKjs-3.0

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)




Documentation

Initialization


// 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'); }
);



Uninitialization


// Closing the connection with the WebSocket
obj.stopAPI(APIsocket);




Static effects


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 ] ];



Displaying text


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 ! )



Parsing INT_BGR-colors from CSS_RGB-colors


obj.parseBGRIntFromCSS(color);


PARAMETERS
color = STRING('#000000' - '#ffffff') (The CSS-color you want to parse into an integer)

About

A (javascript) library that makes it easy to create Razer Chroma effects, build on websocket (comes with build-in function to display text)

Resources

License

Stars

Watchers

Forks

Packages

No packages published