# How can I make a color for the flower inside

**URL:** <https://discourse.processing.org/t/how-can-i-make-a-color-for-the-flower-inside/23127>\
**Category:** Coding Questions\
**Created:** [August 8, 2020, 7:17am UTC](https://discourse.processing.org/t/how-can-i-make-a-color-for-the-flower-inside/23127 "2020-08-08T07:17:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Intissar](https://avatars.discourse-cdn.com/v4/letter/i/dfb087/32.png) [@Intissar](https://discourse.processing.org/u/Intissar)\
**Post date:** [August 8, 2020, 7:17am UTC](https://discourse.processing.org/t/how-can-i-make-a-color-for-the-flower-inside/23127/1 "2020-08-08T07:17:07Z")

</div>

```auto
float xCenter = 600 /2;
float yCenter = 600 /2;

float scale = 200;

float[] innerX; // store xPoints for the 6 points on the inner circle
float[] innerY; // store yPoints for the 6 points on the inner circle

float[] outerX;
float[] outerY;

void setup() {

  size(600, 600); // width x height

  noFill();
  rectMode(CENTER);
  ellipseMode(CENTER);

  innerX = new float[7];
  innerY = new float[7];

  outerX = new float[7];
  outerY = new float[7];
}

void draw() {
  background(255);
  noLoop();

  translate(xCenter, yCenter); 

  calculateNinnerPoints(6, 1);
  calculateNoutterPoints(6, 0.5);

  // Inner circle
  strokeWeight(8);
  ellipse(0, 0, scale, scale);
  
  for (int count = 0; count < 7; count ++) {
    stroke(#85931E);//couleur vert
    strokeWeight(8);
    ellipse(innerX[count], innerY[count], scale, scale);
  }

  for (int count = 0; count < 7; count ++) {
    stroke(#DCE01D);//couleur jaune
    strokeWeight(4);
    ellipse(innerX[count], innerY[count], scale, scale);
    
    stroke(#1A0EE0);//couleur bleu
    ellipse(0, 0, scale, scale);
  }

  // White Overlays
  fill(255, 0, 0);

  stroke(255);
  strokeWeight(1.5);
  
  save("motifislamic1.png");
} // end Draw

void calculateNinnerPoints(float numPoints, float scaleFactor) {
  // calculate and store n points around the outer circle
  int counter = 0;
  double step = radians(360/numPoints); 
  float h = 0; 
  float k = 0;
  float r = scale * scaleFactor / 2 ;
  for (float theta=0; theta < 2 * PI; theta += step) {
    float x = h + r * cos(theta);
    float y = k - r * sin(theta); 

    // store the calculated coordinates
    innerX[counter] = x;
    innerY[counter] = y;
    counter ++;
  }
} // end calculateNinnerPoints

void calculateNoutterPoints(float numPoints, float scaleFactor) {
  // calculate and store n points around the outer circle
  int counter = 0;
  double step = radians(360/numPoints); 
  float h = 0; 
  float k = 0;
  float r = scale * scaleFactor ;
  for (float theta=0; theta < 2 * PI; theta += step) {
    float x = h + r * cos(theta);
    float y = k - r * sin(theta); 

    // store the calculated coordinates
    outerX[counter] = x;
    outerY[counter] = y;

    if (counter == 2) {
      fill(255, 0, 255);
    } else
    {
      noFill();
    }

    counter ++;
  }
} // end calculateNoutterPoints

```

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [August 8, 2020, 7:47am UTC](https://discourse.processing.org/t/how-can-i-make-a-color-for-the-flower-inside/23127/2 "2020-08-08T07:47:52Z")

</div>

Hello,

Welcome to the community.

Please format your code:  
[https://discourse.processing.org/faq#format-your-code](https://discourse.processing.org/faq#format-your-code)

`:)`

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [August 8, 2020, 8:33am UTC](https://discourse.processing.org/t/how-can-i-make-a-color-for-the-flower-inside/23127/3 "2020-08-08T08:33:42Z")

</div>

Hello,

The flower inside? I will assume the circle in the middle.

Try using fill() before and noFill() after the circle inside; see the references for details.

Also look up references to pushStyle() and popStyle(); sometimes I juset use push() and pop().

You may want to look up stroke() and noStroke() while you are at it.

One of the best tools in a programmer’s tool chest is knowing the resources available to you and learning to navigate, filter, and use them.

A short list of resources to peruse:

> **Resources \< Click here to expand !**
>
> Explore the resources available here:
> 
> - The Processing _website_ has references, examples, tutorials, links to resources, etc.  
> [https://processing.org/](https://processing.org/)
> 
> - The Processing PDE (IDE) has lots to offer!  
> An exploration of the menu bar will reveal what is available; libraries, tools, local examples, and other goodies are in there.
> 
> - The Coding Train \< Experience the unbridled enthusiasm of Daniel Shiffman  
> [https://shiffman.net/](https://shiffman.net/)  
> [https://www.youtube.com/user/shiffman](https://www.youtube.com/user/shiffman)  
> [https://thecodingtrain.com/](https://thecodingtrain.com/)
> 
> - Happy Coding  
> [Processing Tutorials - Happy Coding](https://happycoding.io/tutorials/processing/)
> 
> - The source code can give insight if you are adventurous:  
> [GitHub - processing/processing: Source code for the Processing Core and Development Environment (PDE)](https://github.com/processing/processing)
> 
> - Explore Processing on GitHub:  
> [Processing Foundation · GitHub](https://github.com/processing)  
> [processing/core/src/processing/core/PApplet.java at master · processing/processing · GitHub](https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java) \< Many of the Processing functions are here!
> 
> - The Processing Foundation  
> [https://processingfoundation.org/](https://processingfoundation.org/)  
> Check out the menu.  
> In the education menu, there is a reference to the Coding Train.
> 
> - And the Internet. `:)`

`:)`
