Class Color

java.lang.Object
dev.upcraft.sparkweave.api.color.Color

public class Color extends Object
  • Field Details

    • DEFAULT_ORDERING

      public static final Color.Ordering DEFAULT_ORDERING
    • CODEC_ARGB

      public static final com.mojang.serialization.Codec<Color> CODEC_ARGB
    • CODEC

      public static final com.mojang.serialization.Codec<Color> CODEC
  • Method Details

    • fromRGB

      public static Color fromRGB(int red, int green, int blue)
    • fromFloatsRGBA

      public static Color fromFloatsRGBA(float red, float green, float blue, float alpha)
    • fromFloatsRGB

      public static Color fromFloatsRGB(float red, float green, float blue)
    • fromIntArray

      public static Color fromIntArray(Color.Ordering ordering, int... values)
    • fromFloatArray

      public static Color fromFloatArray(Color.Ordering ordering, float... values)
    • red

      public int red()
    • redF

      public float redF()
    • green

      public int green()
    • greenF

      public float greenF()
    • blue

      public int blue()
    • blueF

      public float blueF()
    • alpha

      public int alpha()
    • alphaF

      public float alphaF()
    • asFloatsRGBA

      public float[] asFloatsRGBA()
    • asFloats

      public float[] asFloats(Color.Ordering ordering)
    • asIntARGB

      public int asIntARGB()
    • asInt

      public int asInt(Color.Ordering ordering)
    • asVec

      public org.joml.Vector4fc asVec()
    • asVec3

      public org.joml.Vector3fc asVec3()
    • fromInt

      public static Color fromInt(int intValue, Color.Ordering ordering)
    • fromARGB

      public static Color fromARGB(int argb)
    • fromHSV

      public static Color fromHSV(float hue, float saturation, float value)
      HSV (hue, saturation, value), also known as HSB (hue, saturation, brightness)
      Parameters:
      hue - angle as [0, 1], where 1.0 means a full circle and overflows back to 0.0
      saturation - saturation in [0, 1]
      value - brightness in [0, 1]
    • lerpDirect

      public Color lerpDirect(Color other, float delta)
      interpolate RGB components directly, for parity with Mojang's color interpolation.
      For smoother visuals use lerp(Color, float)
      See Also:
      • FastColor.ARGB32.lerp(float, int, int)
    • lerp

      public Color lerp(Color other, float delta)
      interpolate in RGB color space by first converting each component to linear RGB, for smoother color blending
    • placeAt

      public int placeAt(int value, int length, int idx)