Open PercyBoyes opened 10 years ago
Could be easily done by adding the following lines to the LFXHSBColor
class:
public static LFXHSBColor fromColor(@ColorInt int color, @IntRange(from = 0, to = 10000) int kelvin) {
float[] hsb = new float[3];
Color.colorToHSV(color, hsb);
return getColor(hsb[0], hsb[1], hsb[2], kelvin);
}
public static LFXHSBColor fromRGB(@IntRange(from = 0, to = 255) int red,
@IntRange(from = 0, to = 255) int green,
@IntRange(from = 0, to = 255) int blue,
@IntRange(from = 0, to = 10000) int kelvin) {
int color = Color.rgb(red, green, blue);
return fromColor(color, kelvin);
}
Explained in the title