Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support toolbarColor #31

Open
aeharding opened this issue Nov 16, 2024 · 2 comments
Open

Support toolbarColor #31

aeharding opened this issue Nov 16, 2024 · 2 comments

Comments

@aeharding
Copy link

@capacitor/browser has toolbarColor. This is nice so you can set the color so it matches your app's theme. I would really like it to also be supported in @capacitor/inappbrowser

Thanks for the great plugin!

@dontwan
Copy link

dontwan commented Nov 29, 2024

I would also like this feature, so I took a look at the code of OSInAppBrowserLib-Android, which this package relies on. While the library itself doesn’t directly support custom modifications, the CustomTabsIntent.Builder does provide options for modifying colors, but these are marked as deprecated:

For example:

@aeharding
Copy link
Author

They aren't really deprecated, they've just been moved from CustomTabsIntent.Builder to CustomTabColorSchemeParams.

CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabColorSchemeParams.Builder params = new CustomTabColorSchemeParams.Builder();

if (toolbarColor != null && !toolbarColor.isEmpty()) {
    params.setToolbarColor(Color.parseColor(toolbarColor));
}

CustomTabColorSchemeParams builtParams = params.build();

builder.setDefaultColorSchemeParams(builtParams);
builder.setColorSchemeParams(CustomTabsIntent.COLOR_SCHEME_DARK, builtParams);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants