uttrflow / uttrflow/uttrflow-swift
Issue references and hashtags like #513, #2024 and #face are classified as colours
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 286
Description
## What happens
`ColourShape.hex` (`Sources/UttrflowClipboard/ClipKindDetector.swift:59-61`) accepts `#` followed by exactly 3, 4, 6 or 8 hexadecimal digits, and nothing else is checked. `ColourValue.parse` then draws a swatch for it (`ClipColour.swift:31-60`).
## Measured (headless, `ClipKindDetector.kind(of:)`)
| Clip | Kind | What it usually is |
|---|---|---|
| `#513`, `#100`, `#999` | colour | an issue or pull request reference |
| `#1234`, `#2024` | colour | an issue reference, a year tag |
| `#123456` | colour | an issue reference in a large repository |
| `#bad`, `#add`, `#bed`, `#ace`, `#dad`, `#fab` | colour | words |
| `#beef`, `#face`, `#cafe` | colour | hashtags |
| `#decade`, `#facade`, `#c0ffee` | colour | hashtags, jokes |
| `#000`, `#fff`, `#333` | colour | colours (correct) |
| `#42` | text | (2 digits, correct) |
Copying `#513` out of a commit message, chat or tracker is routine for developers. The row then says "Colour", shows a swatch and uses a monospaced font.
## Why it matters
Misfiling is mild here: colours sit under the Text tab. But the kind noun and swatch are wrong on exactly the clips a developer copies most, and VoiceOver reads "Colour, #513".
## Decision needed
Short hex colours made only of digits (`#000`, `#333`, `#999`) are common and real, so a blanket rule cannot fix this. Options:
1. **Four digits, all decimal**, is text (`#RGBA` spelt only in digits is rare in stylesheets; `#1234` and `#2024` are not).
2. **Letters that spell a common word** (`#bad`, `#face`, `#decade`) are text unless the clip came from an app known for colour. Rejected already for secrets, where the frontmost app is not the writer (`Docs/clipboard-secrets.md`).
3. Keep today's rule, and show the swatch only (no kind change) for 3- and 4-digit forms.
## Acceptance criteria
- The decision is recorded in the `ColourShape` doc comment.
- Tests in `Tests/UttrflowClipboardTests/ClipKindDetectorTests.swift` and `ClipColourTests.swift` pin every row of the table above to the decided kind.
Contributor guide
Research direction
Start with the ColourShape.hex logic in Sources/UttrflowClipboard/ClipKindDetector.swift:59-61 and the swatch handling in ClipColour.swift:31-60, then run the existing detector and colour tests. Confirm the intended classification decision before changing behavior; done means the decision is documented and every table row is pinned in Tests/UttrflowClipboardTests/ClipKindDetectorTests.swift and ClipColourTests.swift.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- desktop, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100