Colors that work well on light backgrounds can be hard to see or cause eye strain on dark backgrounds. Pairing colors thoughtfully ensures good contrast and readability in both modes.
In Tailwind, the 'dark:' prefix applies styles when dark mode is active. So 'bg-gray-100 dark:bg-gray-900' means light mode uses gray-100 and dark mode uses gray-900.
text-gray-800 dark:text-gray-200, what will the text color be when the user switches to dark mode?<p class="text-gray-800 dark:text-gray-200">Hello, world!</p>The 'dark:text-gray-200' class overrides the light mode text color when dark mode is active, making the text a lighter gray for better contrast on dark backgrounds.
Using a lighter blue (blue-300) in light mode and a darker blue (blue-500) in dark mode ensures the button stands out clearly in both modes.
text-gray-400 dark:text-gray-600. What accessibility issue might this cause when switching to dark mode?Gray-600 is a medium gray that may not have enough contrast on a dark background, making text difficult to read and failing accessibility guidelines.