Class ColorFontUtil

java.lang.Object
org.yamcs.studio.script.ColorFontUtil
Direct Known Subclasses:
ColorFontUtil

public class ColorFontUtil extends Object
Utility class to facilitate Javascript programming for color operation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final RGB
    the color of black
    static final RGB
    the color of blue
    static final RGB
    the color of cyan
    static final RGB
    the color of dark gray
    static final RGB
    the color of gray
    static final RGB
    the color of green
    static final RGB
    the color of light blue
    static final RGB
    the color of orange
    static final RGB
    the color of pink
    static final RGB
    the color of orange
    static final RGB
    the color of red
    static final RGB
    the color of white
    static final RGB
    the color of yellow
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static final RGB
    getColorFromHSB(float hue, float saturation, float brightness)
    Get a color with the given hue, saturation, and brightness.
    static final RGB
    getColorFromRGB(int red, int green, int blue)
    Get a color with the given red, green and blue values.
    static final FontData
    getFont(String name, int height, int style)
    Get a new font data given a font name, the height of the desired font in points, and a font style.

    Methods inherited from class java.lang.Object

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

    • BLACK

      public static final RGB BLACK
      the color of black
    • BLUE

      public static final RGB BLUE
      the color of blue
    • CYAN

      public static final RGB CYAN
      the color of cyan
    • DARK_GRAY

      public static final RGB DARK_GRAY
      the color of dark gray
    • GRAY

      public static final RGB GRAY
      the color of gray
    • GREEN

      public static final RGB GREEN
      the color of green
    • LIGHT_BLUE

      public static final RGB LIGHT_BLUE
      the color of light blue
    • ORANGE

      public static final RGB ORANGE
      the color of orange
    • PINK

      public static final RGB PINK
      the color of pink
    • PURPLE

      public static final RGB PURPLE
      the color of orange
    • RED

      public static final RGB RED
      the color of red
    • WHITE

      public static final RGB WHITE
      the color of white
    • YELLOW

      public static final RGB YELLOW
      the color of yellow
  • Constructor Details

    • ColorFontUtil

      public ColorFontUtil()
  • Method Details

    • getColorFromRGB

      public static final RGB getColorFromRGB(int red, int green, int blue)
      Get a color with the given red, green and blue values.
      Parameters:
      red - the red component of the new instance
      green - the green component of the new instance
      blue - the blue component of the new instance
      Throws:
      IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255
    • getColorFromHSB

      public static final RGB getColorFromHSB(float hue, float saturation, float brightness)
      Get a color with the given hue, saturation, and brightness.
      Parameters:
      hue - the hue value for the HSB color (from 0 to 360)
      saturation - the saturation value for the HSB color (from 0 to 1)
      brightness - the brightness value for the HSB color (from 0 to 1)
      Throws:
      IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the hue is not between 0 and 360 or the saturation or brightness is not between 0 and 1
    • getFont

      public static final FontData getFont(String name, int height, int style)
      Get a new font data given a font name, the height of the desired font in points, and a font style.
      Parameters:
      name - the name of the font (must not be null)
      height - the font height in points
      style - A bitwise combination of NORMAL(0), BOLD(1) and ITALIC(2).
      Throws:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - when the font name is null
      • ERROR_INVALID_ARGUMENT - if the height is negative