title: How to color table cell groups of equal elements
body: <p>For an HTML table with numbers, I am looking for an elegant JavaScript/CSS way to identify groups of equal values in each column, and color the background of corresponding cells accordingly. I will use it in a web presentation of regression test results.</p>
  
  <p>In python I would probably have used something like itertools.groupby().</p>
  
  <p>To illustrate, I include a screenshot example and the corresponding HTML code (constructed manually).</p>
  
  <p>
    </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;head&gt;
    &lt;style&gt;
      td {font-family: Monospace; font-size:16; }
    &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;table border=1&gt;
      &lt;tr&gt;&lt;td&gt;1.111&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt;1.111&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td bgcolor="LightBlue"&gt;2.222&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt;1.111&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td bgcolor="LightBlue"&gt;2.222&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt; 1.111&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td bgcolor="LightBlue"&gt;2.222&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td bgcolor="Goldenrod"&gt;3.333&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt; 1.111&lt;/td&gt;&lt;/tr&gt;
    &lt;/table&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p><img src="https://i.stack.imgur.com/Ev2dZ.png" alt="enter image description here"></p>