I use this code to open links with Chrome Custom Tabs. But it's showing @Deprecated for setToolbarColor() and setSecondaryToolbarColor(). I haven't found anything for replacement.
Note: Android studio suggests "Use setDefaultColorSchemeParams instead." but haven't found any examples of that.
        Uri uri = Uri.parse(url);
        CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();
        intentBuilder.setToolbarColor(ContextCompat.getColor(activity,R.color.background));
        intentBuilder.setSecondaryToolbarColor(ContextCompat.getColor(activity,R.color.background));
        intentBuilder.setStartAnimations(activity,R.anim.slide_in_right,R.anim.slide_out_left);
        intentBuilder.setExitAnimations(activity,android.R.anim.slide_in_left,android.R.anim.slide_out_right);
        CustomTabsIntent customTabsIntent = intentBuilder.build();
        customTabsIntent.launchUrl(activity,uri);
 
                        
Use
CustomTabColorSchemeParamsinstead: Reference