@NonNull
    public static CustomTabColorSchemeParams getColorSchemeParams(@NonNull Intent intent,
            @ColorScheme int colorScheme) {
        if (colorScheme < 0 || colorScheme > COLOR_SCHEME_MAX
                || colorScheme == COLOR_SCHEME_SYSTEM) {
            throw new IllegalArgumentException("Invalid colorScheme: " + colorScheme);
        }

        Bundle extras = intent.getExtras();
        if (extras == null) {
            return CustomTabColorSchemeParams.fromBundle(null);
        }

        CustomTabColorSchemeParams defaults = CustomTabColorSchemeParams.fromBundle(extras);
        SparseArray<Bundle> paramBundles = extras.getSparseParcelableArray(
                EXTRA_COLOR_SCHEME_PARAMS);
        if (paramBundles != null) {
            Bundle bundleForScheme = paramBundles.get(colorScheme);
            if (bundleForScheme != null) {
                return CustomTabColorSchemeParams.fromBundle(bundleForScheme)
                        .withDefaults(defaults);
            }
        }
        return defaults;
    }
Retrieves the instance of {@link CustomTabColorSchemeParams} from an Intent for a given
color scheme. Uses values passed directly into {@link CustomTabsIntent.Builder} (e.g. via
{@link Builder#setToolbarColor}) as defaults.

@param intent Intent to retrieve the color scheme parameters from.
@param colorScheme A constant representing a color scheme. Should not be
                   {@link #COLOR_SCHEME_SYSTEM}.
@return An instance of {@link CustomTabColorSchemeParams} with retrieved parameters.
customtabs/src/android/support/customtabs/CustomTabsIntent.java