Widget ignores short hex category colors (#CCC), so Uncategorized gets a fallback color

Open Beginner friendly
#433 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@TimeToBuildBob is already working on this.

Since Dec 4, 2026.

  • #439 by @TimeToBuildBob — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
android, kotlin
Domain
mobile

Research direction

Start with widget/CategoryTimeWidgetUpdater.kt, especially resolveBarColors around lines 295–301, and the Robolectric test resolveBarColors_acceptsShortHexFromWebui described in the issue. Compare the stored short hex values with the behavior of Color.parseColor. Done when #CCC and #0F0 render as gray and green instead of fallback colors, with the test passing.

Written by the indexing model from the issue text.

Description

bug

The home-screen widget ignores 3-digit hex category colors and falls back to its rank colors. This includes aw-webui's own default for Uncategorized (COLOR_UNCAT = '#CCC', src/util/classes.ts) and the legacy saved defaults (Work '#0F0', Media '#F33', Comms '#9FF'). Uncategorized is often a top-3 category on Android, and the widget shows it as teal, purple or blue instead of the dashboard's gray.

resolveBarColors (widget/CategoryTimeWidgetUpdater.kt:295-301) passes the stored string straight to Color.parseColor. That method accepts only #RRGGBB and #AARRGGBB (plus a few names) and throws IllegalArgumentException("Unknown color") for #CCC. The catch then substitutes FALLBACK_ACCENT_COLORS[i]. The existing test parseCategoryColors_handlesShortHexColors only checks that "#0F0" survives the JSON parse; nothing exercises the render path.

Failing test (Robolectric):

@Test fun resolveBarColors_acceptsShortHexFromWebui() {
    val ctx = RuntimeEnvironment.getApplication()
    val colors = CategoryTimeWidgetUpdater.resolveBarColors(
        ctx, listOf("Uncategorized", "Work"),
        mapOf("Uncategorized" to "#CCC", "Work" to "#0F0"))
    assertEquals(Color.parseColor("#CCCCCC"), colors[0]) // today: teal fallback
    assertEquals(Color.parseColor("#00FF00"), colors[1]) // today: purple fallback
}

Fix direction: expand #RGB / #ARGB to the long form before calling parseColor.

Priority: low (cosmetic mismatch with the dashboard). This repo only has a priority: high label, so no priority label is set.

fingerprint: widget/CategoryTimeWidgetUpdater.kt — short hex category colors (#CCC) ignored, fallback color shown

Found by code review on master 3b820d61. Not run on a device.

Dominant language
Kotlin
Stars
291
Forks
73
Avg merge
4d 5h
Merged PRs (30d)
27

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ActivityWatch/aw-android

All issues in ActivityWatch/aw-android

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.