Skip to content

Color Converter: the contrast checker's colour pickers drop the alpha #428

Closed

Description

@prakashNalla

Which tool?

Color Converter

What happened?

The colour pickers next to "Text / Foreground" and "Surface / Background" in the contrast checker drop the alpha. Type #00000080 in the foreground field, click its swatch and pick any colour, and the field becomes #rrggbb, so the colour is fully opaque again and the contrast ratio and WCAG result change with it. The background picker does the same.

The main picker at the top keeps the alpha: handleNativeColorChange() in ColorConverterClient.tsx puts the current alpha back on the picked colour. The two contrast pickers call setFgInput(e.target.value) and setBgInput(e.target.value) directly (lines 510 and 555), so they skip that.

With #00000080, #00000080 and #ffffff80 in the three fields and #ff0000 picked on each swatch, I get #ff000080 for the main one and #ff0000 for foreground and background.

What did you expect?

The contrast pickers keep the alpha the same way the main picker does, so all three give #ff000080.

I'd make the alpha step in handleNativeColorChange() a small helper that takes the current parsed colour, use it for all three pickers, and add a case to ColorConverterClient.test.tsx that changes the foreground and background pickers and checks the alpha stays.

Browser and OS

Chrome on macOS

Checks

  • I searched existing issues and this is not a duplicate.
  • This does not include a real secret or token in the reproduction.

Activity

  1. prakashNalla commented on Oct 30, 2026

    @prakashNalla
    CollaboratorAuthor

    @anurag629 if this is worth fixing, could you assign it to me and add the hacktoberfest label? It's sharing the alpha step from the main picker with the two contrast pickers, plus a test. I'm waiting on two other issues, so I'll start it as soon as one of those frees up.

  2. added
    bugSomething isn't working
    hacktoberfestGood pick for Hacktoberfest contributors
    on Oct 30, 2026
  3. anurag629 commented on Oct 30, 2026

    @anurag629
    Member

    Hey @prakashNalla, confirmed, the two contrast pickers set the raw picked hex while the main one keeps the alpha. Sharing that alpha step sounds right. You're at two with #422 and codercops/chatcops#479, so this one's yours once one of those is merged, just say so here.

  4. prakashNalla commented on Oct 30, 2026

    @prakashNalla
    CollaboratorAuthor

    @anurag629 #429 and codercops/chatcops#480 are both merged, so I'm free for this one. The fix is ready.

  5. anurag629 commented on Oct 30, 2026

    @anurag629
    Member

    Hey @prakashNalla, it's yours!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghacktoberfestGood pick for Hacktoberfest contributors

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions