Skip to content

Conversation

@mfts
Copy link
Owner

@mfts mfts commented Oct 15, 2025

Apply dataroom accent color to the OTP passcode screen for visual consistency with branding.


Slack Thread

Open in Cursor Open in Web

Summary by CodeRabbit

  • New Features

    • Brand-driven theming for the email verification flow: background, text, and buttons adapt to the brand’s accent color with automatic contrast for readability.
    • Input OTP now supports an optional accent color, applying dynamic colors to slots, borders, and caret.
  • Style

    • Replaced hard-coded colors with dynamic, accent-based styling across verification components.
    • Propagated brand accent color through related views to ensure consistent visual theming.

@cursor
Copy link

cursor bot commented Oct 15, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link

vercel bot commented Oct 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
papermark Ready Ready Preview Comment Oct 15, 2025 0:59am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 15, 2025

Walkthrough

Introduces accent color theming for OTP inputs and the email verification flow. Adds an optional accentColor to InputOTP via a new context for dynamic styling. Extends EmailVerificationMessage to accept a brand prop and apply computed colors. Parent views pass brand to EmailVerificationMessage.

Changes

Cohort / File(s) Change Summary
OTP Accent Color Context and Styling
components/ui/input-otp.tsx
Added internal AccentColorContext and optional `accentColor?: string
Email Verification Theming via Brand
components/view/access-form/email-verification-form.tsx
EmailVerificationMessage now accepts `brand?: Partial
Prop Plumb-Through: Brand to EmailVerificationMessage
components/view/dataroom/dataroom-document-view.tsx, components/view/dataroom/dataroom-view.tsx, components/view/document-view.tsx
Updated usages of EmailVerificationMessage to pass brand={brand} so the component can apply branding-driven styles. No other logic changes.

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title accurately and concisely describes the primary purpose of the changeset, namely applying the dataroom accent color to the OTP screen, without extraneous detail or ambiguity, making it clear to reviewers what the core update entails.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mfts mfts marked this pull request as ready for review October 15, 2025 12:55
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
components/ui/input-otp.tsx (1)

59-67: Focus ring not themed — can be invisible on some brand backgrounds

Use the computed textColor for the ring to maintain visibility.

Apply:

-        "relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",
-        isActive && "z-10 ring-2 ring-ring",
+        "relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",
+        isActive &&
+          (textColor === "white"
+            ? "z-10 ring-2 ring-white"
+            : "z-10 ring-2 ring-black"),
components/view/access-form/email-verification-form.tsx (3)

54-61: Background color fallback when accentColor is invalid

If brand.accentColor is a truthy but invalid CSS color, the background will not apply. Add a simple hex guard.

Example:

-        style={{
-          backgroundColor:
-            brand && brand.accentColor ? brand.accentColor : "black",
-        }}
+        style={{
+          backgroundColor:
+            brand?.accentColor?.match(/^#(?:[0-9a-fA-F]{3}){1,2}$/)
+              ? (brand!.accentColor as string)
+              : "black",
+        }}

Optionally extract a small isHexColor util for reuse.


62-75: Avoid repeated determineTextColor calls

Compute once and reuse for headings, helper text, button, and links.

Apply:

-  return (
+  const textColor = determineTextColor(brand?.accentColor);
+  return (
...
-          <h2
-            className="mt-10 text-2xl font-bold leading-9 tracking-tight"
-            style={{
-              color: determineTextColor(brand?.accentColor),
-            }}
-          >
+          <h2
+            className="mt-10 text-2xl font-bold leading-9 tracking-tight"
+            style={{ color: textColor }}
+          >
...
-          <p
-            className="text-pretty text-sm leading-6"
-            style={{
-              color: determineTextColor(brand?.accentColor),
-            }}
-          >
+          <p
+            className="text-pretty text-sm leading-6"
+            style={{ color: textColor }}
+          >

Also update below sections to use textColor (Button and footer texts). If desired, memoize: const textColor = useMemo(() => determineTextColor(brand?.accentColor), [brand?.accentColor]).


123-131: Footer text/link grayscale choice may under-contrast on dark accents

Hardcoded grays (rgb(75,85,99)/rgb(107,114,128)/rgb(156,163,175)) can be low‑contrast against some dark brand backgrounds. Prefer deriving from textColor (e.g., opacity or color-mix) to guarantee contrast.

Example:

- style={{ color: determineTextColor(brand?.accentColor) === "white" ? "rgb(75, 85, 99)" : "rgb(107, 114, 128)" }}
+ style={{ color: textColor, opacity: 0.75 }}

And for the link:

- style={{ color: determineTextColor(brand?.accentColor) === "white" ? "rgb(107, 114, 128)" : "rgb(156, 163, 175)" }}
+ style={{ color: textColor, opacity: 0.6 }}

Also applies to: 137-143

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5dc3d6f and 9bd1d19.

📒 Files selected for processing (5)
  • components/ui/input-otp.tsx (2 hunks)
  • components/view/access-form/email-verification-form.tsx (6 hunks)
  • components/view/dataroom/dataroom-document-view.tsx (1 hunks)
  • components/view/dataroom/dataroom-view.tsx (1 hunks)
  • components/view/document-view.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
components/ui/input-otp.tsx (2)
lib/utils.ts (1)
  • cn (18-20)
lib/utils/determine-text-color.ts (1)
  • determineTextColor (24-28)
components/view/access-form/email-verification-form.tsx (1)
lib/utils/determine-text-color.ts (1)
  • determineTextColor (24-28)
🔇 Additional comments (4)
components/ui/input-otp.tsx (2)

16-33: Prop + context wiring looks good

The new accentColor prop and provider wrapping OTPInput are clean and non-invasive.


46-49: All <InputOTPSlot> usages include the required index prop
Verified no instances missing index.

components/view/access-form/email-verification-form.tsx (2)

91-93: Passing accentColor to OTP — good integration

Propagating brand?.accentColor down to InputOTP aligns the OTP theming with the page.


111-115: Button contrast on all brand backgrounds

Current choice uses backgroundColor = textColor and color = accentColor. This usually works, but some dark accents may reduce text contrast on black. Consider clamping the accent’s lightness for button text, or swap to backgroundColor: accentColor and color: textColor when the page background isn’t accent-colored.

Please visually verify contrast (WCAG AA) with a few dark/light brand colors. If needed, I can provide a small ensureContrast(fg, bg, ratio) helper.

Comment on lines +52 to 54
const accentColor = React.useContext(AccentColorContext);
const textColor = determineTextColor(accentColor);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Guard against invalid hex input

If accentColor is a malformed hex, determineTextColor may throw via hexToRgb. Add a safe fallback.

Apply:

-  const accentColor = React.useContext(AccentColorContext);
-  const textColor = determineTextColor(accentColor);
+  const accentColor = React.useContext(AccentColorContext);
+  const textColor = React.useMemo(() => {
+    try {
+      return determineTextColor(accentColor);
+    } catch {
+      return "white";
+    }
+  }, [accentColor]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const accentColor = React.useContext(AccentColorContext);
const textColor = determineTextColor(accentColor);
const accentColor = React.useContext(AccentColorContext);
const textColor = React.useMemo(() => {
try {
return determineTextColor(accentColor);
} catch {
return "white";
}
}, [accentColor]);
🤖 Prompt for AI Agents
In components/ui/input-otp.tsx around lines 52 to 54, the call to
determineTextColor(accentColor) can throw if accentColor is a malformed hex;
validate/accommodate bad input by checking that accentColor is a valid hex (or
wrap determineTextColor in try/catch) and fall back to a safe default accent
(e.g. a known hex like "#ffffff" or "#000000") or default text color when
invalid; update the code so accentColor is sanitized/validated before passing to
determineTextColor and ensure a deterministic fallback textColor is assigned on
failure.

@mfts mfts merged commit 8d56b3d into main Oct 16, 2025
9 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2025
@mfts mfts deleted the cursor/apply-dataroom-accent-color-to-otp-screen-e9fa branch November 19, 2025 11:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants