Skip to content

Commit fad9bc6

Browse files
fix(android): only update foreground color of status bar if style is "DEFAULT"
1 parent b6051db commit fad9bc6

File tree

1 file changed

+8
-4
lines changed
  • status-bar/android/src/main/java/com/capacitorjs/plugins/statusbar

1 file changed

+8
-4
lines changed

status-bar/android/src/main/java/com/capacitorjs/plugins/statusbar/StatusBar.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,14 @@ public void setBackgroundColor(int color) {
7070
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
7171
setStatusBarColorDeprecated(color);
7272
currentStatusBarColor = color;
73-
// determine if the color is light or dark using luminance and set icon color
74-
boolean isLightColor = ColorUtils.calculateLuminance(color) > 0.5;
75-
WindowInsetsControllerCompat insetsController = WindowCompat.getInsetsController(window, window.getDecorView());
76-
insetsController.setAppearanceLightStatusBars(isLightColor);
73+
74+
// only set foreground color if style is default
75+
if (currentStyle.equals("DEFAULT")) {
76+
// determine if the color is light or dark using luminance and set icon color
77+
boolean isLightColor = ColorUtils.calculateLuminance(color) > 0.5;
78+
WindowInsetsControllerCompat insetsController = WindowCompat.getInsetsController(window, window.getDecorView());
79+
insetsController.setAppearanceLightStatusBars(isLightColor);
80+
}
7781
}
7882
}
7983

0 commit comments

Comments
 (0)