API Docs for: 3.8.0
Show:

Color.Base Class

Module: color-base
Parent Module: color

Color provides static methods for color conversion.

Y.Color.toRGB('f00'); // rgb(255, 0, 0)

Y.Color.toHex('rgb(255, 255, 0)'); // #ffff00

Item Index

Properties

Methods

_convertTo

(
  • clr
  • to
)
String protected

Defined in color/js/color-base.js:306

Available since 3.8.0

Converts the provided color string to the value type provided as to

Parameters:

Returns:

_getAlpha

(
  • clr
)
Number protected

Defined in color/js/color-base.js:270

Available since 3.8.0

Retrives the alpha channel from the provided string. If no alpha channel is present, 1 will be returned.

Parameters:

Returns:

_hexToRgb

(
  • str
  • [toArray]
)
String | Array protected

Defined in color/js/color-base.js:380

Available since 3.8.0

Processes the hex string into r, g, b values. Will return values as an array, or as an rgb string.

Parameters:

Returns:

_keywordToHex

(
  • clr
)
String protected

Defined in color/js/color-base.js:290

Available since 3.8.0

Returns the hex value string if found in the KEYWORDS object

Parameters:

Returns:

_rgbToHex

(
  • str
  • [toArray]
)
String | Array protected

Defined in color/js/color-base.js:411

Available since 3.8.0

Processes the rgb string into r, g, b values. Will return values as an array, or as a hex string.

Parameters:

Returns:

convert

(
  • str
  • to
)
String public

Defined in color/js/color-base.js:115

Available since 3.8.0

Parameters:

Returns:

findType

(
  • str
)
String public

Defined in color/js/color-base.js:242

Available since 3.8.0

Finds the value type based on the str value provided.

Parameters:

Returns:

fromArray

(
  • arr
  • template
)
String public

Defined in color/js/color-base.js:211

Available since 3.8.0

Converts the array of values to a string based on the provided template.

Parameters:

Returns:

toArray

(
  • str
)
Array public

Defined in color/js/color-base.js:171

Available since 3.8.0

Converts the provided color string to an array of values. Will return an empty array if the provided string is not able to be parsed.

Parameters:

Returns:

toHex

(
  • str
)
String public

Defined in color/js/color-base.js:132

Available since 3.8.0

Converts provided color value to a hex value string

Parameters:

  • str String

    Hex or RGB value string

Returns:

String: returns array of values or CSS string if options.css is true

toRGB

(
  • str
)
String public

Defined in color/js/color-base.js:145

Available since 3.8.0

Converts provided color value to an RGB value string

Parameters:

  • str String

    Hex or RGB value string

Returns:

toRGBA

(
  • str
)
String public

Defined in color/js/color-base.js:158

Available since 3.8.0

Converts provided color value to an RGB value string

Parameters:

  • str String

    Hex or RGB value string

Returns:

Properties

CONVERTS

Object static

Defined in color/js/color-base.js:106

Available since 3.8.0

Default: {}

KEYWORDS

Object static

Defined in color/js/color-base.js:24

Available since 3.8.0

REGEX_HEX

RegExp static

Defined in color/js/color-base.js:37

Available since 3.8.0

Default: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/

REGEX_HEX3

RegExp static

Defined in color/js/color-base.js:46

Available since 3.8.0

Default: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})/

REGEX_RGB

RegExp static

Defined in color/js/color-base.js:55

Available since 3.8.0

Default: /rgba?\(([0-9]{1,3}), ?([0-9]{1,3}), ?([0-9]{1,3}),? ?([.0-9]{1,3})?\)/

STR_HEX

String static

Defined in color/js/color-base.js:70

Available since 3.8.0

Default: #{*}{*}{*}

STR_RGB

String static

Defined in color/js/color-base.js:79

Available since 3.8.0

Default: rgb({*}, {*}, {*})

STR_RGBA

String static

Defined in color/js/color-base.js:88

Available since 3.8.0

Default: rgba({*}, {*}, {*}, {*})

TYPES

Object static

Defined in color/js/color-base.js:97

Available since 3.8.0

Default: {'rgb':'rgb', 'rgba':'rgba'}