Package yash.oklab

Class Ok

java.lang.Object
yash.oklab.Ok

public class Ok extends Object
Oklab for Processing. Translated (with added functions) by Yash Gupta to Processing code, from the file 'colorconversion.js' on GitHub by Björn Ottosson.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static PApplet
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    a Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    getH(int input)
    returns the hue parameter of a color, relative to the OkHSV and OkHSL scales.
    static float[]
    getHSL(int input)
    returns an array containing OkHSL and alpha values of a color.
    static float[]
    getHSV(int input)
    returns an array containing OkHSV and alpha values of a color.
    static float
    getL(int input)
    returns the lightness parameter of a color, relative to the OkHSL scale.
    static float
    getS(int input)
    returns the saturation parameter of a color, relative to the OkHSV and OkHSL scales.
    static float
    getV(int input)
    returns the value parameter of a color, relative to the OkHSV scale.
    static int
    HSL(float L)
    returns a grayscale OkHSL color.
    static int
    HSL(float L, float A)
    returns a grayscale OkHSL color with custom alpha value.
    static int
    HSL(float H, float S, float L)
    returns OkHSL color.
    static int
    HSL(float H, float S, float L, float A)
    returns OkHSL color with custom alpha value.
    static int
    HSV(float V)
    returns a grayscale OkHSV color.
    static int
    HSV(float V, float A)
    returns a grayscale OkHSV color with custom alpha value.
    static int
    HSV(float H, float S, float V)
    returns OkHSV color.
    static int
    HSV(float H, float S, float V, float A)
    returns OkHSV color with custom alpha value.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Ok

      public Ok(PApplet q)
      a Constructor.
      Parameters:
      q - the parent PApplet
  • Method Details

    • HSV

      public static int HSV(float H, float S, float V)
      returns OkHSV color.
      Parameters:
      H - hue between 0 and 360.
      S - saturation between 0 and 100.
      V - value between 0 and 100.
      Returns:
      int
    • HSV

      public static int HSV(float H, float S, float V, float A)
      returns OkHSV color with custom alpha value.
      Parameters:
      H - hue between 0 and 360.
      S - saturation between 0 and 100.
      V - value between 0 and 100.
      A - alpha between 0 and 100.
      Returns:
      int
    • HSV

      public static int HSV(float V)
      returns a grayscale OkHSV color.
      Parameters:
      V - value between 0 and 100.
      Returns:
      int
    • HSV

      public static int HSV(float V, float A)
      returns a grayscale OkHSV color with custom alpha value.
      Parameters:
      V - value between 0 and 100.
      A - alpha between 0 and 100.
      Returns:
      int
    • HSL

      public static int HSL(float H, float S, float L)
      returns OkHSL color.
      Parameters:
      H - hue between 0 and 360.
      S - saturation between 0 and 100.
      L - value between 0 and 100.
      Returns:
      int
    • HSL

      public static int HSL(float H, float S, float L, float A)
      returns OkHSL color with custom alpha value.
      Parameters:
      H - hue between 0 and 360.
      S - saturation between 0 and 100.
      L - value between 0 and 100.
      A - alpha between 0 and 100.
      Returns:
      int
    • HSL

      public static int HSL(float L)
      returns a grayscale OkHSL color.
      Parameters:
      L - value between 0 and 100.
      Returns:
      int
    • HSL

      public static int HSL(float L, float A)
      returns a grayscale OkHSL color with custom alpha value.
      Parameters:
      L - value between 0 and 100.
      A - alpha between 0 and 100.
      Returns:
      int
    • getHSV

      public static float[] getHSV(int input)
      returns an array containing OkHSV and alpha values of a color.
      Parameters:
      input - color value.
      Returns:
      float[]
    • getHSL

      public static float[] getHSL(int input)
      returns an array containing OkHSL and alpha values of a color.
      Parameters:
      input - color value.
      Returns:
      float[]
    • getH

      public static float getH(int input)
      returns the hue parameter of a color, relative to the OkHSV and OkHSL scales.
      Parameters:
      input - color value.
      Returns:
      float
    • getS

      public static float getS(int input)
      returns the saturation parameter of a color, relative to the OkHSV and OkHSL scales.
      Parameters:
      input - color value.
      Returns:
      float
    • getV

      public static float getV(int input)
      returns the value parameter of a color, relative to the OkHSV scale.
      Parameters:
      input - color value.
      Returns:
      float
    • getL

      public static float getL(int input)
      returns the lightness parameter of a color, relative to the OkHSL scale.
      Parameters:
      input - color value.
      Returns:
      float