ProteinDomainColors { static float hue(int i, int maxDomains) { float colorDistance = 1f / (float) Math.ceil((maxDomains + 2) / 2f) / 2f; return i % 2 == 0 ? 21f / 360f + (i / 2 + 1) * colorDistance : 201f / 360f + (float) Math.ceil(i / 2f) * colorDistance; } ProteinDomainColors(@NotNull final List<ProteinDomain> proteinDomains);   ProteinDomainColors(@NotNull final Set<String> proteinDomains); @NotNull String rgb(@NotNull final String proteinDomain); @NotNull Color color(@NotNull final String proteinDomain); @Override @NotNull String toString();  }
@Test public void testHue() { assertEquals(21 + 90, 360 * ProteinDomainColors.hue(0, 1), 0.1); assertEquals(21 + 90, 360 * ProteinDomainColors.hue(0, 2), 0.1); assertEquals(21 + 270, 360 * ProteinDomainColors.hue(1, 2), 0.1); assertEquals(21 + 60, 360 * ProteinDomainColors.hue(0, 3), 0.1); assertEquals(21 + 180 + 60, 360 * ProteinDomainColors.hue(1, 3), 0.1); assertEquals(21 + 120, 360 * ProteinDomainColors.hue(2, 3), 0.1); assertEquals(21 + 60, 360 * ProteinDomainColors.hue(0, 4), 0.1); assertEquals(21 + 180 + 60, 360 * ProteinDomainColors.hue(1, 4), 0.1); assertEquals(21 + 120, 360 * ProteinDomainColors.hue(2, 4), 0.1); assertEquals(21 + 180 + 120, 360 * ProteinDomainColors.hue(3, 4), 0.1); }