title: Java: Operations with Colors (add, subtract)? - Colors in a constant class
body: <p>I'm working with <code>java.awt.Color</code> instances. Is there any way to do arithmetic operations on colors? Something like <code>rgb(20, 20, 20) + rgb(10, 200, 170) = rgb(30, 220, 190)</code>?</p>
  
  <p>What I'm trying to do: I have a gui that features a table, where if the user clicks on a cell, the other cells change color based on their relationship to the selected one. I'm looking for a way to avoid hard coding what the base colors are, and on which color values they change.</p>
  
  <p>So the selected cell might be <code>rgb(255, 0, 0)</code>, and everything else might be between <code>rgb(0, 0, 0)</code> and <code>rgb(0, 255, 0)</code> based on their values. I'm thinking... enums?</p>
  
  <pre><code>import java.awt.Color;
  
  public enum ColorConstant {
      SELECTED (new rgb(255, 0, 0), "Red"),
      MAX_DISTANCE (new rgb(0, 255, 0), "Green")
  
      private Color shade;
      private ??? whichColorToModify;
  
  }
  </code></pre>