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

オープン 初心者向け
#433 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@TimeToBuildBob がすでに取り組んでいます。

2026年12月4日 から。

  • #439 @TimeToBuildBob による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
android, kotlin
領域
mobile

調査の方向性

widget/CategoryTimeWidgetUpdater.kt、特に295~301行付近のresolveBarColorsと、issueで説明されているRobolectricテストresolveBarColors_acceptsShortHexFromWebuiから始めてください。保存された短い16進値とColor.parseColorの動作を比較してください。#CCCと#0F0がフォールバック色ではなく、それぞれグレーと緑で表示され、テストが成功すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Kotlin
スター
291
フォーク
73
平均マージ
4日 5時間
マージ済み PR(30日)
27

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ActivityWatch/aw-android のほかの issue

ActivityWatch/aw-android の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。