Class ColorUtil

java.lang.Object
com.spinyowl.legui.style.color.ColorUtil

public final class ColorUtil extends Object
Used to perform some operations with color vectors.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.joml.Vector4f
    fromInt(int r, int g, int b, float a)
     
    static org.joml.Vector4f
    half(org.joml.Vector4f color)
    Used to obtain half color from source.
    static org.joml.Vector4f
    halfRGB(org.joml.Vector4f color)
    Used to obtain half color from source.
    static org.joml.Vector4f
    negativeColor(org.joml.Vector4f color)
    Used to create negative color for provided color.
    static void
    negativeColor(org.joml.Vector4f color, org.joml.Vector4f dest)
    Used to create negative color and set it to dest.
    static org.joml.Vector4f
    negativeColorRGB(org.joml.Vector4f color)
    Used to negotiate only rgb part.
    static org.joml.Vector4f
    negativeColorRGB(org.joml.Vector4f color, org.joml.Vector4f dest)
    Used to create negative color and set it to dest.
    static org.joml.Vector4f
    oppositeBlackOrWhite(org.joml.Vector4f color)
    Used to return black or white color based on source color.
    static org.joml.Vector4f
    oppositeBlackOrWhite(org.joml.Vector4f color, org.joml.Vector4f targetColor)
    Used to return black or white color based on source color.
    static org.joml.Vector4f
    Used to generate random color.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • negativeColor

      public static org.joml.Vector4f negativeColor(org.joml.Vector4f color)
      Used to create negative color for provided color. Alpha value will be the same as in source color.
      Parameters:
      color - color to negotiate.
      Returns:
      new negative color.
    • negativeColor

      public static void negativeColor(org.joml.Vector4f color, org.joml.Vector4f dest)
      Used to create negative color and set it to dest. Alpha value will be the same as in source color.
      Parameters:
      color - color to negotiate.
      dest - target color object to set.
    • negativeColorRGB

      public static org.joml.Vector4f negativeColorRGB(org.joml.Vector4f color)
      Used to negotiate only rgb part. Alpha value will be setted to 1.
      Parameters:
      color - color to negotiate.
      Returns:
      new negative color.
    • negativeColorRGB

      public static org.joml.Vector4f negativeColorRGB(org.joml.Vector4f color, org.joml.Vector4f dest)
      Used to create negative color and set it to dest. Alpha value will be setted to 1.
      Parameters:
      color - color to negotiate.
      dest - target color object to set.
      Returns:
      destination color filled with negative color.
    • half

      public static org.joml.Vector4f half(org.joml.Vector4f color)
      Used to obtain half color from source.
      Parameters:
      color - source color.
      Returns:
      new color.
    • halfRGB

      public static org.joml.Vector4f halfRGB(org.joml.Vector4f color)
      Used to obtain half color from source.
      Parameters:
      color - source color.
      Returns:
      new color.
    • oppositeBlackOrWhite

      public static org.joml.Vector4f oppositeBlackOrWhite(org.joml.Vector4f color)
      Used to return black or white color based on source color. for example for white source color it should return black.
      Parameters:
      color - color to find opposite black or white color.
      Returns:
      opposite black or white color.
    • oppositeBlackOrWhite

      public static org.joml.Vector4f oppositeBlackOrWhite(org.joml.Vector4f color, org.joml.Vector4f targetColor)
      Used to return black or white color based on source color. For example for white source color it should return black.
      Parameters:
      color - color to find opposite black or white color.
      targetColor - color to set result.
      Returns:
      opposite black or white color.
    • fromInt

      public static org.joml.Vector4f fromInt(int r, int g, int b, float a)
    • randomColor

      public static org.joml.Vector4f randomColor()
      Used to generate random color.
      Returns:
      random color.