Skip to content

Release v1.1.0: correctness fixes, CIE L*a*b* & WCAG features, tests, and PyPI Trusted Publishing - #1

Merged
johanbeytell1 merged 2 commits into
mainfrom
arena/17486453-hued
Nov 18, 2026
Merged

johanbeytell1 merged 2 commits into
mainfrom
arena/17486453-hued

Conversation

@johanbeytell1

Copy link
Copy Markdown
Member

Summary

Prepares Hued 1.1.0 with a comprehensive bug-fix and color-science correctness pass, new zero-dependency capabilities, full inline type annotations (py.typed), a 151-test pytest suite + multi-version CI, provenance badges, and an updated PyPI OIDC Trusted Publishing workflow (configured for a blank environment) with PEP 740 and SLSA v1.0 provenance attestations.

Key Fixes

  • sRGB ↔ CIE 1931 XYZ (conversions.py): Fixed TypeError crashes on saturated colors such as (255, 0, 0) and (0, 255, 0) where tiny negative linear components produced complex numbers before clamping. Updated forward/inverse math to exact IEC 61966-2-1 D65 for lossless sRGB round-trips.
  • Linear sRGB & WCAG luminance (analysis.py): Fixed dead-code c > 0.04045 check on unnormalized [0, 255] channels and replaced gamma 2.2 with the WCAG 2.1 / IEC 61966-2-1 sRGB transfer function.
  • Readable foreground text (analysis.py): Fixed get_text_color_from_background returning "dark" on pure black/charcoal and "light" on yellow, cyan, lime, and silver; now always chooses whichever maximizes WCAG 2.1 contrast.
  • Color quality & vision simulation (analysis.py): Fixed check_color_quality tautology (previously returned True for all 16.7M RGB colors), added explicit AA/AAA pass flags and optional background/min_contrast, and fixed simulate_color_blindness truncation and linear achromatopsia weights so neutral grays stay exact.
  • Classification, conversions & rounding (analysis.py, conversions.py): Fixed get_temperature (yellow, cyan, teal, near-grays), is_pastel (pure white/gray vs soft pastels), is_muted (pure black & variable shadowing), strict hex_to_rgb/rgb_to_hex validation + #RGB shorthand, lossless analytical hsl_to_hsv/hsv_to_hsl, consistent range/type validation, [0, 360) hue wrapping, and round() instead of int() in blend_colors.
  • Palettes (palettes.py): Fixed generate_monochromatic(shades=1) ZeroDivisionError, separated rectangular generate_tetradic(angle=60) from generate_square(), supported dictionary palettes in palette_to_hex(), fixed export_palette() extension detection via os.path.splitext, and removed unsolicited stdout print()s.
  • Named color catalog (colors.py): Removed scraped vandalism/citation markers, resolved 7 duplicate color names, normalized hex casing, preserved acronyms/apostrophes in get_color_by_name(), added all 21 missing W3C CSS Color Level 4 named colors + CSS-token matching (all 148 CSS names now resolve), and cached RGB/Lab* lookups at module level.
  • Packaging (pyproject.toml): Replaced broken {{VERSION_PLACEHOLDER}} setup.py with modern PEP 621/639 pyproject.toml (Python >=3.9).

New Features

  • CIE 1976 L*a*b* (D65): rgb_to_lab, lab_to_rgb, xyz_to_lab, lab_to_xyz, plus hex/hsl/hsv/cmyk ↔ lab helpers.
  • Perceptual difference & WCAG: delta_e(..., method="cie2000" | "cie76") (tested against Sharma, Wu & Dalal 2005 vectors) and check_wcag_contrast.
  • Color helpers: linear_to_rgb, invert_color, to_grayscale, adjust_lightness, adjust_saturation, and blend_colors(..., linear=True).
  • ColorManager & ColorPalette: Perceptual closest_color_name(..., space="lab" | "cie2000"), get_color_by_hex, search_colors, get_random_color, add_color, remove_color, multi-space generate_gradient(..., space="rgb" | "linear" | "lab" | "hsl"), and .css export.
  • Typing, CI & Provenance: PEP 561 hued/py.typed, hued.__version__, CHANGELOG.md, .github/workflows/ci.yml, SHA-pinned .github/workflows/build_and_publish.yml (OIDC Trusted Publishing with no environment, PEP 740 attestations, SLSA build provenance, and idempotent GitHub Release), and provenance badges in readme.md.

Release Checklist

  1. Configure PyPI Trusted Publishing (Owner: Infinitode, Repository: Hued, Workflow: build_and_publish.yml, Environment: blank).
  2. Merge this PR into main.
  3. Push tag 1.1.0 (or v1.1.0) on the merged main commit.

johanbeytell1 and others added 2 commits November 18, 2026 12:14
…rusted Publishing

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@johanbeytell1
johanbeytell1 merged commit f487a59 into main Nov 18, 2026
4 checks passed
@johanbeytell1
johanbeytell1 deleted the arena/17486453-hued branch November 18, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant