ImageColors QML Type
Import Statement: | import org.kde.kirigami |
Properties
- average : color
- background : color
- closestToBlack : color
- closestToWhite : color
- dominant : color
- dominantContrast : color
- fallbackAverage : color
- fallbackBackground : color
- fallbackDominant : color
- fallbackDominantContrasting : color
- fallbackForeground : color
- fallbackHighlight : color
- fallbackPalette : list<imageColorsPaletteSwatch>
- fallbackPaletteBrightness : int
- foreground : color
- highlight : color
- palette : list<imageColorsPaletteSwatch>
- paletteBrightness : int
- source : var
Methods
- void update()
Detailed Description
Extracts the dominant colors from an element or an image and exports it to a color palette.
Property Documentation
average : color |
The average color of the source image.
background : color |
A color suitable for rendering a background behind the source image.
On dark items, this will be the color closest to black in the image if it's dark enough, or a dark gray otherwise. On light items, this will be the color closest to white in the image if it's light enough, or a bright gray otherwise.
closestToBlack : color |
The darkest color of the source image.
closestToWhite : color |
The lightest color of the source image.
dominant : color |
The dominant color of the source image.
The dominant color of the image is the color of the largest cluster in the image.
See https://en.wikipedia.org/wiki/K-means_clustering
dominantContrast : color |
Suggested "contrasting" color to the dominant one. It's the color in the palette nearest to the negative of the dominant
fallbackAverage : color |
The value to return when average is not available, e.g. when ImageColors is still computing it or the source is invalid.
fallbackBackground : color |
The value to return when background is not available, e.g. when ImageColors is still computing it or the source is invalid.
fallbackDominant : color |
The value to return when dominant is not available, e.g. when ImageColors is still computing it or the source is invalid.
fallbackDominantContrasting : color |
The value to return when dominantContrasting is not available, e.g. when ImageColors is still computing it or the source is invalid.
fallbackForeground : color |
The value to return when foreground is not available, e.g. when ImageColors is still computing it or the source is invalid.
fallbackHighlight : color |
The value to return when highlight is not available, e.g. when ImageColors is still computing it or the source is invalid.
fallbackPalette : list<imageColorsPaletteSwatch> |
The value to return when palette is not available, e.g. when ImageColors is still computing it or the source is invalid.
fallbackPaletteBrightness : int |
The value to return when paletteBrightness is not available, e.g. when ImageColors is still computing it or the source is invalid.
foreground : color |
A color suitable for rendering text and other foreground over the source image.
On dark items, this will be the color closest to white in the image if it's light enough, or a bright gray otherwise. On light items, this will be the color closest to black in the image if it's dark enough, or a dark gray otherwise.
highlight : color |
An accent color extracted from the source image.
The accent color is the color cluster with the highest CIELAB chroma in the source image.
See https://en.wikipedia.org/wiki/Colorfulness#Chroma
palette : list<imageColorsPaletteSwatch> |
A list of colors and related information about then.
Each list item has the following properties:
- color: The color of the list item.
- ratio: How dominant the color is in the source image.
- contrastingColor: The color from the source image that's closest to the inverse of color.
The list is sorted by ratio
; the first element is the most dominant color in the source image and the last element is the least dominant color of the image.
Note: K-means clustering is used to extract these colors; see https://en.wikipedia.org/wiki/K-means_clustering.
paletteBrightness : int |
Information whether the palette is towards a light or dark color scheme, possible values are:
- ColorUtils.Light
- ColorUtils.Dark
source : var |
The source from which colors should be extracted from.
source can be one of the following:
- Item
- QImage
- QIcon
- Icon name
Note that an Item's color palette will only be extracted once unless you call update(), regardless of how the item hanges.
Method Documentation
void update() |
Updates the colors