Java Code Examples for android.support.v7.graphics.Palette#getLightMutedSwatch()

The following examples show how to use android.support.v7.graphics.Palette#getLightMutedSwatch() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RetroMusicColorUtil.java    From RetroMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
public static int[] getMultipleColor(Palette palette) {
    int[] colors = new int[2];
    if (palette != null) {
        if (palette.getVibrantSwatch() != null) {
            colors[0] = palette.getVibrantSwatch().getRgb();
        } else if (palette.getMutedSwatch() != null) {
            colors[1] = palette.getMutedSwatch().getRgb();
        } else if (palette.getDarkVibrantSwatch() != null) {
            colors[0] = palette.getDarkVibrantSwatch().getRgb();
        } else if (palette.getDarkMutedSwatch() != null) {
            colors[1] = palette.getDarkMutedSwatch().getRgb();
        } else if (palette.getLightVibrantSwatch() != null) {
            colors[0] = palette.getLightVibrantSwatch().getRgb();
        } else if (palette.getLightMutedSwatch() != null) {
            colors[1] = palette.getLightMutedSwatch().getRgb();
        } else if (!palette.getSwatches().isEmpty()) {
            colors[0] = Collections.max(palette.getSwatches(), SwatchComparator.getInstance()).getRgb();
        }
    }
    return colors;
}
 
Example 2
Source File: MovieDetailActivity.java    From Material-Movies with Apache License 2.0 6 votes vote down vote up
@Override
public void onGenerated(Palette palette) {

    if (palette != null) {

        final Swatch darkVibrantSwatch    = palette.getDarkVibrantSwatch();
        final Swatch darkMutedSwatch      = palette.getDarkMutedSwatch();
        final Swatch lightVibrantSwatch   = palette.getLightVibrantSwatch();
        final Swatch lightMutedSwatch     = palette.getLightMutedSwatch();
        final Swatch vibrantSwatch        = palette.getVibrantSwatch();

        final Swatch backgroundAndContentColors = (darkVibrantSwatch != null)
            ? darkVibrantSwatch : darkMutedSwatch;

        final Swatch titleAndFabColors = (darkVibrantSwatch != null)
            ? lightVibrantSwatch : lightMutedSwatch;

        setBackgroundAndFabContentColors(backgroundAndContentColors);

        setHeadersTitlColors(titleAndFabColors);

        setVibrantElements(vibrantSwatch);
    }
}
 
Example 3
Source File: DetailActivity.java    From RxAndroidBootstrap with Apache License 2.0 6 votes vote down vote up
@Override
public void onGenerated(Palette palette) {
    try {
        if (palette != null) {
            final Palette.Swatch darkVibrantSwatch = palette.getDarkVibrantSwatch();
            final Palette.Swatch darkMutedSwatch = palette.getDarkMutedSwatch();
            final Palette.Swatch lightVibrantSwatch = palette.getLightVibrantSwatch();
            final Palette.Swatch lightMutedSwatch = palette.getLightMutedSwatch();
            final Palette.Swatch vibrantSwatch = palette.getVibrantSwatch();

            final Palette.Swatch backgroundAndContentColors = (darkVibrantSwatch != null)
                    ? darkVibrantSwatch : darkMutedSwatch;

            final Palette.Swatch titleAndFabColors = (darkVibrantSwatch != null)
                    ? lightVibrantSwatch : lightMutedSwatch;

            toolbar.setBackgroundColor(backgroundAndContentColors.getRgb());
            //   bodyTextview.setBackgroundColor(backgroundAndContentColors.getRgb());
            titleTextView.setTextColor(titleAndFabColors.getRgb());
        }
    } catch (Exception e) {

    }
}
 
Example 4
Source File: DetailActivity.java    From MVPAndroidBootstrap with Apache License 2.0 6 votes vote down vote up
@Override
public void onGenerated(Palette palette) {
    try {
        if (palette != null) {
            final Palette.Swatch darkVibrantSwatch = palette.getDarkVibrantSwatch();
            final Palette.Swatch darkMutedSwatch = palette.getDarkMutedSwatch();
            final Palette.Swatch lightVibrantSwatch = palette.getLightVibrantSwatch();
            final Palette.Swatch lightMutedSwatch = palette.getLightMutedSwatch();
            final Palette.Swatch vibrantSwatch = palette.getVibrantSwatch();

            final Palette.Swatch backgroundAndContentColors = (darkVibrantSwatch != null)
                    ? darkVibrantSwatch : darkMutedSwatch;

            final Palette.Swatch titleAndFabColors = (darkVibrantSwatch != null)
                    ? lightVibrantSwatch : lightMutedSwatch;

            mToolBarColor = backgroundAndContentColors.getRgb();
            bodyTextview.setBackgroundColor(backgroundAndContentColors.getRgb());
            titleTextView.setTextColor(titleAndFabColors.getRgb());
        }
    } catch (Exception e) {
        cleanErrorHandler.logExpception(e);
    }
}
 
Example 5
Source File: ColorUtil.java    From APlayer with GNU General Public License v3.0 6 votes vote down vote up
public static Palette.Swatch getSwatch(Palette palette) {
  if (palette != null) {
    if (palette.getVibrantSwatch() != null) {
      return palette.getVibrantSwatch();
    } else if (palette.getMutedSwatch() != null) {
      return palette.getMutedSwatch();
    } else if (palette.getDarkVibrantSwatch() != null) {
      return palette.getDarkVibrantSwatch();
    } else if (palette.getDarkMutedSwatch() != null) {
      return palette.getDarkMutedSwatch();
    } else if (palette.getLightVibrantSwatch() != null) {
      return palette.getLightVibrantSwatch();
    } else if (palette.getLightMutedSwatch() != null) {
      return palette.getLightMutedSwatch();
    } else if (!palette.getSwatches().isEmpty()) {
      return Collections.max(palette.getSwatches(), SwatchComparator.getInstance());
    }
  }
  return new Palette.Swatch(Color.GRAY, 100);
}
 
Example 6
Source File: ColorUtil.java    From APlayer with GNU General Public License v3.0 6 votes vote down vote up
@ColorInt
public static int getColor(@Nullable Palette palette, int fallback) {
  if (palette != null) {
    if (palette.getVibrantSwatch() != null) {
      return palette.getVibrantSwatch().getRgb();
    } else if (palette.getMutedSwatch() != null) {
      return palette.getMutedSwatch().getRgb();
    } else if (palette.getDarkVibrantSwatch() != null) {
      return palette.getDarkVibrantSwatch().getRgb();
    } else if (palette.getDarkMutedSwatch() != null) {
      return palette.getDarkMutedSwatch().getRgb();
    } else if (palette.getLightVibrantSwatch() != null) {
      return palette.getLightVibrantSwatch().getRgb();
    } else if (palette.getLightMutedSwatch() != null) {
      return palette.getLightMutedSwatch().getRgb();
    } else if (!palette.getSwatches().isEmpty()) {
      return Collections.max(palette.getSwatches(), SwatchComparator.getInstance()).getRgb();
    }
  }
  return fallback;
}
 
Example 7
Source File: ColorUtil.java    From music_player with Open Software License 3.0 6 votes vote down vote up
public static int getColor(Bitmap bitmap) {
    Palette palette = Palette.from(bitmap).generate();
    if (palette.getVibrantSwatch() != null) {
        return palette.getVibrantSwatch().getRgb();
    } else if (palette.getMutedSwatch() != null) {
        return palette.getMutedSwatch().getRgb();
    } else if (palette.getDarkVibrantSwatch() != null) {
        return palette.getDarkVibrantSwatch().getRgb();
    } else if (palette.getDarkMutedSwatch() != null) {
        return palette.getDarkMutedSwatch().getRgb();
    } else if (palette.getLightVibrantSwatch() != null) {
        return palette.getLightVibrantSwatch().getRgb();
    } else if (palette.getLightMutedSwatch() != null) {
        return palette.getLightMutedSwatch().getRgb();
    } else {
        return Color.parseColor("#009688");
    }
}
 
Example 8
Source File: RetroMusicColorUtil.java    From RetroMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
@ColorInt
public static int getColor(@Nullable Palette palette, int fallback) {
    if (palette != null) {
        if (palette.getVibrantSwatch() != null) {
            return palette.getVibrantSwatch().getRgb();
        } else if (palette.getMutedSwatch() != null) {
            return palette.getMutedSwatch().getRgb();
        } else if (palette.getDarkVibrantSwatch() != null) {
            return palette.getDarkVibrantSwatch().getRgb();
        } else if (palette.getDarkMutedSwatch() != null) {
            return palette.getDarkMutedSwatch().getRgb();
        } else if (palette.getLightVibrantSwatch() != null) {
            return palette.getLightVibrantSwatch().getRgb();
        } else if (palette.getLightMutedSwatch() != null) {
            return palette.getLightMutedSwatch().getRgb();
        } else if (!palette.getSwatches().isEmpty()) {
            return Collections.max(palette.getSwatches(), SwatchComparator.getInstance()).getRgb();
        }
    }
    return fallback;
}
 
Example 9
Source File: PhonographColorUtil.java    From Orin with GNU General Public License v3.0 6 votes vote down vote up
@ColorInt
public static int getColor(@Nullable Palette palette, int fallback) {
    if (palette != null) {
        if (palette.getVibrantSwatch() != null) {
            return palette.getVibrantSwatch().getRgb();
        } else if (palette.getMutedSwatch() != null) {
            return palette.getMutedSwatch().getRgb();
        } else if (palette.getDarkVibrantSwatch() != null) {
            return palette.getDarkVibrantSwatch().getRgb();
        } else if (palette.getDarkMutedSwatch() != null) {
            return palette.getDarkMutedSwatch().getRgb();
        } else if (palette.getLightVibrantSwatch() != null) {
            return palette.getLightVibrantSwatch().getRgb();
        } else if (palette.getLightMutedSwatch() != null) {
            return palette.getLightMutedSwatch().getRgb();
        } else if (!palette.getSwatches().isEmpty()) {
            return Collections.max(palette.getSwatches(), SwatchComparator.getInstance()).getRgb();
        }
    }
    return fallback;
}
 
Example 10
Source File: ColorUtils.java    From Musicoco with Apache License 2.0 6 votes vote down vote up
/**
 * 获得图片中出现最多的颜色
 * 0 亮的活力颜色
 * 1 亮的柔和颜色
 */
public static void get2ColorFormBitmap(@NonNull Bitmap bitmap, int defaultColor, int[] colors) {

    if (colors.length != 2)
        return;

    Palette palette;
    palette = new Palette.Builder(bitmap).generate();

    Palette.Swatch swatch;
    int color;

    if ((swatch = palette.getLightVibrantSwatch()) != null)
        color = swatch.getRgb();
    else color = defaultColor;
    colors[0] = color;

    if ((swatch = palette.getLightMutedSwatch()) != null)
        color = swatch.getRgb();
    else color = defaultColor;
    colors[1] = color;

}
 
Example 11
Source File: PaletteUtils.java    From MediaNotification with Apache License 2.0 6 votes vote down vote up
private static Palette.Swatch getBestPaletteSwatchFrom(Palette palette) {
    if (palette != null) {
        if (palette.getVibrantSwatch() != null)
            return palette.getVibrantSwatch();
        else if (palette.getMutedSwatch() != null)
            return palette.getMutedSwatch();
        else if (palette.getDarkVibrantSwatch() != null)
            return palette.getDarkVibrantSwatch();
        else if (palette.getDarkMutedSwatch() != null)
            return palette.getDarkMutedSwatch();
        else if (palette.getLightVibrantSwatch() != null)
            return palette.getLightVibrantSwatch();
        else if (palette.getLightMutedSwatch() != null)
            return palette.getLightMutedSwatch();
        else if (!palette.getSwatches().isEmpty())
            return getBestPaletteSwatchFrom(palette.getSwatches());
    }
    return null;
}
 
Example 12
Source File: ColorUtil.java    From music_player with Open Software License 3.0 6 votes vote down vote up
public static int getColor(Drawable drawable) {
    Palette palette = Palette.from(drawableToBitmap(drawable)).generate();
    if (palette.getVibrantSwatch() != null) {
        return palette.getVibrantSwatch().getRgb();
    } else if (palette.getMutedSwatch() != null) {
        return palette.getMutedSwatch().getRgb();
    } else if (palette.getDarkVibrantSwatch() != null) {
        return palette.getDarkVibrantSwatch().getRgb();
    } else if (palette.getDarkMutedSwatch() != null) {
        return palette.getDarkMutedSwatch().getRgb();
    } else if (palette.getLightVibrantSwatch() != null) {
        return palette.getLightVibrantSwatch().getRgb();
    } else if (palette.getLightMutedSwatch() != null) {
        return palette.getLightMutedSwatch().getRgb();
    } else {
        return Color.parseColor("#009688");
    }
}
 
Example 13
Source File: ViewUtils.java    From Protein with Apache License 2.0 5 votes vote down vote up
public static RippleDrawable createRipple(@NonNull Palette palette,
        @FloatRange(from = 0f, to = 1f) float darkAlpha,
        @FloatRange(from = 0f, to = 1f) float lightAlpha,
        @ColorInt int fallbackColor,
        boolean bounded) {
    int rippleColor = fallbackColor;
    if (palette != null) {
        // try the named swatches in preference order
        if (palette.getVibrantSwatch() != null) {
            rippleColor =
                    ColorUtils.modifyAlpha(palette.getVibrantSwatch().getRgb(), darkAlpha);

        } else if (palette.getLightVibrantSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getLightVibrantSwatch().getRgb(),
                    lightAlpha);
        } else if (palette.getDarkVibrantSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getDarkVibrantSwatch().getRgb(),
                    darkAlpha);
        } else if (palette.getMutedSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getMutedSwatch().getRgb(), darkAlpha);
        } else if (palette.getLightMutedSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getLightMutedSwatch().getRgb(),
                    lightAlpha);
        } else if (palette.getDarkMutedSwatch() != null) {
            rippleColor =
                    ColorUtils.modifyAlpha(palette.getDarkMutedSwatch().getRgb(), darkAlpha);
        }
    }
    return new RippleDrawable(ColorStateList.valueOf(rippleColor), null,
            bounded ? new ColorDrawable(Color.WHITE) : null);
}
 
Example 14
Source File: ColorUtils.java    From Musicoco with Apache License 2.0 5 votes vote down vote up
/**
 * 获得图片中出现最多的颜色<br>
 * 0 亮的活力颜色<br>
 * 1 亮的活力颜色 对应适合的字体颜色<br>
 * 2 亮的柔和颜色<br>
 * 3 亮的柔和颜色 对应适合的字体颜色<br>
 */
public static void get4LightColorWithTextFormBitmap(@NonNull Bitmap bitmap, int defaultColor, int defaultTextColor, int[] colors) {

    if (colors.length != 4)
        return;

    Palette palette;
    palette = new Palette.Builder(bitmap).generate();

    Palette.Swatch swatch;
    int color = defaultColor;
    int textColor = defaultTextColor;

    if ((swatch = palette.getLightVibrantSwatch()) != null) {
        color = swatch.getRgb();
        textColor = swatch.getTitleTextColor();
    }
    colors[0] = color;
    colors[1] = textColor;

    color = defaultColor;
    textColor = defaultTextColor;

    if ((swatch = palette.getLightMutedSwatch()) != null) {
        color = swatch.getRgb();
        textColor = swatch.getTitleTextColor();
    }
    colors[2] = color;
    colors[3] = textColor;

}
 
Example 15
Source File: ViewUtils.java    From materialup with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static RippleDrawable createRipple(@NonNull Palette palette,
                                          @FloatRange(from = 0f, to = 1f) float darkAlpha,
                                          @FloatRange(from = 0f, to = 1f) float lightAlpha,
                                          @ColorInt int fallbackColor,
                                          boolean bounded) {
    int rippleColor = fallbackColor;
    // try the named swatches in preference order
    if (palette.getVibrantSwatch() != null) {
        rippleColor = ColorUtils.modifyAlpha(palette.getVibrantSwatch().getRgb(), darkAlpha);
    } else if (palette.getLightVibrantSwatch() != null) {
        rippleColor = ColorUtils.modifyAlpha(palette.getLightVibrantSwatch().getRgb(),
                lightAlpha);
    } else if (palette.getDarkVibrantSwatch() != null) {
        rippleColor = ColorUtils.modifyAlpha(palette.getDarkVibrantSwatch().getRgb(),
                darkAlpha);
    } else if (palette.getMutedSwatch() != null) {
        rippleColor = ColorUtils.modifyAlpha(palette.getMutedSwatch().getRgb(), darkAlpha);
    } else if (palette.getLightMutedSwatch() != null) {
        rippleColor = ColorUtils.modifyAlpha(palette.getLightMutedSwatch().getRgb(),
                lightAlpha);
    } else if (palette.getDarkMutedSwatch() != null) {
        rippleColor = ColorUtils.modifyAlpha(palette.getDarkMutedSwatch().getRgb(), darkAlpha);
    }
    return new RippleDrawable(ColorStateList.valueOf(rippleColor), null,
            bounded ? new ColorDrawable(Color.WHITE) : null);
}
 
Example 16
Source File: ViewUtils.java    From android-proguards with Apache License 2.0 5 votes vote down vote up
public static RippleDrawable createRipple(@NonNull Palette palette,
                                          @FloatRange(from = 0f, to = 1f) float darkAlpha,
                                          @FloatRange(from = 0f, to = 1f) float lightAlpha,
                                          @ColorInt int fallbackColor,
                                          boolean bounded) {
    int rippleColor = fallbackColor;
    if (palette != null) {
        // try the named swatches in preference order
        if (palette.getVibrantSwatch() != null) {
            rippleColor =
                    ColorUtils.modifyAlpha(palette.getVibrantSwatch().getRgb(), darkAlpha);

        } else if (palette.getLightVibrantSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getLightVibrantSwatch().getRgb(),
                    lightAlpha);
        } else if (palette.getDarkVibrantSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getDarkVibrantSwatch().getRgb(),
                    darkAlpha);
        } else if (palette.getMutedSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getMutedSwatch().getRgb(), darkAlpha);
        } else if (palette.getLightMutedSwatch() != null) {
            rippleColor = ColorUtils.modifyAlpha(palette.getLightMutedSwatch().getRgb(),
                    lightAlpha);
        } else if (palette.getDarkMutedSwatch() != null) {
            rippleColor =
                    ColorUtils.modifyAlpha(palette.getDarkMutedSwatch().getRgb(), darkAlpha);
        }
    }
    return new RippleDrawable(ColorStateList.valueOf(rippleColor), null,
            bounded ? new ColorDrawable(Color.WHITE) : null);
}
 
Example 17
Source File: ShotFragment.java    From droidddle with Apache License 2.0 5 votes vote down vote up
private void updateShotPalette(Palette palette) {
    mDensity = getResources().getDisplayMetrics().density;
    int index = 0;
    Palette.Swatch swatch = palette.getDarkMutedSwatch();
    if (swatch != null) {
        setPaletteColor(index, swatch);
        index++;
    }
    swatch = palette.getDarkVibrantSwatch();
    if (swatch != null) {
        setPaletteColor(index, swatch);
        index++;
    }
    swatch = palette.getMutedSwatch();
    if (swatch != null) {
        setPaletteColor(index, swatch);
        index++;
    }
    swatch = palette.getVibrantSwatch();
    if (swatch != null) {
        setPaletteColor(index, swatch);
        index++;
    }
    swatch = palette.getLightMutedSwatch();
    if (swatch != null) {
        setPaletteColor(index, swatch);
        index++;
    }

    swatch = palette.getLightVibrantSwatch();
    if (swatch != null) {
        setPaletteColor(index, swatch);
        index++;
    }

}
 
Example 18
Source File: ColorUtils.java    From Musicoco with Apache License 2.0 4 votes vote down vote up
/**
 * 获得图片中出现最多的颜色
 * 0 活力颜色<br>
 * 1 对应字体颜色<br>
 * 2 亮的活力颜色<br>
 * 3 对应字体颜色<br>
 * 4 暗的活力颜色<br>
 * 5 对应字体颜色<br>
 * 6 柔和颜色<br>
 * 7 对应字体颜色<br>
 * 8 亮的柔和颜色<br>
 * 9 对应字体颜色<br>
 * 10 暗的柔和颜色<br>
 * 11 对应字体颜色<br>
 */
public static void get12ColorFormBitmap(@NonNull Bitmap bitmap, int defaultColor, int defaultTextColor, int[] colors) {

    if (colors.length != 12)
        return;

    Palette palette;
    palette = new Palette.Builder(bitmap).generate();

    Palette.Swatch swatch;
    int color;
    int tColor;

    if ((swatch = palette.getVibrantSwatch()) != null) {
        color = swatch.getRgb();
        tColor = swatch.getTitleTextColor();
    } else {
        color = defaultColor;
        tColor = defaultTextColor;
    }
    colors[0] = color;
    colors[1] = tColor;

    if ((swatch = palette.getLightVibrantSwatch()) != null) {
        color = swatch.getRgb();
        tColor = swatch.getTitleTextColor();

    } else {
        color = defaultColor;
        tColor = defaultTextColor;

    }
    colors[2] = color;
    colors[3] = tColor;

    if ((swatch = palette.getDarkVibrantSwatch()) != null) {
        color = swatch.getRgb();
        tColor = swatch.getTitleTextColor();

    } else {
        color = defaultColor;
        tColor = defaultTextColor;

    }
    colors[4] = color;
    colors[5] = tColor;

    if ((swatch = palette.getMutedSwatch()) != null) {
        color = swatch.getRgb();
        tColor = swatch.getTitleTextColor();

    } else {
        color = defaultColor;
        tColor = defaultTextColor;

    }
    colors[6] = color;
    colors[7] = tColor;

    if ((swatch = palette.getLightMutedSwatch()) != null) {
        color = swatch.getRgb();
        tColor = swatch.getTitleTextColor();

    } else {
        color = defaultColor;
        tColor = defaultTextColor;

    }
    colors[8] = color;
    colors[9] = tColor;

    if ((swatch = palette.getDarkMutedSwatch()) != null) {
        color = swatch.getRgb();
        tColor = swatch.getTitleTextColor();

    } else {
        color = defaultColor;
        tColor = defaultTextColor;

    }
    colors[10] = color;
    colors[11] = tColor;

}
 
Example 19
Source File: ColorUtils.java    From Musicoco with Apache License 2.0 4 votes vote down vote up
/**
 * 获得图片中出现最多的颜色
 * 0 活力颜色<br>
 * 1 亮的活力颜色<br>
 * 2 暗的活力颜色<br>
 * 3 柔和颜色<br>
 * 4 亮的柔和颜色<br>
 * 5 暗的柔和颜色<br>
 */
public static void get6ColorFormBitmap(@NonNull Bitmap bitmap, int defaultColor, int[] colors) {

    if (colors.length != 6)
        return;

    Palette palette;
    palette = new Palette.Builder(bitmap).generate();

    Palette.Swatch swatch;
    int color;

    if ((swatch = palette.getVibrantSwatch()) != null)
        color = swatch.getRgb();
    else color = defaultColor;
    colors[0] = color;

    if ((swatch = palette.getLightVibrantSwatch()) != null)
        color = swatch.getRgb();
    else color = defaultColor;
    colors[1] = color;

    if ((swatch = palette.getDarkVibrantSwatch()) != null)
        color = swatch.getRgb();
    else color = defaultColor;
    colors[2] = color;

    if ((swatch = palette.getMutedSwatch()) != null)
        color = swatch.getRgb();
    else color = defaultColor;
    colors[3] = color;

    if ((swatch = palette.getLightMutedSwatch()) != null)
        color = swatch.getRgb();
    else color = defaultColor;
    colors[4] = color;

    if ((swatch = palette.getDarkMutedSwatch()) != null)
        color = swatch.getRgb();
    else color = defaultColor;
    colors[5] = color;

}
 
Example 20
Source File: MainActivity.java    From TutosAndroidFrance with MIT License 4 votes vote down vote up
public void appliquerPalette(Palette palette) {

        {
            //je récupère le swatch Vibrant

            Palette.Swatch vibrant = palette.getVibrantSwatch();
            if (vibrant != null) { //il se peut que la palette ne génère pas tous les swatch

                //j'utilise getRgb() en tant que couleurs de fond te ma textView
                textVibrant.setBackgroundColor(vibrant.getRgb());

                //getBodyTextColor() est prévu pour être affiché dessus une vue en background getRgb()
                textVibrant.setTextColor(vibrant.getBodyTextColor());
            }
        }
        {
            Palette.Swatch vibrantDark = palette.getDarkVibrantSwatch();
            if (vibrantDark != null) {
                textVibrantDark.setBackgroundColor(vibrantDark.getRgb());
                textVibrantDark.setTextColor(vibrantDark.getBodyTextColor());
            }
        }
        {
            Palette.Swatch vibrantLight = palette.getLightVibrantSwatch();
            if (vibrantLight != null) {
                textVibrantLight.setBackgroundColor(vibrantLight.getRgb());
                textVibrantLight.setTextColor(vibrantLight.getBodyTextColor());
            }
        }

        {
            Palette.Swatch muted = palette.getMutedSwatch();
            if (muted != null) {
                textMuted.setBackgroundColor(muted.getRgb());
                textMuted.setTextColor(muted.getBodyTextColor());
            }
        }
        {
            Palette.Swatch mutedDark = palette.getDarkMutedSwatch();
            if (mutedDark != null) {
                textMutedDark.setBackgroundColor(mutedDark.getRgb());
                textMutedDark.setTextColor(mutedDark.getBodyTextColor());
            }
        }
        {
            Palette.Swatch lightMuted = palette.getLightMutedSwatch();
            if (lightMuted != null) {
                textMutedLight.setBackgroundColor(lightMuted.getRgb());
                textMutedLight.setTextColor(lightMuted.getBodyTextColor());
            }
        }
    }