Class DBColorUtilImpl

java.lang.Object
com.illumon.iris.db.util.DBColorUtilImpl
Direct Known Subclasses:
DBColorUtil

public class DBColorUtilImpl
extends Object
Formatting methods from DBColorUtil. Exists so that we can statically import the DBColorUtil methods without importing the color fields. TODO: remove once DBColorUtil field and Color field conflicts are resolved. TODO: This class won't be necessary once we can import DBColorUtil as static again.
  • Field Details

  • Constructor Details

  • Method Details

    • background

      public static long background​(Color color)
      Creates a table format encoding with specified background color and an unformatted foreground.
      Parameters:
      color - color represented by a Color
      Returns:
      table format encoding with specified background color and unformatted foreground
    • background

      public static long background​(String color)
      Creates a table format encoding with specified background color and an unformatted foreground.
      Parameters:
      color - the hex representation or the case-insensitive color name
      Returns:
      table format encoding with specified background color and unformatted foreground
    • bg

      public static long bg​(long r, long g, long b)
      Convenience method for background(Color).

      This variant takes color RBG components as inputs.

    • bg

      public static long bg​(long color)
      Convenience method for background(Color).

      This variant takes the input color encoded as a long.

    • bg

      public static long bg​(Color color)
      Convenience method for background(Color).

      This variant takes the input color as a Color.

    • bg

      public static long bg​(String color)
      Convenience method for background(Color).

      This variant takes the input color as a String. This may be the hex representation or the case-insensitive color name.

    • isBackgroundSelectionOverride

      public static boolean isBackgroundSelectionOverride​(long color)
      Checks if a background color should override selection.
      Parameters:
      color - the color to check
      Returns:
      true if the color should override selection, false otherwise
    • backgroundOverride

      public static long backgroundOverride​(long color)
      Background with Override .. Overrides the default selection color.
    • backgroundOverride

      public static long backgroundOverride​(Color color)
      Background with Override .. Overrides the default selection color.
    • backgroundOverride

      public static long backgroundOverride​(String color)
      Background with Override .. Overrides the default selection color.
    • bgo

      public static long bgo​(long color)
      Convenience method for backgroundOverride(Color).

      This variant takes the input color encoded as a long.

    • bgo

      public static long bgo​(Color color)
      Convenience method for backgroundOverride(Color).

      This variant takes the input color as a Color.

    • bgo

      public static long bgo​(String color)
      Convenience method for backgroundOverride(Color).

      This variant takes the input color as a String. This may be the hex representation or the case-insensitive color name.

    • foreground

      public static long foreground​(Color color)
      Creates a table format encoding with specified foreground color and unformatted background.
      Parameters:
      color - color represented by a Color
      Returns:
      table format encoding with specified foreground color and unformatted background
    • foreground

      public static long foreground​(String color)
      Creates a table format encoding with specified foreground color and unformatted background.
      Parameters:
      color - the hex representation or the case-insensitive color name
      Returns:
      table format encoding with specified foreground color and unformatted background
    • fg

      public static long fg​(long color)
      Convenience method for foreground(Color).

      This variant takes the input color encoded as a long. The resultant encoding is an unformatted background and a foreground the same color as the background color of the input, e.g. fg(bgfg(YELLOW, RED)) will result in a yellow foreground with no background formatting.

    • fg

      public static long fg​(Color color)
      Convenience method for foreground(Color).

      This variant takes the input color as a Color.

    • fg

      public static long fg​(String color)
      Convenience method for foreground(Color).

      This variant takes the input color as a String. This may be the hex representation or the case-insensitive color name.

    • fg

      public static long fg​(long r, long g, long b)
      Convenience method for foreground(Color).

      This variant takes color RBG components as inputs.

    • isForegroundSelectionOverride

      public static boolean isForegroundSelectionOverride​(long color)
      Checks if a foreground color should override selection.
      Parameters:
      color - the color to check
      Returns:
      true if the color should override selection, false otherwise
    • foregroundOverride

      public static long foregroundOverride​(long color)
      Foreground with Override .. Overrides the default selection color.
    • foregroundOverride

      public static long foregroundOverride​(Color color)
      Foreground with Override .. Overrides the default selection color.
    • foregroundOverride

      public static long foregroundOverride​(String color)
      Foreground with Override .. Overrides the default selection color.
    • fgo

      public static long fgo​(long color)
      Convenience method for foregroundOverride(Color).

      This variant takes the input color encoded as a long.

    • fgo

      public static long fgo​(Color color)
      Convenience method for foregroundOverride(Color).

      This variant takes the input color as a Color.

    • fgo

      public static long fgo​(String color)
      Convenience method for foregroundOverride(Color).

      This variant takes the input color as a String. This may be the hex representation or the case-insensitive color name.

    • backgroundForeground

      public static long backgroundForeground​(Color bg, Color fg)
      Creates a table format encoding with specified foreground and background colors.
      Parameters:
      bg - background color represented by a Color
      fg - foreground color represented by a Color
      Returns:
      table format encoding with specified foreground and background colors
    • backgroundForeground

      public static long backgroundForeground​(String bg, String fg)
      Creates a table format encoding with specified foreground and background colors.
      Parameters:
      bg - background color represented by a String. This may be the hex representation or the case-insensitive color name
      fg - foreground color represented by a String. This may be the hex representation or the case-insensitive color name
      Returns:
      table format encoding with specified foreground and background colors
    • bgfg

      public static long bgfg​(long bgr, long bgg, long bgb, long fgr, long fgg, long fgb)
      Convenience method for backgroundForeground(Color, Color).

      This variant takes color RBG components as inputs.

    • bgfg

      public static long bgfg​(long bg, long fg)
      Convenience method for backgroundForeground(Color, Color).

      This variant takes colors encoded as longs for inputs.

    • bgfg

      public static long bgfg​(Color bg, Color fg)
      Convenience method for backgroundForeground(Color, Color).

      This variant takes the input colors as Colors.

    • bgfg

      public static long bgfg​(String bg, String fg)
      Convenience method for backgroundForeground(Color, Color).

      This variant takes the input colors as Strings. This may be the hex representation or the case-insensitive color name.

    • backgroundForegroundAuto

      public static long backgroundForegroundAuto​(Color color)
      Creates a table format encoding with specified background color and automatically chosen contrasting foreground color.
      Parameters:
      color - background color represented by a Color
      Returns:
      table format encoding with background color and auto-generated foreground color
    • backgroundForegroundAuto

      public static long backgroundForegroundAuto​(String color)
      Creates a table format encoding with specified background color and automatically chosen contrasting foreground color.
      Parameters:
      color - background color represented by a String. This may be the hex representation or the case-insensitive color name
      Returns:
      table format encoding with background color and auto-generated foreground color
    • bgfga

      public static long bgfga​(long bgr, long bgg, long bgb)
      Convenience method for backgroundForegroundAuto(Color)

      This variant takes color RBG components as inputs.

    • bgfga

      public static long bgfga​(long color)
      Convenience method for backgroundForegroundAuto(Color)

      This variant takes the input color encoded as a long.

    • bgfga

      public static long bgfga​(Color color)
      Convenience method for backgroundForegroundAuto(Color)

      This variant takes the input color as a Color.

    • bgfga

      public static long bgfga​(String color)
      Convenience method for backgroundForegroundAuto(Color)

      This variant takes the input color as a String. This may be the hex representation or the case-insensitive color name.

    • heatmap

      public static long heatmap​(double value, double min, double max, long bg1, long bg2)
      Creates a table format encoding for the heat map at value. A contrasting foreground color is automatically chosen.
      Parameters:
      value - determines the color used by its location in the heat map's range
      min - minimum value of the heat map range
      max - maximum value of the heat map range
      bg1 - background color at or below the minimum value of the heat map. Encoded as a long
      bg2 - background color at or above the maximum value of the heat map. Encoded as a long
      Returns:
      table format encoding with background color and auto-generated foreground color determined by a heat map
    • heatmap

      public static long heatmap​(double value, double min, double max, Color bg1, Color bg2)
      Creates a table format encoding for the heat map at value. A contrasting foreground color is automatically chosen.
      Parameters:
      value - determines the color used by its location in the heat map's range
      min - minimum value of the heat map range
      max - maximum value of the heat map range
      bg1 - background color at or below the minimum value of the heat map.
      bg2 - background color at or above the maximum value of the heat map.
      Returns:
      table format encoding with background color and auto-generated foreground color determined by a heat map
    • heatmap

      public static long heatmap​(double value, double min, double max, String bg1, String bg2)
      Creates a table format encoding for the heat map at value. A contrasting foreground color is automatically chosen.
      Parameters:
      value - determines the color used by its location in the heat map's range
      min - minimum value of the heat map range
      max - maximum value of the heat map range
      bg1 - background color at or below the minimum value of the heat map.
      bg2 - background color at or above the maximum value of the heat map.
      Returns:
      table format encoding with background color and auto-generated foreground color determined by a heat map
    • heatmapForeground

      public static long heatmapForeground​(double value, double min, double max, Color fg1, Color fg2)
      Creates a table format encoding for the heat map at value with specified foreground color and unformatted background.
      Parameters:
      value - determines the color used by its location in the heat map's range
      min - minimum value of the heat map range.
      max - maximum value of the heat map range.
      fg1 - foreground color at or below the minimum value of the heat map
      fg2 - foreground color at or above the maximum value of the heat map
      Returns:
      table format encoding with foreground color determined by a heat map
    • heatmapForeground

      public static long heatmapForeground​(double value, double min, double max, String fg1, String fg2)
      Creates a table format encoding for the heat map at value with specified foreground color and unformatted background.
      Parameters:
      value - determines the color used by its location in the heat map's range
      min - minimum value of the heat map range.
      max - maximum value of the heat map range.
      fg1 - foreground color at or below the minimum value of the heat map
      fg2 - foreground color at or above the maximum value of the heat map
      Returns:
      table format encoding with foreground color determined by a heat map
    • heatmapFg

      public static long heatmapFg​(double value, double min, double max, long fg1, long fg2)
      Convenience method for heatmapForeground(double, double, double, Color, Color)

      This variant takes the input colors encoded as a longs. These colors must be formatted as a foreground (i.e. through fg() call) for this to work as expected.

    • heatmapFg

      public static long heatmapFg​(double value, double min, double max, Color fg1, Color fg2)
      See heatmapFg(double, double, double, long, long)

      This variant takes the input colors as Colors.

    • heatmapFg

      public static long heatmapFg​(double value, double min, double max, String fg1, String fg2)
      See heatmapFg(double, double, double, long, long)

      This variant takes the input colors as Strings. This may be the hex representation or the case-insensitive color name.

    • toLong

      public static long toLong​(long color)
      Gets the formatting long of the input color
      Parameters:
      color - color encoded in a long
      Returns:
      formatting long of the input color
    • toLong

      public static long toLong​(Color color)
      Gets the formatting long of the input color
      Parameters:
      color - color represented by a Color
      Returns:
      formatting long of the input color
    • toLong

      public static long toLong​(String color)
      Gets the formatting long of the input color
      Parameters:
      color - the hex representation or the case-insensitive color name
      Returns:
      formatting long of the input color
      Throws:
      IllegalArgumentException - If color is invalid
    • valueOf

      @Deprecated public static long valueOf​(String colorName)
      Deprecated.
      Returns the long value for the color with the given name. For example, DBColorUtil.valueOf("VIVID_BLUE") == Color.VIVID_BLUE.

      This method has been deprecated. The new method is toLong(String)

      Parameters:
      colorName - The name of the color to retrieve.
      Returns:
      The long value for the given color
      Throws:
      IllegalArgumentException - If colorName is invalid