Constructor
new (require("ColorGroup"))()
- Source:
Store colors or groups and count similiar groups in the image.
Methods
addColor(hex, red, green, blue)
- Source:
Add color to the group.
Parameters:
Name | Type | Description |
---|---|---|
hex |
Number | Hexadecimal color from 0x000000 to 0xFFFFFF |
red |
Number | Integer red chanel from 0 to 255 |
green |
Number | Integer green chanel from 0 to 255 |
blue |
Number | Integer blue chanel from 0 to 255 |
addGroup(key)
- Source:
Add a key for a color, this key is a simplification to find neighboring colors. Neighboring colors has same key.
Parameters:
Name | Type | Description |
---|---|---|
key |
Number | Simplication of color |
getColors(distance, saturationImportance, count) → {Array.<Color>}
- Source:
List of colors sorted by importance (neighboring hare calculated by distance and removed). Importance is calculated with the saturation and count of neighboring colors.
Parameters:
Name | Type | Description |
---|---|---|
distance |
Number | Minimum distance between colors (from 0 to 1) |
saturationImportance |
Number | Determine the weight of the saturation for the calcul (from 0 to 1) |
count |
Number | Total pixels of image |
Returns:
- Type
- Array.<Color>
getList()
- Source:
Get list of groups of list of colors.
getMaxCountColor() → {Number}
- Source:
Max count of colors for a group of colors.
Returns:
- Type
- Number
getMaxWeight(saturationImportance, count) → {Number}
- Source:
Max color weight between the children colors, depends of his saturation and his count.
Parameters:
Name | Type | Description |
---|---|---|
saturationImportance |
Number | Determine the weight of the saturation for the calcul (from 0 to 1) |
count |
Number | Number of pixels in the image. |
Returns:
- Type
- Number
getMaxWeightColor(saturationImportance, count) → {Color}
- Source:
Color with the the max weight between the children colors, depends of his saturation and his count.
Parameters:
Name | Type | Description |
---|---|---|
saturationImportance |
Number | Determine the weight of the saturation for the calcul (from 0 to 1) |
count |
Number | Number of pixels in the image. |
Returns:
- Type
- Color