Android examples for Graphics:Color
get Color With Default from Palette
import android.support.v7.graphics.Palette; public class Main{ public static int getColorWithDefault(Palette palette, int defaultColor) { Palette.Swatch currentItem = null; if (currentItem == null) { currentItem = palette.getVibrantSwatch(); }//ww w . ja v a2s . com if (currentItem == null) { currentItem = palette.getLightVibrantSwatch(); } if (currentItem == null) { currentItem = palette.getDarkVibrantSwatch(); } if (currentItem == null) { currentItem = palette.getMutedSwatch(); } if (currentItem == null) { currentItem = palette.getLightMutedSwatch(); } if (currentItem == null) { currentItem = palette.getDarkMutedSwatch(); } return currentItem != null ? currentItem.getRgb() : defaultColor; } }