-
-
Notifications
You must be signed in to change notification settings - Fork 33
fix: update text color for better contrast in header #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe text color classes for the header's main title and subtitle spans in the index page were updated. In dark mode, the colors now use gray shades instead of pure black or white. No other logic or structural changes were made to the file. Changes
Sequence Diagram(s)No sequence diagram generated as the changes are limited to styling. ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (1)
src/pages/index.tsx (1)
22-22
: Minor duplication — outer container already setstext-white
The parent
<div>
(line 19) hastext-white
for light mode, so the extratext-white
on this span is redundant. Removing it simplifies the class list without changing rendering.-<span className="inline-block text-white dark:text-gray-800"> +<span className="inline-block dark:text-gray-800">
<div className="w-full xl:container flex justify-center text-white dark:text-gray-800"> | ||
<div className="w-full max-w-4xl text-center flex flex-col items-center px-4"> | ||
<h1 className="hero__title font-bold text-2xl sm:text-3xl md:text-4xl lg:text-5xl xl:text-6xl 2xl:text-7xl mb-6 sm:mb-8 lg:mb-12 leading-tight sm:leading-tight md:leading-tight lg:leading-tight xl:leading-tight 2xl:leading-tight"> | ||
<span className="inline-block text-white dark:text-black"> | ||
<span className="inline-block text-white dark:text-gray-800"> | ||
Schema-First Full‑Stack Toolkit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Re-check dark-mode contrast – current dark:text-gray-800
is likely too low against a dark hero background
dark:text-gray-800
(#1F2937) is almost the same luminance as most dark backgrounds (e.g. #0f172a
, #111827
, etc.). This can drop the contrast ratio far below the WCAG-AA 4.5:1 guideline for normal text, defeating the PR’s stated goal.
Please verify the effective background color of .hero--primary
in dark mode and run a quick contrast check. If the ratio is < 4.5 : 1, consider one of:
-<span className="inline-block text-white dark:text-gray-800">
+<span className="inline-block text-white dark:text-gray-100">
-<span className="inline-block mt-2 sm:mt-0 text-gray-800 dark:text-white font-extrabold">
+<span className="inline-block mt-2 sm:mt-0 text-gray-200 dark:text-white font-extrabold">
or switch to Tailwind’s text-gray-200/300
for dark variants.
You can confirm quickly with:
If the ratio < 4.5, please adjust the color.
Also applies to: 27-27
🏁 Script executed:
#!/bin/bash
# Compute contrast ratio between bg and fg (requires node & tinycolor2 if available)
# Substitute the actual dark hero background hex below:
bg="#0f172a"
fg="#1f2937"
node - <<'JS'
const tiny = require('tinycolor2');
function contrast(a,b){return tiny.readability(a,b).toFixed(2)}
console.log(`contrast: ${contrast(process.env.fg,process.env.bg)}`)
JS
Length of output: 879
🏁 Script executed:
#!/usr/bin/env bash
# Compute contrast ratio between bg and fg using Python
python3 - << 'PYCODE'
import sys
def luminance(hex_color):
hex_color = hex_color.lstrip('#')
r, g, b = [int(hex_color[i:i+2], 16) / 255.0 for i in (0, 2, 4)]
def to_lin(c):
return c / 12.92 if c <= 0.03928 else ((c + 0.055) / 1.055) ** 2.4
r_l, g_l, b_l = to_lin(r), to_lin(g), to_lin(b)
return 0.2126 * r_l + 0.7152 * g_l + 0.0722 * b_l
bg = "#0f172a"
fg = "#1f2937"
L1, L2 = luminance(fg), luminance(bg)
ratio = (L1 + 0.05) / (L2 + 0.05) if L1 >= L2 else (L2 + 0.05) / (L1 + 0.05)
print(f"contrast: {ratio:.2f}:1")
PYCODE
# Search for any .hero--primary usage or definition
rg "hero--primary" -n
Length of output: 148
Increase Dark-Mode Text Contrast
Running a local luminance check confirms dark:text-gray-800
(#1F2937) on the hero’s dark background (#0f172a) yields only 1.22:1, far below the WCAG-AA minimum of 4.5:1. Please adjust the dark-mode text colors in src/pages/index.tsx
:
• At lines 19–23:
- <span className="inline-block text-white dark:text-gray-800">
+ <span className="inline-block text-white dark:text-gray-100">
• At line 27:
- <span className="inline-block mt-2 sm:mt-0 text-gray-800 dark:text-white font-extrabold">
+ <span className="inline-block mt-2 sm:mt-0 text-gray-200 dark:text-white font-extrabold">
These changes will raise the contrast to ≥ 4.5:1 in dark mode.
📝 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.
<div className="w-full xl:container flex justify-center text-white dark:text-gray-800"> | |
<div className="w-full max-w-4xl text-center flex flex-col items-center px-4"> | |
<h1 className="hero__title font-bold text-2xl sm:text-3xl md:text-4xl lg:text-5xl xl:text-6xl 2xl:text-7xl mb-6 sm:mb-8 lg:mb-12 leading-tight sm:leading-tight md:leading-tight lg:leading-tight xl:leading-tight 2xl:leading-tight"> | |
<span className="inline-block text-white dark:text-black"> | |
<span className="inline-block text-white dark:text-gray-800"> | |
Schema-First Full‑Stack Toolkit | |
<div className="w-full xl:container flex justify-center text-white dark:text-gray-800"> | |
<div className="w-full max-w-4xl text-center flex flex-col items-center px-4"> | |
<h1 className="hero__title font-bold text-2xl sm:text-3xl md:text-4xl lg:text-5xl xl:text-6xl 2xl:text-7xl mb-6 sm:mb-8 lg:mb-12 leading-tight sm:leading-tight md:leading-tight lg:leading-tight xl:leading-tight 2xl:leading-tight"> | |
- <span className="inline-block text-white dark:text-gray-800"> | |
+ <span className="inline-block text-white dark:text-gray-100"> | |
Schema-First Full-Stack Toolkit | |
</span> | |
</h1> | |
{/* … other content … */} | |
- <span className="inline-block mt-2 sm:mt-0 text-gray-800 dark:text-white font-extrabold"> | |
+ <span className="inline-block mt-2 sm:mt-0 text-gray-200 dark:text-white font-extrabold"> | |
{/* your subtitle or tagline here */} | |
</span> |
🤖 Prompt for AI Agents
In src/pages/index.tsx around lines 19 to 23 and line 27, the dark mode text
color classes use dark:text-gray-800 which results in insufficient contrast
against the dark background. Update these dark mode text color classes to a
lighter shade that meets the WCAG-AA minimum contrast ratio of 4.5:1, such as
dark:text-gray-100 or a similar lighter gray, to improve readability and
accessibility.
Summary by CodeRabbit