Class ColorHelper


  • public class ColorHelper
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ColorHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String awtColorToHexString​(java.awt.Color color)
      Maps an awt Color object to its respective hex string in lower case.
      static java.awt.Color bwr​(double difference)
      Mimics matplotlib 'bwr' colour map, i.e.
      static java.awt.Color hexStringToAWTColor​(java.lang.String hex)
      Maps a hex string to a respective awt Color object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ColorHelper

        public ColorHelper()
    • Method Detail

      • hexStringToAWTColor

        public static java.awt.Color hexStringToAWTColor​(java.lang.String hex)
        Maps a hex string to a respective awt Color object.
        Parameters:
        hex - Hex string of the from "#RRGGBB" (in upper or lowercase)
        Returns:
        Color object.
      • awtColorToHexString

        public static java.lang.String awtColorToHexString​(java.awt.Color color)
        Maps an awt Color object to its respective hex string in lower case.
        Parameters:
        color -
        Returns:
        lower case hex string of the from "#rrggbb".
      • bwr

        public static java.awt.Color bwr​(double difference)
        Mimics matplotlib 'bwr' colour map, i.e. a diverging colour map with the colour blue for -1 and red for +1 in which the lightness (L*) of the colours is reduced the closer the difference value gets to 0.
        Parameters:
        difference - : double between -1 and 1, where 0 is no difference and -1/1 the maximal difference in the respective direction
        Returns:
        Color object