title: How to Judge if a Color is Green?
body: <p>What is the formula for deciding if an rgb code is green?
  Here is an attempt:</p>
  <pre><code>public boolean isGreen(Color color){
          return (color.getGreen() &gt; 0.8*(color.getBlue()) &amp;&amp; color.getBlue() &gt; color.getRed());
      }
  </code></pre>
  <p>That is, return true if the green value of rgb is considerably greater than the blue, and the blue is greater than the red.
  A test was conducted on its accuracy.</p>
  <p>Methods:
  A JavaFX program generated 132 orbs every 6 seconds, each with an rgba (alpha is irrelevant in this case) value of</p>
  <pre><code>(Math.random(), Math.random(), Math.random(), Math.random())
  </code></pre>
  <p>The program printed the result of <code>isGreen(randomColor())</code>.</p>
  <p>Then, the author tallied the results in one of four quadrants:</p>
  <ol>
  <li><code>isGreen()</code> returns true, but the color is perceptually not green</li>
  <li><code>isGreen()</code> returns true, and the color is perceptually green.</li>
  <li><code>isGreen()</code> returns false, but the color is perceptually green.</li>
  <li><code>isGreen()</code> returns false, and the color is not perceptually green.</li>
  </ol>
  <p>It predicted satisfactorily if a color was not green: 72/99 correctly, or 73%.
  That is enough; also, it is more consequential to the program if it wrongly predicts a color as green, rather than incorrectly discarding a green color.</p>
  <p>In contrast, it cannot predict whether a color is green. It predicted 13/31 correctly, or 42%.
  This is the crucial part, and it does not work. It is not satisfactory to have 58% false positives.</p>
  <p>An accurate formula would be much appreciated!</p>
  <p>Here is a diagram to elucidate the current results:
  <a href="https://i.stack.imgur.com/JsxiG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JsxiG.png" alt="enter image description here" /></a></p>