Razer Chroma Node.js allows you to control the lights on Razer Chroma devices using node.js
Use the package manager npm to install Razer Chroma node.js.
npm install razer-chroma-nodejs
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);
});
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.
Colors
Chroma.colors
List of pre defined ColorsChroma.colors.rgb(r, g, b)
Use an RGB color
Devices
Chroma.effects.mouse
Mouse specific effectsChroma.effects.mousepad
Mousepad specific effectsChroma.effects.headset
Headset specific effectsChroma.effects.keyboard
Keyboard specific effectsChroma.effects.keypad
Keypad specific effectsChroma.effects.chromalink
Chromalink specific effectsChroma.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 lightsrandom
Randomizes every key's color. This is looped and needs to be cleared