Utils

RGB

class RGB(r, g, b)

Return an RGB triplet.

Arguments:
  • r (number) -- Red value.

  • g (number) -- Green value.

  • b (number) -- Blue value.

Returns:

RGB -- Instance of an RGB triplet.

static RGB.clone()

Clone the RGB triplet.

Returns:

RGB -- Copy of the RGB triplet.

static RGB.isOn()

Detect non-zero RGB color.

Returns:

boolean -- True if the color is not a perfect black.

static RGB.toStr()

Convert to a string representation.

Returns:

string -- String (hexadecimal) representation of the RGB triplet.

rgb(r, g, b)

Instantiate an RGB triplet.

Arguments:
  • r (number|Array.<number>|string|RGB) -- Red value, rgb array, hexadecimalstring representation, or RGB triplet.

  • g (number) -- Green value.

  • b (number) -- Blue value.

Returns:

RGB -- Instance of an RGB triplet.

Examples:

const color = rgb('#A0B8C4');

Misc utils

VUtil.checkDomain

Return the domain of a given URL.

See also

  • {@link https://stackoverflow.com/a/28054735}

VUtil.copyToClipboard

Copy the input string to the clipboard.

See also

  • {@link https://stackoverflow.com/a/33928558}

VUtil.flashElement

Add a short (<400ms) "flash" animation to an element.

VUtil.getCookie

Return the value of the cookie with the given name.

See also

  • {@link https://www.w3schools.com/js/js_cookies.asp}

VUtil.isExternal

Check if a given URL is external.

See also

  • {@link https://stackoverflow.com/a/28054735}

VUtil.parseURL

Return a dictionary of keyword/value pairs from a URL string.

See also

  • {@link https://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object}

VUtil.requestURL

Do an AJAX query to a server.

VUtil.updateURL

Return a URL with a new or updated keyword/value query string.

See also

  • {@link https://stackoverflow.com/a/5999118}

VUtil.readFITSKey

Read the value of a FITS header keyword.