Skip to main content

ABHA SDK - Customizing the Theme

The ABHA SDK supports full color-token overriding. You can pass a theme object during initialization to match your application’s branding.

Passing theme to initAbhaApp

The theme parameter is an optional key in initAbhaApp. Pass it alongside your other configuration:

Default Theme Colors

If no theme is provided, the SDK uses the following default values:

Overriding the Theme

To customize the look, add the theme 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 when primary.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) and content.enabled (button text) have sufficient contrast.
  • A dark primary.brand should pair with a light content.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.base must be passed as surface: { 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 only semantic.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.

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 by surface.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.