Class ColorUtils


  • public class ColorUtils
    extends Object
    • Field Detail

      • orange

        public static Color orange
      • cyan

        public static Color cyan
      • gold

        public static Color gold
      • colorWheel

        public static final Color[] colorWheel
    • Constructor Detail

      • ColorUtils

        public ColorUtils()
    • Method Detail

      • main

        public static void main​(String[] args)
      • toHexColor

        public static String toHexColor​(Color col)
      • rotateHue

        public static Color rotateHue​(Color color,
                                      float fraction)
        Rotate a color through HSB space
        Parameters:
        color - Starting color
        fraction - Amount to add to the hue. The integer part is discarded to leave a number in [0,1)
        Returns:
      • getIntermediate

        public static Color getIntermediate​(Color start,
                                            Color end,
                                            int stepSize,
                                            int position)
      • darker

        public static Color darker​(Color color,
                                   double fraction)
        Make a color darker. (RGB color scheme)
        Parameters:
        color - Color to make darker.
        fraction - Darkness fraction.
        Returns:
        Darker color.
      • lighter

        public static Color lighter​(Color color,
                                    double fraction)
        Make a color lighter. (RGB color scheme)
        Parameters:
        color - Color to make lighter.
        fraction - Darkness fraction.
        Returns:
        Lighter color.