-
Notifications
You must be signed in to change notification settings - Fork 111
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
fix: android platform colors #105
base: master
Are you sure you want to change the base?
Conversation
👋 @ecklf thanks for the PR! |
Thanks for your feedback.
Let me know what you think and I'll make changes accordingly. |
Yeah, these names are not descriptive at all 😞 — but they're the ones Google used, right? |
They were used by Google, but you would theme native dialogs the following: <style name="ThemeOverlay.App.MaterialAlertDialog" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
<item name="colorPrimary">@color/shrine_pink_100</item>
<item name="colorSecondary">@color/shrine_pink_100</item>
<item name="colorSurface">@color/shrine_pink_light</item>
<item name="colorOnSurface">@color/shrine_pink_900</item>
<item name="alertDialogStyle">@style/MaterialAlertDialog.App</item>
<item name="materialAlertDialogTitleTextStyle">@style/MaterialAlertDialog.App.Title.Text</item>
<item name="buttonBarPositiveButtonStyle">@style/Widget.App.Button</item>
<item name="buttonBarNeutralButtonStyle">@style/Widget.App.Button</item>
</style> Since this library is using react-native components, it would make sense for me to specify what the colors are for.
I haven't tested it, but I am sure you could do something like this to keep the old values. <color name="dialog_primary_text_light">@android:color/primary_text_light</color> Either way, it would indeed be a breaking change since it requires adding a If going the <?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="dialog_surface_light">#FFFFFF</color>
<color name="dialog_surface_dark">#212121</color>
<color name="dialog_primary_text_light">#212121</color>
<color name="dialog_primary_text_dark">#FAFAFA</color>
<color name="dialog_secondary_text_light">#727272</color>
<color name="dialog_secondary_text_dark">#C7C7C7</color>
<color name="dialog_hint_text_light">#BF727272</color>
<color name="dialog_hint_text_dark">#BFC7C7C7</color>
</resources> This is based on https://material.io/develop/web/theming/theming-guide:
|
Thanks, makes sense 👍 Just to clarify:
What I mean here is more like: PlatformColor(`@android:color/NEW_COLOR_NAME`) || PlatformColor(`@android:color/hint_foreground_dark) Wouldn't this allow supporting both the current name + the new one, avoiding breaking changes? |
Hei! The problem persists. Will this be merged? Dark mode doesn't work ok on Android. |
@Calinteodor what do you mean dark mode doesn't work on Android? In what sense? Can you share a screenshot? |
+1 to this. Came here looking for a solution because our dialogs on Android are missing the title and the description is too faint. My current fix is to add |
Overview
I am using Android 11 and the colors didn't work for me. Did some research on
PlatformColors
and found that the current values got deprecated in Android API 28 (Pie).With this move, Google seems to be encouraging the use of
colors.xml
.Because of this, I added customization options with sensible defaults attached to the readme.