Skip to content

feat(ui): add color hex alpha transparency utility (#584) - #590

Merged
TheVicky1 merged 1 commit into
TheVicky1:mainfrom
GauravPatil2515:feat/issue-584-hex-opacity
Oct 13, 2026
Merged

TheVicky1 merged 1 commit into
TheVicky1:mainfrom
GauravPatil2515:feat/issue-584-hex-opacity

Conversation

@GauravPatil2515

Copy link
Copy Markdown
Contributor

Closes #584

Summary of Changes

  • Implemented applyHexOpacity(hexColor: string, opacity: number): string in src/lib/ui/hex-opacity.ts.
  • Handles both 3-digit (#rgb -> #rrggbb) and 6-digit hex representations.
  • Supports values with or without the leading # symbol.
  • Clamps opacity values safely between 0.0 and 1.0.
  • Safely returns default fallback #00000000 for invalid inputs or empty strings.
  • Added thorough test suite in tests/hex-opacity.test.ts verifying all acceptance criteria.

Verification

  • Ran node scratch/run-tests.mjs hex-opacity.test.ts -> PASS (5/5 tests passing).
  • Ran full test suite npm test -> All 85 suites passing.
  • Ran npm run typecheck -> Clean, 0 type errors.

- Implement applyHexOpacity helper converting 3-digit and 6-digit hex colors into 8-digit RGBA hex strings
- Enforce strict boundary clamping for opacity decimals between 0.0 and 1.0
- Add comprehensive unit test suite in tests/hex-opacity.test.ts covering 3/6-digit strings, clamped bounds, and invalid fallbacks

Signed-off-by: GauravPatil2515 <gauravpatil2516@gmail.com>
@github-actions

Copy link
Copy Markdown

👋 Welcome to PACT OS, @GauravPatil2515! 🚀

Thank you for taking the time to open your first pull request on PACT! We are thrilled to have you here in our open-source community.


🔍 What Happens Next?

  1. Automated Verification: Our Continuous Integration (CI) workflow is currently verifying:
    • 🔒 Zero-Secret Security Scan
    • 🔗 Markdown Link Integrity
    • 🧹 ESLint Code Quality
    • 🏷️ TypeScript Strict Typecheck
    • 🧪 56-Suite Automated Domain & Security Test Matrix
    • 🏗️ Next.js Production Build
  2. Maintainer Review: A maintainer (@TheVicky1) will review your pull request shortly.
  3. Friendly Iteration: If any adjustments or feedback are needed, we will provide clear, actionable suggestions to help get your PR merged smoothly.

📚 Helpful Quick Links

Thank you for helping make PACT better! Plan. Track. Improve. Repeat. 🏛️✨

@vercel

vercel Bot commented Oct 12, 2026

Copy link
Copy Markdown

@GauravPatil2515 is attempting to deploy a commit to the Vicky's projects Team on Vercel.

A member of the Team first needs to authorize it.

@TheVicky1
TheVicky1 merged commit 3f3da70 into TheVicky1:main Oct 13, 2026
3 of 4 checks passed
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.

[UI] Add Color Hex Alpha Transparency Appender in src/lib/ui/hex-opacity.ts

2 participants