Class ContrastRatioChecker

java.lang.Object
org.verapdf.wcag.algorithms.semanticalgorithms.ContrastRatioChecker

public class ContrastRatioChecker extends Object
  • Constructor Details

    • ContrastRatioChecker

      public ContrastRatioChecker()
  • Method Details

    • checkSemanticTree

      public void checkSemanticTree(ITree tree, String pdfName)
      Traverses the document semantic tree and updates contrast ratio parameter of it's nodes. Uses pdf document associated with the tree to determine contrast ratio by rendering it's pages.
      Parameters:
      tree - tree with nodes to update with calculated contrast ratio
      pdfName - String path to the pdf document associated with given tree
    • getContrastRatio

      public double getContrastRatio(double first, double second)
      Determines contrast ratio of two color based on their relative luminance. The resulting contrast ratio ranges from 1.0 to 21.0
      Parameters:
      first - relative luminance of the first color
      second - relative luminance of the first color
      Returns:
      contrast ratio of the given colors