use of org.asqatasun.contrastfinder.result.ColorCombinaison in project Contrast-Finder by Asqatasun.
the class ColorFinderHsvTest method testFindColorsWithFgAndBg2.
@Test
public void testFindColorsWithFgAndBg2() {
System.out.println("FindColorsWithFgAndBg2");
Color foregroundColor = new Color(127, 127, 127);
Color backgroundColor = new Color(128, 128, 128);
Float coefficientLevel = 4.5f;
ColorFinderHsv instance = new ColorFinderHsv();
List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>();
instance.findColors(foregroundColor, backgroundColor, false, coefficientLevel);
for (ColorCombinaison combinaisons : instance.getColorResult().getSuggestedColors()) {
LOGGER.debug("HashCode :" + colorCombinaison.hashCode() + " COLOR : " + combinaisons.getContrast());
colorCombinaison.add(combinaisons);
}
int sizeList = colorCombinaison.size();
Color firstColor = new Color(1, 1, 1);
assertEquals(firstColor, colorCombinaison.get(0).getColor());
Color mediumColor = new Color(27, 15, 15);
assertEquals(mediumColor, colorCombinaison.get(4).getColor());
Color endColor = new Color(52, 4, 4);
assertEquals(endColor, colorCombinaison.get(sizeList - 1).getColor());
}
use of org.asqatasun.contrastfinder.result.ColorCombinaison in project Contrast-Finder by Asqatasun.
the class ColorFinderHsvTest method testFindColorsBornWhite2.
@Test
public void testFindColorsBornWhite2() {
System.out.println("FindColorsBornWhite2");
Color foregroundColor = new Color(254, 254, 254);
Color backgroundColor = new Color(255, 255, 255);
Float coefficientLevel = 4.5f;
ColorFinderHsv instance = new ColorFinderHsv();
List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>();
instance.findColors(foregroundColor, backgroundColor, false, coefficientLevel);
for (ColorCombinaison combinaisons : instance.getColorResult().getSuggestedColors()) {
LOGGER.debug("HashCode :" + colorCombinaison.hashCode() + " COLOR : " + combinaisons.getContrast());
colorCombinaison.add(combinaisons);
}
int sizeList = colorCombinaison.size();
Color firstColor = new Color(104, 104, 104);
assertEquals(firstColor, colorCombinaison.get(0).getColor());
Color mediumColor = new Color(154, 93, 93);
assertEquals(mediumColor, colorCombinaison.get(4).getColor());
Color endColor = new Color(229, 4, 4);
assertEquals(endColor, colorCombinaison.get(sizeList - 1).getColor());
}
use of org.asqatasun.contrastfinder.result.ColorCombinaison in project Contrast-Finder by Asqatasun.
the class AbstractColorFinder method isNewColorValid.
/**
* @param newColor
* @return
*/
protected boolean isNewColorValid(Color newColor) {
ColorCombinaison colorCombinaison = colorCombinaisonFactory.getColorCombinaison(newColor, colorToKeep, Double.valueOf(coefficientLevel));
if (colorCombinaison.isContrastValid() && colorCombinaison.getContrast() < (coefficientLevel + MAX_COEFFICIENT_LEVEL)) {
LOGGER.debug("Adding a color to list : " + newColor.getRed() + " " + newColor.getGreen() + " " + newColor.getBlue() + " Contrast : " + ContrastChecker.getConstrastRatio(newColor, colorToKeep));
colorResult.addSuggestedColor(colorCombinaison);
return true;
}
return false;
}
use of org.asqatasun.contrastfinder.result.ColorCombinaison in project Contrast-Finder by Asqatasun.
the class ColorFinderHsvTest method testFindColorsGreenAlert2.
@Test
public void testFindColorsGreenAlert2() {
System.out.println("FindColorsGreenAlert2");
Color foregroundColor = new Color(70, 136, 71);
Color backgroundColor = new Color(223, 240, 216);
Float coefficientLevel = 4.5f;
ColorFinderHsv instance = new ColorFinderHsv();
List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>();
instance.findColors(foregroundColor, backgroundColor, false, coefficientLevel);
for (ColorCombinaison combinaisons : instance.getColorResult().getSuggestedColors()) {
LOGGER.debug("HashCode :" + colorCombinaison.hashCode() + " COLOR : " + combinaisons.getContrast());
colorCombinaison.add(combinaisons);
}
int sizeList = colorCombinaison.size();
Color firstColor = new Color(57, 111, 58);
assertEquals(firstColor, colorCombinaison.get(0).getColor());
Color mediumColor = new Color(79, 86, 79);
assertEquals(mediumColor, colorCombinaison.get(4).getColor());
Color endColor = new Color(136, 70, 133);
assertEquals(endColor, colorCombinaison.get(sizeList - 1).getColor());
}
use of org.asqatasun.contrastfinder.result.ColorCombinaison in project Contrast-Finder by Asqatasun.
the class ColorFinderHsvTest method testFindColorsNearColor2.
@Test
public void testFindColorsNearColor2() {
System.out.println("FindColorsNearColor2");
Color foregroundColor = new Color(255, 165, 0);
Color backgroundColor = new Color(255, 255, 255);
Float coefficientLevel = 4.5f;
ColorFinderHsv instance = new ColorFinderHsv();
List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>();
instance.getColorFinderKey();
instance.findColors(foregroundColor, backgroundColor, false, coefficientLevel);
for (ColorCombinaison combinaisons : instance.getColorResult().getSuggestedColors()) {
LOGGER.debug("HashCode :" + colorCombinaison.hashCode() + " COLOR : " + combinaisons.getContrast());
colorCombinaison.add(combinaisons);
}
}
Aggregations