• I'm trying to upgrade widhrt with a better icon.

    I'm using the imageconverter at:
    https://espruino.github.io/EspruinoWebTo­ols/examples/imageconverter.html

    I wanted to use a full RED heart when the HRM is on, and then White or Black when Off depending on background. The existing image works fine except it uses grey when off and the image is quite delicate and hard to see, my original choice - not so good.

    So I have downloaded a new image of a full red heart on a transparent background.
    https://icons8.com/icons/set/heart

    I am just struggling to get the color fill to work. No matter what options I seem to choose from the
    imageconverter I either just get a RED heart or a white heart on a black background.

    File below
    and code below.
    What am I doing wrong ?

    (function(){
      if (!Bangle.isHRMOn) return; // old firmware
      var hp = Bangle.setHRMPower;
      Bangle.setHRMPower = () => {
        hp.apply(Bangle, arguments);
        WIDGETS.widhrt.draw();
      };
    
      WIDGETS.widhrt={area:"tr",width:24,draw:­function() {
        g.reset();
        if (Bangle.isHRMOn()) {
          g.setColor('#f00');     // on = red
        } else {
          g.setColor(g.theme.dark ? '#0f0' : '#00f'); // off
        }
    
        // 3 bit rgb, no options, just red heart on black all the time
        g.drawImage(atob("FBQDAAAAAAAAAAAAAAAAAA­AAAAEgAAEgAAAkkkgEkkkAEkkkkkkkkgEkkkkkkk­kgEkkkkkkkkgEkkkkkkkkgEkkkkkkkkgEkkkkkkk­kgAkkkkkkkkAAEkkkkkkgAAAkkkkkkAAAAEkkkkg­AAAAAkkkkAAAAAAEkkgAAAAAAAkkAAAAAAAAEgAA­AAAAAAAAAAAAAAAAAAAAAA"), 1+this.x, 1+this.y);
        
        // 3 bit rgb, transparency:Y, background follows theme, but wont fill with color
        //g.drawImage(atob("FBSDAAAAAAAAAAAAAAAA­AAAAAAAAAAAAAAAABJJAAJJAAAJJJIBJJJAAJJJJ­JJJJABJJJJJJJJIBJJJJJJJJIAJJJJJJJJAAJJJJ­JJJJAABJJJJJJIAAAJJJJJJAAAABJJJJIAAAAAJJ­JJAAAAAABJJIAAAAAAAJJAAAAAAAABIAAAAAAAAA­AAAAAAAAAAAAAAAAAAAAAAAAAA=="), 1+this.x, 1+this.y);
    
        // 3 bit rgb, transparency:Y, transpareny to color Y, just shows white all the time
        //g.drawImage(atob("FBSDAAAAAAAAAAAAAAAA­AAAAAAAAAAAAAAAAB//wAP/wAAP//+B///wAP///­////wB////////+B////////+AP///////wAP///­////wAB//////+AAAP/////wAAAB////+AAAAAP/­//wAAAAAB//+AAAAAAAP/wAAAAAAAB+AAAAAAAAA­AAAAAAAAAAAAAAAAAAAAAAAAAA=="), 1+this.x, 1+this.y);
    
        // 3 bit rgb, transpareny to color Y, black background, white heart
        //g.drawImage(atob("FBQDAAAAAAAAAAAAAAAA­AAAAAAAAAAAAAAAH//AA//AAA///4H///AA/////­///AH////////4H////////4A////////AA/////­///AAH//////4AAA//////AAAAH////4AAAAA///­/AAAAAAH//4AAAAAAA//AAAAAAAAH4AAAAAAAAAA­AAAAAAAAAAAAAAAAAAAAAAAA"), 1+this.x, 1+this.y);
        
      }};
    })();
    
    
    

    2 Attachments

    • icons8-heart-20.png
    • Screenshot 2023-09-13 19.16.52.png
About

Avatar for HughB @HughB started