Angular service
$vibrant source
Generates swatches from an image using Vibrant.js
Methods
-
$vibrant (element, 64, 5) -> array
-
Parameters:
Name Type Description 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:
Type Description array An array with all swatches. A swatch can be undefined
-
darkMuted (element, 64, 5) -> Swatch
-
Alias for $vibrant(element, colors, quality).DarkMuted
Parameters:
Name Type Description 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:
Type Description Swatch The 'DarkMuted' Swatch or undefined
-
darkVibrant (element, 64, 5) -> Swatch
-
Alias for $vibrant(element, colors, quality).DarkVibrant
Parameters:
Name Type Description 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:
Type Description Swatch The 'DarkVibrant' Swatch or undefined
-
get (url, 64, 5) -> Promise
-
Loads an image from the given url and generates its swatches
Parameters:
Name Type Description 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:
Type Description Promise a
Promise
which resolves when the swatches are generated
-
getDefaultColors -> int
-
Returns:
Type Description int The default amount of colors used for swatch generation
-
getDefaultQuality -> int
-
Returns:
Type Description int The default quality used for swatch generation
-
lightMuted (element, 64, 5) -> Swatch
-
Alias for $vibrant(element, colors, quality).LightMuted
Parameters:
Name Type Description 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:
Type Description Swatch The 'LightMuted' Swatch or undefined
-
lightVibrant (element, 64, 5) -> Swatch
-
Alias for $vibrant(element, colors, quality).LightVibrant
Parameters:
Name Type Description 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:
Type Description Swatch The 'LightVibrant' Swatch or undefined
-
muted (element, 64, 5) -> Swatch
-
Alias for $vibrant(element, colors, quality).Muted
Parameters:
Name Type Description 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:
Type Description Swatch The 'Muted' Swatch or undefined
-
vibrant (element, 64, 5) -> Swatch
-
Alias for $vibrant(element, colors, quality).Vibrant
Parameters:
Name Type Description 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:
Type Description Swatch The 'Vibrant' Swatch or undefined