From 05f6ec4a47f23b624f971e6a8dd94a5f17c16e21 Mon Sep 17 00:00:00 2001 From: Eugene Obrezkov Date: Thu, 12 May 2016 21:18:01 +0300 Subject: [PATCH] docs(package): Update docs --- doc/api/Cursor.md | 226 ++----------------------- doc/api/Shape.md | 407 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 363 insertions(+), 270 deletions(-) diff --git a/doc/api/Cursor.md b/doc/api/Cursor.md index be315f7..0f0613f 100644 --- a/doc/api/Cursor.md +++ b/doc/api/Cursor.md @@ -4,9 +4,6 @@
Cell

Cell responsible for mapping separate cells in the real terminal to the virtual one.

-
Color
-

Color class responsible for converting colors between rgb and hex.

-
Cursor

Cursor implements low-level API to terminal cursor.

@@ -16,7 +13,7 @@
COLORS : Object
-

Dictionary of colors which can be used for instantiating the Color instance.

+

Dictionary of colors which can be used in cursor.

DISPLAY_MODES : Object

Dictionary of the display modes and VT100 control sequences. @@ -44,10 +41,10 @@ Cell responsible for mapping separate cells in the real terminal to the virtual * [.setX([x])](#Cell+setX) ⇒ [Cell](#Cell) * [.getY()](#Cell+getY) ⇒ Number * [.setY([y])](#Cell+setY) ⇒ [Cell](#Cell) - * [.getBackground()](#Cell+getBackground) ⇒ Object - * [.setBackground([r], [g], [b])](#Cell+setBackground) ⇒ [Cell](#Cell) - * [.getForeground()](#Cell+getForeground) ⇒ Object - * [.setForeground([r], [g], [b])](#Cell+setForeground) ⇒ [Cell](#Cell) + * [.getBackground()](#Cell+getBackground) ⇒ String + * [.setBackground([colorName])](#Cell+setBackground) ⇒ [Cell](#Cell) + * [.getForeground()](#Cell+getForeground) ⇒ String + * [.setForeground([colorName])](#Cell+setForeground) ⇒ [Cell](#Cell) * [.getDisplay()](#Cell+getDisplay) ⇒ Object * [.setDisplay([bold], [dim], [underlined], [blink], [reverse], [hidden])](#Cell+setDisplay) ⇒ [Cell](#Cell) * [.setModified([isModified])](#Cell+setModified) ⇒ [Cell](#Cell) @@ -69,14 +66,8 @@ Create Cell instance which are able to convert itself to ASCII control sequence. | [options] | Object | Options object where you can set additional style to char | | [options.x] | Number | X coordinate | | [options.y] | Number | Y coordinate | -| [options.background] | Object | Background color, fill with -1 if you don't want to use background | -| [options.background.r] | Number | Red channel | -| [options.background.g] | Number | Green channel | -| [options.background.b] | Number | Blue channel | -| [options.foreground] | Object | Foreground color, fill with -1 if you don't want to use foreground | -| [options.foreground.r] | Number | Red channel | -| [options.foreground.g] | Number | Green channel | -| [options.foreground.b] | Number | Blue channel | +| [options.background] | String | Background color name, `none` to disable color | +| [options.foreground] | String | Foreground color name, `none` to disable color | | [options.display] | Object | Object with display modes | | [options.display.bold] | Boolean | Bold style | | [options.display.dim] | Boolean | Dim style | @@ -139,41 +130,37 @@ Set new Y coordinate for cell. -### cell.getBackground() ⇒ Object +### cell.getBackground() ⇒ String Get current background color. **Kind**: instance method of [Cell](#Cell) -### cell.setBackground([r], [g], [b]) ⇒ [Cell](#Cell) +### cell.setBackground([colorName]) ⇒ [Cell](#Cell) Set new background color. **Kind**: instance method of [Cell](#Cell) | Param | Type | Default | Description | | --- | --- | --- | --- | -| [r] | Number | -1 | Red channel | -| [g] | Number | -1 | Green channel | -| [b] | Number | -1 | Blue channel | +| [colorName] | String | none | Color name from [COLORS](#COLORS) dictionary. | -### cell.getForeground() ⇒ Object +### cell.getForeground() ⇒ String Get current foreground color. **Kind**: instance method of [Cell](#Cell) -### cell.setForeground([r], [g], [b]) ⇒ [Cell](#Cell) +### cell.setForeground([colorName]) ⇒ [Cell](#Cell) Set new foreground color. **Kind**: instance method of [Cell](#Cell) | Param | Type | Default | Description | | --- | --- | --- | --- | -| [r] | Number | -1 | Red channel | -| [g] | Number | -1 | Green channel | -| [b] | Number | -1 | Blue channel | +| [colorName] | String | none | Color name from [COLORS](#COLORS) dictionary. | @@ -233,179 +220,6 @@ Convert cell to VT100 compatible control sequence. Wrapper around `new Cell()`. **Kind**: static method of [Cell](#Cell) - - -## Color -Color class responsible for converting colors between rgb and hex. - -**Kind**: global class -**Since**: 3.1.0 - -* [Color](#Color) - * [new Color(color)](#new_Color_new) - * _instance_ - * [.getR()](#Color+getR) ⇒ Number - * [.setR(value)](#Color+setR) ⇒ [Color](#Color) - * [.getG()](#Color+getG) ⇒ Number - * [.setG(value)](#Color+setG) ⇒ [Color](#Color) - * [.getB()](#Color+getB) ⇒ Number - * [.setB(value)](#Color+setB) ⇒ [Color](#Color) - * [.toRgb()](#Color+toRgb) ⇒ Object - * [.toHex()](#Color+toHex) ⇒ String - * _static_ - * [.isNamed(color)](#Color.isNamed) ⇒ Boolean - * [.isRgb(rgb)](#Color.isRgb) ⇒ Boolean - * [.isHex(hex)](#Color.isHex) ⇒ Boolean - * [.fromRgb(rgb)](#Color.fromRgb) ⇒ [Color](#Color) - * [.fromHex(hex)](#Color.fromHex) ⇒ [Color](#Color) - * [.create()](#Color.create) ⇒ [Color](#Color) - - - -### new Color(color) -Create new Color instance. -You can use different formats of color: named, rgb or hex. -[Color](#Color) will try to parse your provided color, otherwise throws an error. - - -| Param | Type | Description | -| --- | --- | --- | -| color | String | Object | String with named color, rgb, hex or object with {r, g, b} properties | -| [color.r] | Number | Red channel | -| [color.g] | Number | Green channel | -| [color.b] | Number | Blue channel | - -**Example** -```js -Color.create('black'); -Color.create('rgb(0, 10, 20)'); -Color.create('#AABBCC'); -Color.create({r: 0, g: 10, b: 20}); -``` - - -### color.getR() ⇒ Number -Get rounded value of red channel. - -**Kind**: instance method of [Color](#Color) - - -### color.setR(value) ⇒ [Color](#Color) -Set clamped value of red channel. - -**Kind**: instance method of [Color](#Color) - -| Param | Type | -| --- | --- | -| value | Number | - - - -### color.getG() ⇒ Number -Get rounded value of green channel. - -**Kind**: instance method of [Color](#Color) - - -### color.setG(value) ⇒ [Color](#Color) -Set clamped value of green channel. - -**Kind**: instance method of [Color](#Color) - -| Param | Type | -| --- | --- | -| value | Number | - - - -### color.getB() ⇒ Number -Get rounded value of blue channel. - -**Kind**: instance method of [Color](#Color) - - -### color.setB(value) ⇒ [Color](#Color) -Set clamped value of blue channel. - -**Kind**: instance method of [Color](#Color) - -| Param | Type | -| --- | --- | -| value | Number | - - - -### color.toRgb() ⇒ Object -Convert color to RGB representation. - -**Kind**: instance method of [Color](#Color) - - -### color.toHex() ⇒ String -Convert color to HEX representation. - -**Kind**: instance method of [Color](#Color) - - -### Color.isNamed(color) ⇒ Boolean -Check if provided color is named color. - -**Kind**: static method of [Color](#Color) - -| Param | Type | -| --- | --- | -| color | String | - - - -### Color.isRgb(rgb) ⇒ Boolean -Check if provided color is written in RGB representation. - -**Kind**: static method of [Color](#Color) - -| Param | Type | Description | -| --- | --- | --- | -| rgb | String | RGB color | - - - -### Color.isHex(hex) ⇒ Boolean -Check if provided color is written in HEX representation. - -**Kind**: static method of [Color](#Color) - -| Param | Type | Description | -| --- | --- | --- | -| hex | String | HEX color | - - - -### Color.fromRgb(rgb) ⇒ [Color](#Color) -Parse RGB color and return Color instance. - -**Kind**: static method of [Color](#Color) - -| Param | Type | Description | -| --- | --- | --- | -| rgb | String | RGB color | - - - -### Color.fromHex(hex) ⇒ [Color](#Color) -Parse HEX color and return Color instance. - -**Kind**: static method of [Color](#Color) - -| Param | Type | Description | -| --- | --- | --- | -| hex | String | HEX color | - - - -### Color.create() ⇒ [Color](#Color) -Wrapper around `new Color()`. - -**Kind**: static method of [Color](#Color) ## Cursor @@ -659,14 +473,12 @@ This color is used when text is rendering. | Param | Type | Description | | --- | --- | --- | -| color | String | Boolean | Color name or false if you want to disable foreground filling | +| color | String | Color name or `none` if you want to disable foreground filling | **Example** ```js cursor.foreground('black'); -cursor.foreground('#AABBCC'); -cursor.foreground('rgb(0, 200, 255)'); -cursor.foreground(false); // disables foreground filling +cursor.foreground('none'); ``` @@ -678,14 +490,12 @@ This color is used for filling the whole cell in the TTY. | Param | Type | Description | | --- | --- | --- | -| color | String | Boolean | Color name or false if you want to disable background filling | +| color | String | Color name or `none` if you want to disable background filling | **Example** ```js cursor.background('black'); -cursor.background('#AABBCC'); -cursor.background('rgb(0, 200, 255)'); -cursor.background(false); // disables background filling +cursor.background('none'); ``` @@ -926,7 +736,7 @@ Wrapper around `new Cursor()`. ## COLORS : Object -Dictionary of colors which can be used for instantiating the [Color](#Color) instance. +Dictionary of colors which can be used in cursor. **Kind**: global constant diff --git a/doc/api/Shape.md b/doc/api/Shape.md index 5952713..bc6151b 100644 --- a/doc/api/Shape.md +++ b/doc/api/Shape.md @@ -5,6 +5,9 @@

Base class for creating other shapes. Each custom shape must extends from this class.

+
CodeShape
+

Implements Code shape which renders the highlighted code at specified point.

+
FigTextShape

Implements ASCII art text via Figlet fonts.

@@ -45,9 +48,9 @@ Each custom shape must extends from this class. * [.setX([x])](#Shape+setX) ⇒ [Shape](#Shape) * [.getY()](#Shape+getY) ⇒ Number * [.setY([y])](#Shape+setY) ⇒ [Shape](#Shape) - * [.getBackground()](#Shape+getBackground) ⇒ String | Boolean + * [.getBackground()](#Shape+getBackground) ⇒ String * [.setBackground([background])](#Shape+setBackground) ⇒ [Shape](#Shape) - * [.getForeground()](#Shape+getForeground) ⇒ String | Boolean + * [.getForeground()](#Shape+getForeground) ⇒ String * [.setForeground([foreground])](#Shape+setForeground) ⇒ [Shape](#Shape) * *[.render()](#Shape+render)* * [.toObject()](#Shape+toObject) ⇒ Object @@ -73,8 +76,8 @@ This shape renders nothing, but throws an exception that you need to implement t | [options.height] | Number | String | Shape height can be 100 (cells) or 100% | | [options.x] | Number | String | Absolute coordinate X can be 100 (cells), left, center, right or percents | | [options.y] | Number | String | Absolute coordinate Y can be 100 (cells), top, middle, bottom or percents | -| [options.background] | String | Boolean | Background color can be color name, rgb, hex or false it you want to disable | -| [options.foreground] | String | Boolean | Foreground color can be color name, rgb, hex or false it you want to disable | +| [options.background] | String | Background color can be only color name or `none` if you want to disable | +| [options.foreground] | String | Foreground color can be only color name or `none` if you want to disable | **Example** ```js @@ -248,7 +251,7 @@ shape.setY('50%'); // move shape to 50% by Y axis ``` -### shape.getBackground() ⇒ String | Boolean +### shape.getBackground() ⇒ String Get background color. **Kind**: instance method of [Shape](#Shape) @@ -261,18 +264,16 @@ Set new background color. | Param | Type | Default | Description | | --- | --- | --- | --- | -| [background] | String | Boolean | false | Color name, rgb, hex or false if you want to disable background | +| [background] | String | none | Color name or `none` if you want to disable background | **Example** ```js shape.setBackground('black'); -shape.setBackground('#AABBCC'); -shape.setBackground('rgb(0, 100, 200)'); -shape.setBackground(false); +shape.setBackground('none'); ``` -### shape.getForeground() ⇒ String | Boolean +### shape.getForeground() ⇒ String Get foreground color. **Kind**: instance method of [Shape](#Shape) @@ -285,14 +286,12 @@ Set new foreground color. | Param | Type | Default | Description | | --- | --- | --- | --- | -| [foreground] | String | Boolean | false | Color name, rgb, hex or false if you want to disable foreground | +| [foreground] | String | none | Color name or `none` if you want to disable foreground | **Example** ```js shape.setForeground('black'); -shape.setForeground('#AABBCC'); -shape.setForeground('rgb(0, 100, 200)'); -shape.setForeground(false); +shape.setForeground('none'); ``` @@ -360,6 +359,306 @@ Though, you can add cursor in the runtime via [setCursor](setCursor) method. | json | String | JSON string that you got from [Shape.toJSON](Shape.toJSON) | | [cursor] | Cursor | Cursor instance | + + +## Code ⇐ [Shape](#Shape) +Implements Code shape which renders the highlighted code at specified point. + +**Kind**: global class +**Extends:** [Shape](#Shape) +**Since**: 1.0.0 + +* [Code](#Code) ⇐ [Shape](#Shape) + * [new Code(cursor, [options])](#new_Code_new) + * [.getCode()](#Code+getCode) ⇒ String + * [.setCode([code])](#Code+setCode) ⇒ [Shape](#Shape) + * [.get(path)](#Shape+get) ⇒ \* + * [.set(path, value)](#Shape+set) ⇒ [Shape](#Shape) + * [.getCursor()](#Shape+getCursor) ⇒ Cursor + * [.setCursor(cursor)](#Shape+setCursor) ⇒ [Shape](#Shape) + * [.getText()](#Shape+getText) ⇒ String + * [.setText([text])](#Shape+setText) ⇒ [Shape](#Shape) + * [.getWidth()](#Shape+getWidth) ⇒ Number + * [.setWidth([width])](#Shape+setWidth) ⇒ [Shape](#Shape) + * [.getHeight()](#Shape+getHeight) ⇒ Number + * [.setHeight([height])](#Shape+setHeight) ⇒ [Shape](#Shape) + * [.getX()](#Shape+getX) ⇒ Number + * [.setX([x])](#Shape+setX) ⇒ [Shape](#Shape) + * [.getY()](#Shape+getY) ⇒ Number + * [.setY([y])](#Shape+setY) ⇒ [Shape](#Shape) + * [.getBackground()](#Shape+getBackground) ⇒ String + * [.setBackground([background])](#Shape+setBackground) ⇒ [Shape](#Shape) + * [.getForeground()](#Shape+getForeground) ⇒ String + * [.setForeground([foreground])](#Shape+setForeground) ⇒ [Shape](#Shape) + * [.render()](#Shape+render) + * [.toObject()](#Shape+toObject) ⇒ Object + * [.toJSON()](#Shape+toJSON) ⇒ JSON + + + +### new Code(cursor, [options]) +Create Code shape. + + +| Param | Type | Description | +| --- | --- | --- | +| cursor | Cursor | Cursor instance | +| [options] | Object | Options object | +| [options.code] | String | Code fragment that you want to show | + +**Example** +```js +Code.create(cursor, { + code: 'console.log('Your code here');' +}); +``` + + +### code.getCode() ⇒ String +Get current code from shape. + +**Kind**: instance method of [Code](#Code) + + +### code.setCode([code]) ⇒ [Shape](#Shape) +Set new code to this shape. + +**Kind**: instance method of [Code](#Code) + +| Param | Type | Default | +| --- | --- | --- | +| [code] | String | '' | + + + +### code.get(path) ⇒ \* +Get option value. + +**Kind**: instance method of [Code](#Code) + +| Param | Type | Description | +| --- | --- | --- | +| path | String | Path can be set with dot-notation | + +**Example** +```js +shape.get('my.options.object.value'); +``` + + +### code.set(path, value) ⇒ [Shape](#Shape) +Set new option value. + +**Kind**: instance method of [Code](#Code) + +| Param | Type | Description | +| --- | --- | --- | +| path | String | Path can be set with dot-notation | +| value | \* | Value that need to be written to the options object | + +**Example** +```js +shape.set('my.options.object.value', 'value'); +``` + + +### code.getCursor() ⇒ Cursor +Get cursor that used for render this shape. + +**Kind**: instance method of [Code](#Code) + + +### code.setCursor(cursor) ⇒ [Shape](#Shape) +Assign cursor to the shape which will be used for render this shape. + +**Kind**: instance method of [Code](#Code) + +| Param | Type | +| --- | --- | +| cursor | Cursor | + + + +### code.getText() ⇒ String +Get text content from this shape. + +**Kind**: instance method of [Code](#Code) + + +### code.setText([text]) ⇒ [Shape](#Shape) +Set new text content to this shape. + +**Kind**: instance method of [Code](#Code) + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [text] | String | '' | New text | + + + +### code.getWidth() ⇒ Number +Get shape width. + +**Kind**: instance method of [Code](#Code) +**Overrides:** [getWidth](#Shape+getWidth) + + +### code.setWidth([width]) ⇒ [Shape](#Shape) +Set new shape width. + +**Kind**: instance method of [Code](#Code) + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [width] | Number | String | 15 | Shape width | + +**Example** +```js +shape.setWidth(15); // shape width is equal to 15 cells in the terminal +shape.setWidth('20%'); // shape width is equal to 20% of total viewport width +``` + + +### code.getHeight() ⇒ Number +Get shape height. + +**Kind**: instance method of [Code](#Code) +**Overrides:** [getHeight](#Shape+getHeight) + + +### code.setHeight([height]) ⇒ [Shape](#Shape) +Set new shape height. + +**Kind**: instance method of [Code](#Code) + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [height] | Number | String | 5 | Shape height | + +**Example** +```js +shape.setHeight(15); // shape height is equal to 15 cells in the terminal +shape.setHeight('20%'); // shape height is equal to 20% of total viewport height +``` + + +### code.getX() ⇒ Number +Get X coordinate. + +**Kind**: instance method of [Code](#Code) + + +### code.setX([x]) ⇒ [Shape](#Shape) +Set X coordinate. + +**Kind**: instance method of [Code](#Code) + +| Param | Type | Default | +| --- | --- | --- | +| [x] | Number | String | 10 | + +**Example** +```js +shape.setX(2); // move shape to third cell by X axis +shape.setX('left'); // align shape to the left +shape.setX('center'); // align shape in the center +shape.setX('right'); // align shape to the right +shape.setX('50%'); // move shape to 50% by X axis +``` + + +### code.getY() ⇒ Number +Get Y coordinate. + +**Kind**: instance method of [Code](#Code) + + +### code.setY([y]) ⇒ [Shape](#Shape) +Set Y coordinate. + +**Kind**: instance method of [Code](#Code) + +| Param | Type | Default | +| --- | --- | --- | +| [y] | Number | String | 10 | + +**Example** +```js +shape.setY(2); // move shape to third cell by Y axis +shape.setY('top'); // align shape to the top +shape.setY('middle'); // align shape in the middle +shape.setY('bottom'); // align shape to the bottom +shape.setY('50%'); // move shape to 50% by Y axis +``` + + +### code.getBackground() ⇒ String +Get background color. + +**Kind**: instance method of [Code](#Code) + + +### code.setBackground([background]) ⇒ [Shape](#Shape) +Set new background color. + +**Kind**: instance method of [Code](#Code) + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [background] | String | none | Color name or `none` if you want to disable background | + +**Example** +```js +shape.setBackground('black'); +shape.setBackground('none'); +``` + + +### code.getForeground() ⇒ String +Get foreground color. + +**Kind**: instance method of [Code](#Code) + + +### code.setForeground([foreground]) ⇒ [Shape](#Shape) +Set new foreground color. + +**Kind**: instance method of [Code](#Code) + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [foreground] | String | none | Color name or `none` if you want to disable foreground | + +**Example** +```js +shape.setForeground('black'); +shape.setForeground('none'); +``` + + +### code.render() +Base render method that must be implemented in childes. + +**Kind**: instance method of [Code](#Code) +**Overrides:** [render](#Shape+render) +**Throws**: + +- Error Throws error if method is not overridden + + + +### code.toObject() ⇒ Object +Returns Object representation of the shape. +This representation consists of all options fields that you can pass in the constructor. + +**Kind**: instance method of [Code](#Code) +**Overrides:** [toObject](#Shape+toObject) + + +### code.toJSON() ⇒ JSON +Returns JSON representation of the shape. + +**Kind**: instance method of [Code](#Code) ## FigText ⇐ [Shape](#Shape) @@ -393,9 +692,9 @@ Implements ASCII art text via Figlet fonts. * [.setX([x])](#Shape+setX) ⇒ [Shape](#Shape) * [.getY()](#Shape+getY) ⇒ Number * [.setY([y])](#Shape+setY) ⇒ [Shape](#Shape) - * [.getBackground()](#Shape+getBackground) ⇒ String | Boolean + * [.getBackground()](#Shape+getBackground) ⇒ String * [.setBackground([background])](#Shape+setBackground) ⇒ [Shape](#Shape) - * [.getForeground()](#Shape+getForeground) ⇒ String | Boolean + * [.getForeground()](#Shape+getForeground) ⇒ String * [.setForeground([foreground])](#Shape+setForeground) ⇒ [Shape](#Shape) * [.toJSON()](#Shape+toJSON) ⇒ JSON @@ -652,7 +951,7 @@ shape.setY('50%'); // move shape to 50% by Y axis ``` -### figText.getBackground() ⇒ String | Boolean +### figText.getBackground() ⇒ String Get background color. **Kind**: instance method of [FigText](#FigText) @@ -665,18 +964,16 @@ Set new background color. | Param | Type | Default | Description | | --- | --- | --- | --- | -| [background] | String | Boolean | false | Color name, rgb, hex or false if you want to disable background | +| [background] | String | none | Color name or `none` if you want to disable background | **Example** ```js shape.setBackground('black'); -shape.setBackground('#AABBCC'); -shape.setBackground('rgb(0, 100, 200)'); -shape.setBackground(false); +shape.setBackground('none'); ``` -### figText.getForeground() ⇒ String | Boolean +### figText.getForeground() ⇒ String Get foreground color. **Kind**: instance method of [FigText](#FigText) @@ -689,14 +986,12 @@ Set new foreground color. | Param | Type | Default | Description | | --- | --- | --- | --- | -| [foreground] | String | Boolean | false | Color name, rgb, hex or false if you want to disable foreground | +| [foreground] | String | none | Color name or `none` if you want to disable foreground | **Example** ```js shape.setForeground('black'); -shape.setForeground('#AABBCC'); -shape.setForeground('rgb(0, 100, 200)'); -shape.setForeground(false); +shape.setForeground('none'); ``` @@ -735,9 +1030,9 @@ Implements support for Image drawing in terminal. * [.setX([x])](#Shape+setX) ⇒ [Shape](#Shape) * [.getY()](#Shape+getY) ⇒ Number * [.setY([y])](#Shape+setY) ⇒ [Shape](#Shape) - * [.getBackground()](#Shape+getBackground) ⇒ String | Boolean + * [.getBackground()](#Shape+getBackground) ⇒ String * [.setBackground([background])](#Shape+setBackground) ⇒ [Shape](#Shape) - * [.getForeground()](#Shape+getForeground) ⇒ String | Boolean + * [.getForeground()](#Shape+getForeground) ⇒ String * [.setForeground([foreground])](#Shape+setForeground) ⇒ [Shape](#Shape) * [.render()](#Shape+render) * [.toJSON()](#Shape+toJSON) ⇒ JSON @@ -975,7 +1270,7 @@ shape.setY('50%'); // move shape to 50% by Y axis ``` -### image.getBackground() ⇒ String | Boolean +### image.getBackground() ⇒ String Get background color. **Kind**: instance method of [Image](#Image) @@ -988,18 +1283,16 @@ Set new background color. | Param | Type | Default | Description | | --- | --- | --- | --- | -| [background] | String | Boolean | false | Color name, rgb, hex or false if you want to disable background | +| [background] | String | none | Color name or `none` if you want to disable background | **Example** ```js shape.setBackground('black'); -shape.setBackground('#AABBCC'); -shape.setBackground('rgb(0, 100, 200)'); -shape.setBackground(false); +shape.setBackground('none'); ``` -### image.getForeground() ⇒ String | Boolean +### image.getForeground() ⇒ String Get foreground color. **Kind**: instance method of [Image](#Image) @@ -1012,14 +1305,12 @@ Set new foreground color. | Param | Type | Default | Description | | --- | --- | --- | --- | -| [foreground] | String | Boolean | false | Color name, rgb, hex or false if you want to disable foreground | +| [foreground] | String | none | Color name or `none` if you want to disable foreground | **Example** ```js shape.setForeground('black'); -shape.setForeground('#AABBCC'); -shape.setForeground('rgb(0, 100, 200)'); -shape.setForeground(false); +shape.setForeground('none'); ``` @@ -1074,9 +1365,9 @@ Implements rectangle shape with text support. * [.setX([x])](#Shape+setX) ⇒ [Shape](#Shape) * [.getY()](#Shape+getY) ⇒ Number * [.setY([y])](#Shape+setY) ⇒ [Shape](#Shape) - * [.getBackground()](#Shape+getBackground) ⇒ String | Boolean + * [.getBackground()](#Shape+getBackground) ⇒ String * [.setBackground([background])](#Shape+setBackground) ⇒ [Shape](#Shape) - * [.getForeground()](#Shape+getForeground) ⇒ String | Boolean + * [.getForeground()](#Shape+getForeground) ⇒ String * [.setForeground([foreground])](#Shape+setForeground) ⇒ [Shape](#Shape) * [.render()](#Shape+render) * [.toObject()](#Shape+toObject) ⇒ Object @@ -1266,7 +1557,7 @@ shape.setY('50%'); // move shape to 50% by Y axis ``` -### rectangle.getBackground() ⇒ String | Boolean +### rectangle.getBackground() ⇒ String Get background color. **Kind**: instance method of [Rectangle](#Rectangle) @@ -1279,18 +1570,16 @@ Set new background color. | Param | Type | Default | Description | | --- | --- | --- | --- | -| [background] | String | Boolean | false | Color name, rgb, hex or false if you want to disable background | +| [background] | String | none | Color name or `none` if you want to disable background | **Example** ```js shape.setBackground('black'); -shape.setBackground('#AABBCC'); -shape.setBackground('rgb(0, 100, 200)'); -shape.setBackground(false); +shape.setBackground('none'); ``` -### rectangle.getForeground() ⇒ String | Boolean +### rectangle.getForeground() ⇒ String Get foreground color. **Kind**: instance method of [Rectangle](#Rectangle) @@ -1303,14 +1592,12 @@ Set new foreground color. | Param | Type | Default | Description | | --- | --- | --- | --- | -| [foreground] | String | Boolean | false | Color name, rgb, hex or false if you want to disable foreground | +| [foreground] | String | none | Color name or `none` if you want to disable foreground | **Example** ```js shape.setForeground('black'); -shape.setForeground('#AABBCC'); -shape.setForeground('rgb(0, 100, 200)'); -shape.setForeground(false); +shape.setForeground('none'); ``` @@ -1375,9 +1662,9 @@ Implements Text shape which renders the text at specified point. * [.setX([x])](#Shape+setX) ⇒ [Shape](#Shape) * [.getY()](#Shape+getY) ⇒ Number * [.setY([y])](#Shape+setY) ⇒ [Shape](#Shape) - * [.getBackground()](#Shape+getBackground) ⇒ String | Boolean + * [.getBackground()](#Shape+getBackground) ⇒ String * [.setBackground([background])](#Shape+setBackground) ⇒ [Shape](#Shape) - * [.getForeground()](#Shape+getForeground) ⇒ String | Boolean + * [.getForeground()](#Shape+getForeground) ⇒ String * [.setForeground([foreground])](#Shape+setForeground) ⇒ [Shape](#Shape) * [.render()](#Shape+render) * [.toObject()](#Shape+toObject) ⇒ Object @@ -1696,7 +1983,7 @@ shape.setY('50%'); // move shape to 50% by Y axis ``` -### text.getBackground() ⇒ String | Boolean +### text.getBackground() ⇒ String Get background color. **Kind**: instance method of [Text](#Text) @@ -1709,18 +1996,16 @@ Set new background color. | Param | Type | Default | Description | | --- | --- | --- | --- | -| [background] | String | Boolean | false | Color name, rgb, hex or false if you want to disable background | +| [background] | String | none | Color name or `none` if you want to disable background | **Example** ```js shape.setBackground('black'); -shape.setBackground('#AABBCC'); -shape.setBackground('rgb(0, 100, 200)'); -shape.setBackground(false); +shape.setBackground('none'); ``` -### text.getForeground() ⇒ String | Boolean +### text.getForeground() ⇒ String Get foreground color. **Kind**: instance method of [Text](#Text) @@ -1733,14 +2018,12 @@ Set new foreground color. | Param | Type | Default | Description | | --- | --- | --- | --- | -| [foreground] | String | Boolean | false | Color name, rgb, hex or false if you want to disable foreground | +| [foreground] | String | none | Color name or `none` if you want to disable foreground | **Example** ```js shape.setForeground('black'); -shape.setForeground('#AABBCC'); -shape.setForeground('rgb(0, 100, 200)'); -shape.setForeground(false); +shape.setForeground('none'); ```