BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Change color of text on Blynk NodeJS

How does one change the color of text in a value widget in Node.js?

Got it:

    const Blynk = require("blynk-library"); // Links variable 'Blynk' to the Blynk Library
    const AUTH = "xxxx";
    const options = {
      connector: new Blynk.TcpClient()
    };
    const blynk = new Blynk.Blynk(AUTH, options);
    const BLYNK_MACHINE = 0;
    const blynkVirtualMachinePin = new blynk.VirtualPin(BLYNK_MACHINE);
    blynk.on("connect", () => {
     blynk.setProperty(BLYNK_MACHINE , "color", "#D3435C"); //Blynk Red
     blynkVirtualMachinePin.write("MACHINE");
     blynk.syncAll();
})

The important thing is to do it inside the connect callback otherwise it won’t take effect

1 Like