use of org.asqatasun.contrastfinder.result.ColorCombinaison in project Contrast-Finder by Asqatasun.
the class ColorFinderHsvTest method testFindColorsGreenAlert.
/**
* Test of findColors method, of class ColorFinderHsv.
*/
public void testFindColorsGreenAlert() {
System.out.println("FindColorsGreenAlert");
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, true, 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(8, 15, 6);
assertEquals(firstColor, colorCombinaison.get(0).getColor());
Color mediumColor = new Color(4, 15, 0);
assertEquals(mediumColor, colorCombinaison.get(4).getColor());
Color endColor = new Color(0, 8, 15);
assertEquals(endColor, colorCombinaison.get(sizeList - 1).getColor());
}
use of org.asqatasun.contrastfinder.result.ColorCombinaison in project Contrast-Finder by Asqatasun.
the class ColorFinderHsvTest method testFindColorsNearColor.
public void testFindColorsNearColor() {
System.out.println("FindColorsNearColor");
Color foregroundColor = new Color(1, 0, 1);
Color backgroundColor = new Color(0, 0, 0);
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);
}
int sizeList = colorCombinaison.size();
Color firstColor = new Color(209, 0, 209);
assertEquals(firstColor, colorCombinaison.get(0).getColor());
Color endColor = new Color(235, 0, 0);
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 testFindColorsWithFgAndBg2.
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 testFindColorsNearColor2.
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