ABHA SDK - Customizing the Theme
The ABHA SDK supports full color-token overriding. You can pass atheme object during initialization to match your application’s branding.
Passing theme to initAbhaApp
Thetheme parameter is an optional key in initAbhaApp. Pass it alongside your other configuration:
| Name | Type | Required | Description |
|---|---|---|---|
theme | object | ⚙️ Optional | Color token overrides to match your organisation’s design system. All keys are optional — only supply the tokens you want to change. |
Default Theme Colors
If no theme is provided, the SDK uses the following default values:Overriding the Theme
To customize the look, add thetheme key to your initAbhaApp configuration:
Troubleshooting
Common Theming Issues
1. Button Not Visible or Hard to See
Problem: A button appears invisible, blends into the background, or is difficult to read. Cause: This typically happens whenprimary.brand and content.enabled are too similar (e.g., both set to white or both dark), making the button label invisible against its background.
Solution:
- Ensure
primary.brand(button background) andcontent.enabled(button text) have sufficient contrast. - A dark
primary.brandshould pair with a lightcontent.enabled(e.g.,#ffffff), and vice versa.
2. Color Discrepancy — Overrides Not Taking Effect
Problem: You passed a theme but some colors still appear as defaults. Cause: Token keys may be misspelled, nested incorrectly, or using the wrong casing. Solution:- Double-check that your token keys exactly match the structure in Default Theme Colors. The SDK performs a shallow merge — missing or misnamed keys fall back to defaults silently.
- Verify nesting: tokens like
surface.basemust be passed assurface: { base: ‘...’ }, not as a flat key.
3. Success / Error States Look Off
Problem: Success alerts, error messages, or validation states are visually inconsistent or unreadable. Cause: Overriding onlysemantic.success without also updating surface.success and content.success (or vice versa) breaks the foreground/background pairing for state banners.
Solution: Always override semantic state colors as a group — the background surface token, the text content token, and the semantic indicator token together.
| State | Tokens to keep in sync |
|---|---|
| Success | semantic.success, surface.success, content.success |
| Error | semantic.error, surface.danger |
| Warning | semantic.warning |
4. ABHA Card Color Not Changing
Problem: The ABHA ID card background color is not updating despite passing a theme. Solution: The card background is controlled bysurface.abhaCard, not surface.base or primary.brand. Pass it explicitly:
5. QR Code Invisible or Unreadable
Problem: The QR code is not scannable or appears blank. Cause:qrCodeColors.fgColor and qrCodeColors.bgColor may have been set to the same or similar colors.
Solution: Maintain high contrast between the QR dot color and background — black on white is the most reliable combination for scanner compatibility.

