CChromaWicket
Workflows

Coding workflows · Six-digit hexadecimal colors

03
Built around your work

A concrete starting point

Decode a color written as a hash followed by exactly six ASCII hexadecimal digits into three channel integers. Check mixed case and both channel extremes, rejecting shorthand, surrounding whitespace and Unicode lookalike digits.

01

Open the context

Choose the project folder and name the files or behavior involved.

02

Define the change

Describe the input, expected output and boundaries that must stay intact.

03

Inspect the work

Review the proposed edits and any commands before relying on their result.

04

Check the outcome

Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

Six-digit hexadecimal colors

A concrete starting point
def rgb_hex(text):
    digits = "0123456789abcdefABCDEF"
    if not isinstance(text, str) or len(text) != 7 or text[0] != "#":
        raise ValueError("color.format")
    if any(char not in digits for char in text[1:]):
        raise ValueError("color.digit")
    return tuple(int(text[i:i + 2], 16) for i in (1, 3, 5))

The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.

AI coding workspace

Your next change starts here.

Get the Windows app ↗