-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
fix Illustration and IllustrationBlock alt color on dark mode #5981
Conversation
Size changes📦 Next.js Bundle Analysis for react-devThis analysis was generated by the Next.js Bundle Analysis action. 🤖 Three Pages Changed SizeThe following pages changed size from the code in this PR compared to its base branch:
DetailsOnly the gzipped size is provided here based on an expert tip. First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If Any third party scripts you have added directly to your app using the Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this. |
Is it possible to also make the alt text dark mode when the theme is dark mode? |
Not sure I understood your question. The alt text does currently inherit the dark mode, but since the background is fixed to white, it is not readable when dark mode is on. |
@oxcened Oh I guess I was asking if the alt text background could also turn dark during dark mode, that way we don't need to address the text color. |
Ah I got you. We could do that, but as far as I can tell, all illustration images have a white background, and I'm not sure it would look very clean. Otherwise you could keep the white background on the image container, and set the dark background on the image only. Not sure there any other solutions? |
There are two illustrations
in the single illustration bg white is not needed at all? it doesn't show up until the image is not loaded. so ideally the text is visible when bg is removed. (can remove in the block we can consider having |
Yeah it is different because the background is applied directly to the img. So as long as the images have their own white background, the style has no visible effect. I think this is currently true for all images, so it depends whether it might change in the future I guess?
I think this is the best option. Currently the PR applies it to the outer div instead of the img, though. |
6f6fcf1
to
7c53e2e
Compare
hey @lunaleaps @harish-sethuraman I did some changes according to your comments.
What do you think? |
Thanks for fixing, this looks good to me! |
Motivation
When dark mode is turned on, the alt text rendered by the Illustration and IllustrationBlock components is not visible.
On dark mode, the text color inherited is
text-primary-dark
, which is not visible on the white background.Change
Applying a fixed
text-primary
ensures that the text is always visible regardless of the current theme.Demonstration
Source of the images have been removed for the sake of testing.
Current behaviour:
Fixed behaviour: