Skip to content

Conversation

@TapanYadav000
Copy link

@TapanYadav000 TapanYadav000 commented Jan 14, 2026

Jira: https://mifosforge.jira.com/browse/MIFOSAC-625

Summary

This PR replaces hardcoded colors in the Loan Repayment Schedule UI with values from MaterialTheme.colorScheme to ensure proper theming and dark-mode support.

Changes

  • Replaced hardcoded text colors with theme-aware colors
  • Updated header and bottom bar backgrounds to use semantic surface colors
  • No layout, spacing, or logic changes

Motivation

Using theme-aware colors improves accessibility and ensures consistent appearance across light and dark modes, aligning with Material Design best practices.

Testing

  • Built and ran the app locally
  • Verified Loan Repayment Schedule screen in light and dark mode

Screenshots

N/A (color/theming change only)

Summary by CodeRabbit

  • Style
    • Refactored color styling across the loan repayment schedule to align with the app's Material Design theme system. All background colors and text colors in schedule items and headers now dynamically use the theme color scheme instead of hardcoded values, providing improved visual consistency and enabling better theme adaptation.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

Updated UI color styling in LoanRepaymentScheduleScreen.kt to use Material Design 3 theme colors instead of hardcoded colors. Background changed from Color.LightGray to MaterialTheme.colorScheme.surfaceVariant; text colors now use theme-appropriate variants like onBackground and onSurfaceVariant instead of Color.Black.

Changes

Cohort / File(s) Summary
Loan Repayment Schedule Theming
feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanRepaymentSchedule/LoanRepaymentScheduleScreen.kt
Migrated from hardcoded colors (Color.LightGray, Color.Black, Color.Red) to Material Design 3 theme colors (MaterialTheme.colorScheme.surfaceVariant, onBackground, onSurfaceVariant); updated backgrounds, text colors in row items, and header styling

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Colors shift from hardcoded hues,
To themes that dance in Material's blues,
LoanRepayment now wears its best dress,
With surfaceVariant's soft caress! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly summarizes the main change: replacing hardcoded colors with MaterialTheme colors in the Loan Repayment Schedule UI.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanRepaymentSchedule/LoanRepaymentScheduleScreen.kt (1)

155-163: Hardcoded Color.LightGray should be replaced with a theme color.

The PR objective is to replace hardcoded colors with MaterialTheme colors, but Color.LightGray remains at line 162 for the bottom bar background. This will look inconsistent in dark mode and contradicts the goal of proper theming.

Consider using MaterialTheme.colorScheme.surfaceVariant or MaterialTheme.colorScheme.surfaceContainer to match the header treatment.

Suggested fix
             BottomBarLoanRepaymentSchedule(
                 totalPaid = RepaymentSchedule.getNumberOfRepaymentsComplete(periods).toString(),
                 totalOverdue = RepaymentSchedule.getNumberOfRepaymentsOverDue(periods).toString(),
                 tvTotalUpcoming = RepaymentSchedule.getNumberOfRepaymentsPending(periods)
                     .toString(),
                 modifier = Modifier
                     .align(Alignment.BottomStart)
-                    .background(color = Color.LightGray),
+                    .background(color = MaterialTheme.colorScheme.surfaceVariant),
             )
feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanAccountSummary/LoanAccountSummaryScreen.kt (1)

391-396: Incorrect semantic color for Button text.

The Button text uses MaterialTheme.colorScheme.background, but Material3's Button composable uses colorScheme.primary as its container color by default. For proper contrast, button text should use colorScheme.onPrimary, not background.

Using background here could cause poor contrast or invisible text in certain theme configurations where background and primary are similar colors.

Suggested fix
         Button(
             ...
         ) {
             Text(
-                color = MaterialTheme.colorScheme.background,
+                color = MaterialTheme.colorScheme.onPrimary,
                 text = getButtonText(loanWithAssociations.status),
             )
         }

Alternatively, omit the color parameter entirely and let the Button composable provide the correct default via LocalContentColor.

🧹 Nitpick comments (3)
feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanRepaymentSchedule/LoanRepaymentScheduleScreen.kt (1)

287-309: Text color should match the actual background semantics.

The text uses onBackground, but the actual background applied via modifier (line 162) is Color.LightGray. If the background is updated to surfaceVariant as suggested, consider updating these text colors to onSurfaceVariant for semantic consistency with the header.

Suggested fix (if background is changed to surfaceVariant)
             Text(
                 modifier = Modifier.weight(3.4f),
                 text = stringResource(Res.string.feature_loan_complete) + " : " + totalPaid,
                 style = MaterialTheme.typography.bodyLarge,
-                color = MaterialTheme.colorScheme.onBackground,
+                color = MaterialTheme.colorScheme.onSurfaceVariant,
                 textAlign = TextAlign.Start,
             )

             Text(
                 modifier = Modifier.weight(3.3f),
                 text = stringResource(Res.string.feature_loan_pending) + " : " + tvTotalUpcoming,
                 style = MaterialTheme.typography.bodyLarge,
-                color = MaterialTheme.colorScheme.onBackground,
+                color = MaterialTheme.colorScheme.onSurfaceVariant,
                 textAlign = TextAlign.Center,
             )

             Text(
                 modifier = Modifier.weight(3.3f),
                 text = stringResource(Res.string.feature_loan_overdue) + " : " + totalOverdue,
                 style = MaterialTheme.typography.bodyLarge,
-                color = MaterialTheme.colorScheme.onBackground,
+                color = MaterialTheme.colorScheme.onSurfaceVariant,
                 textAlign = TextAlign.End,
             )
feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanAccountSummary/LoanAccountSummaryScreen.kt (2)

453-473: Hardcoded text colors will break dark mode support.

LoanSummaryFarApartTextItem uses hardcoded Color.Black (line 464) and Color.DarkGray (line 470) for text. These will be invisible or poorly visible on dark theme backgrounds.

Consider using semantic theme colors:

  • MaterialTheme.colorScheme.onSurface or onBackground for primary text
  • MaterialTheme.colorScheme.onSurfaceVariant for secondary/muted text
Suggested fix
 `@Composable`
 private fun LoanSummaryFarApartTextItem(title: String, value: String) {
     Row(
         modifier = Modifier
             .fillMaxWidth()
             .padding(top = 6.dp),
         horizontalArrangement = Arrangement.SpaceBetween,
     ) {
         Text(
             style = MaterialTheme.typography.bodyLarge,
             text = title,
-            color = Color.Black,
+            color = MaterialTheme.colorScheme.onSurface,
         )

         Text(
             style = MaterialTheme.typography.bodyLarge,
             text = value,
-            color = Color.DarkGray,
+            color = MaterialTheme.colorScheme.onSurfaceVariant,
         )
     }
 }

475-487: Hardcoded row background colors will break theming.

DataTableRow defaults to Color.White (line 482) and uses Color.Blue.copy(alpha = .3f) for alternating rows (lines 411, 426, 441). These hardcoded colors won't adapt to dark mode and will create jarring contrast against themed surfaces.

Consider using:

  • MaterialTheme.colorScheme.surface or surfaceVariant for row backgrounds
  • A theme-aware accent color for alternating rows
Suggested fix
 `@Composable`
 private fun DataTableRow(
     summaryColumnTitle: String,
     loanColumnValue: String,
     amountColumnValue: String,
     balanceColumnValue: String,
     isHeader: Boolean = false,
-    color: Color = Color.White,
+    color: Color = MaterialTheme.colorScheme.surface,
 ) {

And update the callers to use theme-aware colors:

-            color = Color.Blue.copy(alpha = .3f),
+            color = MaterialTheme.colorScheme.primaryContainer,
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 05b877f and 88917e7.

📒 Files selected for processing (2)
  • feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanAccountSummary/LoanAccountSummaryScreen.kt
  • feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanRepaymentSchedule/LoanRepaymentScheduleScreen.kt
🔇 Additional comments (4)
feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanRepaymentSchedule/LoanRepaymentScheduleScreen.kt (2)

196-218: LGTM!

Using MaterialTheme.colorScheme.onBackground for the text colors is semantically correct since these rows render on the default background surface. This ensures proper contrast in both light and dark modes.


225-271: LGTM!

The header correctly pairs surfaceVariant background with onSurfaceVariant text colors, following Material 3 color semantics. This ensures proper contrast across themes.

feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanAccountSummary/LoanAccountSummaryScreen.kt (2)

269-275: LGTM!

The padding adjustments align with Material Design spacing guidelines. The 16.dp horizontal padding is a standard content margin, and the 12.dp vertical padding for the client name provides appropriate breathing room.


286-323: Spacing changes look good, but hardcoded status colors remain.

The padding adjustments are appropriate. However, lines 293-308 still use hardcoded Color.Green, Color.Yellow, Color.Blue, and Color.Black for the status indicator. Given this PR's objective to enable proper theming and dark-mode support, these should be considered for replacement with semantic theme colors (e.g., from MaterialTheme.colorScheme or custom theme extensions).

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@TapanYadav000 TapanYadav000 force-pushed the feature/use-theme-colors-repayment-schedule branch from 88917e7 to 3daede1 Compare January 14, 2026 21:11
@TapanYadav000
Copy link
Author

Thanks for the review! I’ve replaced the remaining hardcoded color with a theme-aware surface color, rebased onto the latest development, and force-pushed the updated commits. CI has been re-triggered—happy to address any further feedback.

@amanna13
Copy link
Contributor

amanna13 commented Jan 15, 2026

Hey @TapanYadav000, thank you for the contribution! Can you mention the Jira ticket this PR is for. If there's none then find if the similar ticket exists or else go ahead and click here to create new.

Copy link
Contributor

@amanna13 amanna13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont use hardcoded padding values use paddings from DesignToken.

@TapanYadav000
Copy link
Author

Hey @TapanYadav000, thank you for the contribution! Can you mention the Jira ticket this PR is for. If there's none then find if the similar ticket exists or else go ahead and click here to create new.

Thanks for the review!

I searched the MIFOSAC Jira for an existing open ticket related to this change but couldn’t find a suitable one.
I’m currently unable to create a new Jira ticket due to permission limitations (the Create action is disabled for me).

Could you please create a Jira ticket for this PR or let me know if there’s an existing one I should link to?
Happy to update the PR accordingly.

@TapanYadav000
Copy link
Author

Dont use hardcoded padding values use paddings from DesignToken.

Thanks for pointing this out.

This PR intentionally avoids any layout or spacing changes and only replaces hardcoded colors with theme-aware values.
The existing padding values were already present and were not modified as part of this change.

I agree that DesignToken-based spacing is the preferred approach and it can be handled in a separate, dedicated PR to keep concerns isolated.

@amanna13
Copy link
Contributor

I searched the MIFOSAC Jira for an existing open ticket related to this change but couldn’t find a suitable one.
I’m currently unable to create a new Jira ticket due to permission limitations (the Create action is disabled for me).

Please go through this document Welcome to the Mifos Mobile Apps Community to get started.

You need to login Jira first. And can create a ticket and assign it yourself, in Mifos the permissions are not restricted. Please don't forget to join the slack community as well and give the update on the same on the appropriate channel.

Also follow the PR template before raising a PR and have a look into the contributing guides. (like PR title semantics)

@TapanYadav000
Copy link
Author

Hey @TapanYadav000, thank you for the contribution! Can you mention the Jira ticket this PR is for. If there's none then find if the similar ticket exists or else go ahead and click here to create new.

Thanks for the guidance!

I’ve now logged into Jira and created the ticket for this PR:
MIFOSAC-625

Link: https://mifosforge.jira.com/browse/MIFOSAC-625

@TapanYadav000 TapanYadav000 force-pushed the feature/use-theme-colors-repayment-schedule branch from 3daede1 to 4e0bf2f Compare January 16, 2026 22:06
@TapanYadav000
Copy link
Author

Rebasing is complete and unrelated spacing commits have been dropped.
This PR now only contains theme-aware color changes scoped to MIFOSAC-625.
CI is awaiting workflow approval — thanks!

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

Successfully merging this pull request may close these issues.

2 participants