GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — id(web): isLightColor misclassifies 3-digit shorthand hex (#fff, #ff0) as dark — white label text on light cursor labels · Issue #846 · developing-today/code

id(web): isLightColor misclassifies 3-digit shorthand hex (#fff, #ff0) as dark — white label text on light cursor labels #846

New issue
Copy link
New issue
Copy link
Closed
#848
Closed
id(web): isLightColor misclassifies 3-digit shorthand hex (#fff, #ff0) as dark — white label text on light cursor labels#846
#848
Copy link
Assignees
dezren39
Labels
app/idPackage/app: id (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)

Description

@dezren39
dezren39
opened on Oct 25, 2026
Issue body actions

Problem

isLightColor in pkgs/id/web/src/cursor-utils.ts:66-73 misclassifies CSS 3-digit shorthand hex colors as dark, no matter how light they are:

export function isLightColor(color: string): boolean {
  const hex = color.replace("#", "");
  const r = parseInt(hex.slice(0, 2), 16);
  const g = parseInt(hex.slice(2, 4), 16);
  const b = parseInt(hex.slice(4, 6), 16);
  const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
  return luminance > 0.5;
}

For a 3-digit input the slices misalign: "fff" → r="ff"=255, g="f"=15, b=""=NaN, so the luminance is NaN and NaN > 0.5 is false.

Verified (verbatim function, node, on main 4f66baa)

  • isLightColor("#fff") → false (white — expected true)
  • isLightColor("#ff0") → false (yellow — expected true)
  • isLightColor("#000") → false (correct only by accident)
  • Any non-hex input (e.g. "red", "#gggggg", "") also silently yields NaN → false, with no distinction from a genuinely dark color.

Why it matters

isLightColor picks the label text color for remote cursors at pkgs/id/web/src/cursors.ts:352 and cursors.ts:431 (isLightColor(cursor.color) ? "#000" : "#fff"). A cursor color arrives from peers/server via cursor updates (cursors.ts:826, color: cursorUpdate.color) and is never validated to be 6-digit hex. A peer whose color is shorthand white/yellow gets white text on a white/yellow label background — the name label is illegible. The existing tests (cursor-utils.test.ts:162-203) cover only 6-digit forms (with and without #), so the gap is invisible to CI.

Acceptance criteria

  • isLightColor("#fff") === true, isLightColor("#ff0") === true, isLightColor("#000") === false — 3-digit shorthand is expanded per CSS rules (each digit doubled) before parsing.
  • Malformed/non-hex input has a defined, tested behavior (e.g. treated as dark) instead of falling out of a NaN comparison by accident.
  • New cases added to cursor-utils.test.ts; the existing cursor-utils suite still passes.
  • Single-repo: the only copy of this helper is in developing-today/code pkgs/id/web (checked the other three repos' clones — no other isLightColor).

Activity

  1. github-actions
    assigned
    dezren39
    on Oct 25, 2026
  2. dezren39
    added a commit that references this issue on Oct 25, 2026

    fix(id-web): isLightColor expands 3-digit shorthand hex (#846) (#848)

    edb1f2e
  3. dezren39
    closed this as completedin #848on Oct 25, 2026
  4. developing-today-fleet commented on Nov 24, 2026

    @developing-today-fleet
    developing-today-fleetBot
    on Nov 24, 2026 – with developing.today fleet
    Contributor
    More actions

    AUDIT-7 Lane 2 slice 3 — closing evidence. Verified against the issue body and merged implementation PR(s):

    • PR #848 — fix(id-web): isLightColor expands 3-digit shorthand hex (#846) (merged 2026-10-25)

    The issue had zero comments in the fresh pre-action read; this comment records the missing close evidence.

  5. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.