You are reading a single comment by @Andreas_Rozek and its replies. Click here to read the full conversation.
  • In the last few days, the thread Graphics Color questions has been hijacked for several small example programs related to several..."graphics color questions".

    In order to simplify finding more specific solutions, I've started a new thread for the following example, namely:

    a small color wheel using colors with "full" (0 and 1) and "half" (0.5) values

      let ColorList = [
        '#0000FF', '#8000FF', '#FF00FF', '#FF0080', '#FF0000', '#FF8000',
        '#FFFF00', '#80FF00', '#00FF00', '#00FF80', '#00FFFF', '#0080FF'
      ];
    
      let ScreenWidth  = g.getWidth(),  CenterX = ScreenWidth/2;
      let ScreenHeight = g.getHeight(), CenterY = ScreenHeight/2;
      
      let outerRadius = Math.min(CenterX,CenterY) * 0.9;
      let innerRadius = outerRadius*0.5;
      
      let sin = Math.sin, cos = Math.cos;
      let twoPi = 2*Math.PI;
      
      let DeltaPhi = twoPi/72;
      let Epsilon  = 0.001;
    
      g.clear();
      
      g.setColor(0,0,0);
      g.fillRect(0,0, ScreenWidth,ScreenHeight);
    
      for (let i = 0; i < 12; i++) {
        let Phi0 = i * twoPi/12, Phi1 = (i+1) * twoPi/12;
        
        let Polygon = [];
          for (let Phi = Phi0; Phi <= Phi1+Epsilon; Phi += DeltaPhi) {
            Polygon.push(CenterX + outerRadius * sin(Phi));
            Polygon.push(CenterY - outerRadius * cos(Phi));
          }
        
          for (let Phi = Phi1; Phi >= Phi0-Epsilon; Phi -= DeltaPhi) {
            Polygon.push(CenterX + innerRadius * sin(Phi));
            Polygon.push(CenterY - innerRadius * cos(Phi));
          }
        g.setColor(ColorList[i]);
        g.fillPoly(Polygon);
      }
    

    Hopefully it will help you finding proper good-looking colors


    1 Attachment

    • BangleJS2-ColorWheel.png
About