Angular service

$vibrant source

Generates swatches from an image using Vibrant.js

Methods

$vibrant (element, 64, 5) -> array

Parameters:
NameTypeDescription
element element

The img element to use for swatch generation

64 int

colors The amount of colors in initial palette from which the swatches will be generated

5 int

quality The quality of the generated swatches. 0 is highest

Returns:
TypeDescription
array

An array with all swatches. A swatch can be undefined

darkMuted (element, 64, 5) -> Swatch

Alias for $vibrant(element, colors, quality).DarkMuted

Parameters:
NameTypeDescription
element element

The img element to use for swatch generation

64 int

colors The amount of colors in initial palette from which the swatches will be generated

5 int

quality The quality of the generated swatches. 0 is highest

Returns:
TypeDescription
Swatch

The 'DarkMuted' Swatch or undefined

darkVibrant (element, 64, 5) -> Swatch

Alias for $vibrant(element, colors, quality).DarkVibrant

Parameters:
NameTypeDescription
element element

The img element to use for swatch generation

64 int

colors The amount of colors in initial palette from which the swatches will be generated

5 int

quality The quality of the generated swatches. 0 is highest

Returns:
TypeDescription
Swatch

The 'DarkVibrant' Swatch or undefined

get (url, 64, 5) -> Promise

Loads an image from the given url and generates its swatches

Parameters:
NameTypeDescription
url string

The URL to load the image from

64 int

colors The amount of colors in initial palette from which the swatches will be generated

5 int

quality The quality of the generated swatches. 0 is highest

Returns:
TypeDescription
Promise

a Promise which resolves when the swatches are generated

getDefaultColors -> int

Returns:
TypeDescription
int

The default amount of colors used for swatch generation

getDefaultQuality -> int

Returns:
TypeDescription
int

The default quality used for swatch generation

lightMuted (element, 64, 5) -> Swatch

Alias for $vibrant(element, colors, quality).LightMuted

Parameters:
NameTypeDescription
element element

The img element to use for swatch generation

64 int

colors The amount of colors in initial palette from which the swatches will be generated

5 int

quality The quality of the generated swatches. 0 is highest

Returns:
TypeDescription
Swatch

The 'LightMuted' Swatch or undefined

lightVibrant (element, 64, 5) -> Swatch

Alias for $vibrant(element, colors, quality).LightVibrant

Parameters:
NameTypeDescription
element element

The img element to use for swatch generation

64 int

colors The amount of colors in initial palette from which the swatches will be generated

5 int

quality The quality of the generated swatches. 0 is highest

Returns:
TypeDescription
Swatch

The 'LightVibrant' Swatch or undefined

muted (element, 64, 5) -> Swatch

Alias for $vibrant(element, colors, quality).Muted

Parameters:
NameTypeDescription
element element

The img element to use for swatch generation

64 int

colors The amount of colors in initial palette from which the swatches will be generated

5 int

quality The quality of the generated swatches. 0 is highest

Returns:
TypeDescription
Swatch

The 'Muted' Swatch or undefined

vibrant (element, 64, 5) -> Swatch

Alias for $vibrant(element, colors, quality).Vibrant

Parameters:
NameTypeDescription
element element

The img element to use for swatch generation

64 int

colors The amount of colors in initial palette from which the swatches will be generated

5 int

quality The quality of the generated swatches. 0 is highest

Returns:
TypeDescription
Swatch

The 'Vibrant' Swatch or undefined