public Color getDarkMainColor(Color defaultColor) { var mainSwatch = getMainSwatch(); float[] newHsl = copyHslValues(mainSwatch); newHsl[2] = TARGET_DARK_LUMA; var mainDarkSwatch = new Swatch(ColorUtils.HSLtoRGB(newHsl), 0); return(mainDarkSwatch != null?mainDarkSwatch.GetRgb() : defaultColor); }
/** * Try and generate any missing swatches from the swatches we did find. */ private Boolean generateEmptySwatches() { if (mVibrantSwatch == null) { if (mDarkVibrantSwatch != null) { float[] newHsl = copyHslValues(mDarkVibrantSwatch); newHsl[2] = TARGET_NORMAL_LUMA; mVibrantSwatch = new Swatch(ColorUtils.HSLtoRGB(newHsl), 0); } else if (mLightVibrantSwatch != null) { float[] newHsl = copyHslValues(mLightVibrantSwatch); newHsl[2] = TARGET_NORMAL_LUMA; mVibrantSwatch = new Swatch(ColorUtils.HSLtoRGB(newHsl), 0); } } if (mDarkVibrantSwatch == null) { if (mVibrantSwatch != null) { float[] newHsl = copyHslValues(mVibrantSwatch); newHsl[2] = TARGET_DARK_LUMA; mDarkVibrantSwatch = new Swatch(ColorUtils.HSLtoRGB(newHsl), 0); } else if (mLightVibrantSwatch != null) { float[] newHsl = copyHslValues(mLightVibrantSwatch); newHsl[2] = TARGET_DARK_LUMA; mDarkVibrantSwatch = new Swatch(ColorUtils.HSLtoRGB(newHsl), 0); } } if (mLightVibrantSwatch == null) { if (mVibrantSwatch != null) { float[] newHsl = copyHslValues(mVibrantSwatch); newHsl[2] = TARGET_LIGHT_LUMA; mLightVibrantSwatch = new Swatch(ColorUtils.HSLtoRGB(newHsl), 0); } else if (mDarkVibrantSwatch != null) { float[] newHsl = copyHslValues(mDarkVibrantSwatch); newHsl[2] = TARGET_LIGHT_LUMA; mLightVibrantSwatch = new Swatch(ColorUtils.HSLtoRGB(newHsl), 0); } } if (mMutedSwatch == null) { if (mDarkMutedSwatch != null) { float[] newHsl = copyHslValues(mDarkMutedSwatch); newHsl[2] = TARGET_NORMAL_LUMA; mMutedSwatch = new Swatch(ColorUtils.HSLtoRGB(newHsl), 0); } else if (mLightMutedColor != null) { float[] newHsl = copyHslValues(mLightMutedColor); newHsl[2] = TARGET_NORMAL_LUMA; mMutedSwatch = new Swatch(ColorUtils.HSLtoRGB(newHsl), 0); } } if (mDarkMutedSwatch == null) { if (mMutedSwatch != null) { float[] newHsl = copyHslValues(mMutedSwatch); newHsl[2] = TARGET_DARK_LUMA; mDarkMutedSwatch = new Swatch(ColorUtils.HSLtoRGB(newHsl), 0); } else if (mLightMutedColor != null) { float[] newHsl = copyHslValues(mLightMutedColor); newHsl[2] = TARGET_DARK_LUMA; mDarkMutedSwatch = new Swatch(ColorUtils.HSLtoRGB(newHsl), 0); } } if (mLightMutedColor == null) { if (mMutedSwatch != null) { float[] newHsl = copyHslValues(mMutedSwatch); newHsl[2] = TARGET_LIGHT_LUMA; mLightMutedColor = new Swatch(ColorUtils.HSLtoRGB(newHsl), 0); } else if (mDarkMutedSwatch != null) { float[] newHsl = copyHslValues(mDarkMutedSwatch); newHsl[2] = TARGET_LIGHT_LUMA; mLightMutedColor = new Swatch(ColorUtils.HSLtoRGB(newHsl), 0); } } return(checkAnySwtchEmpty()); }