Razer Chroma Node.js
Razer Chroma Node.js allows you to control the lights on Razer Chroma devices using node.js
Installation
Use the package manager npm to install Razer Chroma node.js.
npm install razer-chroma-nodejs
Usage
Example
const Chroma = require("razer-chroma-nodejs");
// Initialize Chroma
Chroma.util.init(() => {
console.log("Chroma Editing Started");
// Set the mouse color to green
Chroma.effects.mouse.setColor(Chroma.colors.GREEN);
// Close Chroma after 5 seconds
setTimeout(() => {
Chroma.util.close(() => {
console.log("Chroma Editing Stopped");
});
}, 5000);
});
Initialize & Close
Chroma.util.init(callback);
Must be called to do anything with Chroma, Chroma is ready when callback is called.
Chroma.util.close(callback);
Must be called to close Chroma. Chroma is closed when callback is called.
Effects
Colors
-
Chroma.colors
List of pre defined Colors -
Chroma.colors.rgb(r, g, b)
Use an RGB color
Devices
-
Chroma.effects.mouse
Mouse specific effects -
Chroma.effects.mousepad
Mousepad specific effects -
Chroma.effects.headset
Headset specific effects -
Chroma.effects.keyboard
Keyboard specific effects -
Chroma.effects.keypad
Keypad specific effects -
Chroma.effects.chromalink
Chromalink specific effects -
Chroma.effects.all
Effects for all devices
All Devices:
-
.setColor(color)
Change static color -
.cycleSpectrum()
Cycle through the color spectrum. This is looped and needs to be cleared -
.off()
Turn the lights off -
.clear()
Clear non-static effects
Mousepad:
-
.wave(direction)
Create a wave effect around the mousepad (0 or 1 for direction). This is looped and needs to be cleared
Keyboard:
-
gaming
Sets WASD & arrow keys as white, turns off all other lights -
random
Randomizes every key's color. This is looped and needs to be cleared