org.csstudio.opibuilder.scriptUtil

## Class ColorFontUtil

- java.lang.Object
- - org.csstudio.opibuilder.scriptUtil.ColorFontUtil

-     public class ColorFontUtil
      extends java.lang.Object

  Utility class to facilitate Javascript programming for color operation.
  Author:
    Xihui Chen

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static org.eclipse.swt.graphics.RGB` | `BLACK` the color of black
    `static org.eclipse.swt.graphics.RGB` | `BLUE` the color of blue
    `static org.eclipse.swt.graphics.RGB` | `CYAN` the color of cyan
    `static org.eclipse.swt.graphics.RGB` | `DARK_GRAY` the color of dark gray
    `static org.eclipse.swt.graphics.RGB` | `GRAY` the color of gray
    `static org.eclipse.swt.graphics.RGB` | `GREEN` the color of green
    `static org.eclipse.swt.graphics.RGB` | `LIGHT_BLUE` the color of light blue
    `static org.eclipse.swt.graphics.RGB` | `ORANGE` the color of orange
    `static org.eclipse.swt.graphics.RGB` | `PINK` the color of pink
    `static org.eclipse.swt.graphics.RGB` | `PURPLE` the color of orange
    `static org.eclipse.swt.graphics.RGB` | `RED` the color of red
    `static org.eclipse.swt.graphics.RGB` | `WHITE` the color of white
    `static org.eclipse.swt.graphics.RGB` | `YELLOW` the color of yellow

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ColorFontUtil()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static org.eclipse.swt.graphics.RGB` | `getColorFromHSB(float hue, float saturation, float brightness)` Get a color with the given hue, saturation, and brightness.
    `static org.eclipse.swt.graphics.RGB` | `getColorFromRGB(int red, int green, int blue)` Get a color with the given red, green and blue values.
    `static org.eclipse.swt.graphics.FontData` | `getFont(java.lang.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

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### BLACK

          public static final org.eclipse.swt.graphics.RGB BLACK

      the color of black

    - #### BLUE

          public static final org.eclipse.swt.graphics.RGB BLUE

      the color of blue

    - #### CYAN

          public static final org.eclipse.swt.graphics.RGB CYAN

      the color of cyan

    - #### DARK_GRAY

          public static final org.eclipse.swt.graphics.RGB DARK_GRAY

      the color of dark gray

    - #### GRAY

          public static final org.eclipse.swt.graphics.RGB GRAY

      the color of gray

    - #### GREEN

          public static final org.eclipse.swt.graphics.RGB GREEN

      the color of green

    - #### LIGHT_BLUE

          public static final org.eclipse.swt.graphics.RGB LIGHT_BLUE

      the color of light blue

    - #### ORANGE

          public static final org.eclipse.swt.graphics.RGB ORANGE

      the color of orange

    - #### PINK

          public static final org.eclipse.swt.graphics.RGB PINK

      the color of pink

    - #### PURPLE

          public static final org.eclipse.swt.graphics.RGB PURPLE

      the color of orange

    - #### RED

          public static final org.eclipse.swt.graphics.RGB RED

      the color of red

    - #### WHITE

          public static final org.eclipse.swt.graphics.RGB WHITE

      the color of white

    - #### YELLOW

          public static final org.eclipse.swt.graphics.RGB YELLOW

      the color of yellow

  - ### Constructor Detail

    - #### ColorFontUtil

          public ColorFontUtil()

  - ### Method Detail

    - #### getColorFromRGB

          public static final org.eclipse.swt.graphics.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:
        `java.lang.IllegalArgumentException` -
        - ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255

    - #### getColorFromHSB

          public static final org.eclipse.swt.graphics.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:
        `java.lang.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 org.eclipse.swt.graphics.FontData getFont(java.lang.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:
        `java.lang.IllegalArgumentException` -
        - ERROR_NULL_ARGUMENT - when the font name is null
        - ERROR_INVALID_ARGUMENT - if the height is negative