Example usage for org.openqa.selenium.support Colors getColorValue

List of usage examples for org.openqa.selenium.support Colors getColorValue

Introduction

In this page you can find the example usage for org.openqa.selenium.support Colors getColorValue.

Prototype

public Color getColorValue() 

Source Link

Usage

From source file:jhc.redsniff.webdriver.matchers.ColorMatcher.java

License:Apache License

private String toString(Color color) {
    for (Colors namedColor : Colors.values()) {
        if (namedColor.getColorValue().equals(color))
            return namedColor.toString().toLowerCase();
    }//from   www  . ja  v  a  2  s  . c o m
    return color.asHex().toLowerCase();
}

From source file:testHelper.ColorHelper.java

public static String getColorName(String hex) {
    float dist = Float.MAX_VALUE;
    String nearestColor = "";
    for (Colors c : Colors.values()) {
        float tdist = computeDistance(c.getColorValue().asHex(), hex);
        if (tdist < dist) {
            dist = tdist;// w w  w . j  av a 2 s .  c o m
            nearestColor = c.name();
        }
    }
    return nearestColor;
}