Skip to content
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

Home page enable dark mode #45535

Closed

Conversation

tamilselvan1102
Copy link

@tamilselvan1102 tamilselvan1102 commented Mar 13, 2024

Fixes: #37444

This is to enabling dark mode only for https://kubernetes.io/ page.


ℹ️ Superseded - see #49586

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. sig/docs Categorizes an issue or PR as relevant to SIG Docs. labels Mar 13, 2024
Copy link

netlify bot commented Mar 13, 2024

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit a12c1cc
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-io-main-staging/deploys/66d6ead57ebe9d0008a79e13
😎 Deploy Preview https://deploy-preview-45535--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@tamilselvan1102
Copy link
Author

@tamilselvan1102
Copy link
Author

I confirmed the view by enabling dark mode in Microsoft windows 10 Pro.
image

@tamilselvan1102
Copy link
Author

/assign @sftim
Please review the changes

Copy link
Contributor

@sftim sftim left a comment

Choose a reason for hiding this comment

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

Thanks. This is pretty close.

I don't think we should merge this as-is, because one of the case studies' logos almost disappears. There's a similar problem with the CNCF logo and the Babylon logo (which is missing some transparency. This PR should fix those issues as part of the required changes, without breaking other pages or breaking the light mode view.

If you'd like to also switch the colors for the top navigation bar (when no banner is showing), I think that would help - but I don't think we should insist on it.

Finally, please add a comment to the top of assets/scss/_base.scss and assets/scss/_custom.scss so that people know about the partial dark mode support.

@sftim
Copy link
Contributor

sftim commented Mar 13, 2024

/area web-development

@k8s-ci-robot k8s-ci-robot added the area/web-development Issues or PRs related to the kubernetes.io's infrastructure, design, or build processes label Mar 13, 2024
@sftim
Copy link
Contributor

sftim commented Mar 13, 2024

@tamilselvan1102, which of these are you comfortable picking up?

  • making the white areas of the Babylon logo be transparent
  • finding a way to switch which CNCF logo gets used on the front page depending if it is dark or light mode
  • handling the poor contrast for the case study logo that uses black text

The work here is a prototype for a wider piece of work, so if there are problems we'll eventually want to fix, it's best to plan fixes rather than find a one-off work around.

@tamilselvan1102
Copy link
Author

tamilselvan1102 commented Mar 14, 2024

@sftim
if we do invert the image color, it gives good visibility .

filter: invert(100%);
-webkit-filter: invert(100%);

image

@tamilselvan1102
Copy link
Author

Regarding CNCF logo. can in use attached image when switching in to dark mode.
cncf-white

Output

image

@tamilselvan1102
Copy link
Author

@sftim
Resolved all the above concerns. please confirm

Comment on lines 960 to 967
.cid-home main section:is(#talkToUs) img {
filter: invert(100%);
-webkit-filter: invert(100%);
}

.cid-home main section:is(#cncf) {
background-color: $dark-bg-color-2;
background-image: url(/images/cncf-white.png);
Copy link
Member

Choose a reason for hiding this comment

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

Inverting image colors or adjusting background image according to prefers-color-scheme: dark is nice addition for the homepage. However, extending this functionality to the entire docs and all its different images would be a challenge. It would be nice if this could be achieved through a Hugo shortcode, dynamically altering image source based on prefers-color-scheme: dark or light. I notice the issue description(here) also hints at employing shortcode for image switching, which aligns well with this suggestion.

For guidance on shortcode, refer to the tips provided at https://gohugo.io/templates/shortcode-templates/

@tamilselvan1102
Copy link
Author

Thank you @dipesh-rawat
I will try to implement through Hugo shortcode,

@sftim
Copy link
Contributor

sftim commented Mar 18, 2024

For some tips, check out https://cassidyjames.com/blog/prefers-color-scheme-svg-light-dark/

Because the main page is HTML, if we want to skip a shortcode and write HTML directly, I am also fine with that too.
One way folks do this in HTML is something like:

<picture id="icon-briefcase">
  <source srcset="briefcase-dark.svg" media="(prefers-color-scheme: dark)">
  <img src="briefcase-light.svg">
</picture>

You can / we can use a similar technique inside partials (see layouts/partials).

@sftim
Copy link
Contributor

sftim commented Apr 14, 2024

@tamilselvan1102, how are you doing on this? Remember that this is a prototype to show how we'll do the rest of the site; it's less important to find shortcuts that make one page look right, than it is to explore the kind of changes we'll need so we don't have to take shortcuts.

However, you don't have to consider the whole site. The ask is to do just that one page, but to do it without those shortcuts.

@tamilselvan1102
Copy link
Author

@sftim
sorry the delay. i will raise it soon

@tamilselvan1102
Copy link
Author

@dipesh-rawat
I was tried with Hugo shortcode, but some build error has came in my environment. so I tried the way as @sftim suggested.

@sftim
Done the suggested changes

@sftim
Copy link
Contributor

sftim commented Apr 19, 2024

(Please) don't switch colors for vendors' logos. We wouldn't be allowed to do that.

@tamilselvan1102
Copy link
Author

(Please) don't switch colors for vendors' logos. We wouldn't be allowed to do that.

if not invert the color of vender logos, it is not visible well in the dark mode.
Please suggest me about vender's logo
image

@tamilselvan1102
Copy link
Author

@sftim
If possible please share me the vender's logos for dark mode

@sftim
Copy link
Contributor

sftim commented Apr 22, 2024

If possible please share me the vender's logos for dark mode

This is work for a contributor working on this issue; you could look for those yourself @tamilselvan1102.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 5, 2024
@Andygol
Copy link
Contributor

Andygol commented Aug 28, 2024

image image

For some reason, I use the Dark Mode extension in Safari and as you can see, creating a dark theme is not a trivial task, the desired effect is not always achieved automatically. In my opinion, using solid black for the background is not a good idea, there should be some dark shade of grey. It would be great to develop a custom dark theme for the documentation site. We need to engage experienced UI designers to develop a dark theme.

@sftim
Copy link
Contributor

sftim commented Aug 28, 2024

@tamilselvan1102 we've a very limited pool of volunteers willing to help with UI design, but I do think that feedback about the solid black is relevant.

Could you use a very dark gray instead for the page body?

@sftim
Copy link
Contributor

sftim commented Aug 28, 2024

If you'd like someone to take over this work and build on what you've done, that's an option too. You've put in a huge amount of work already; what's at tension here is:

  • we don't want to make the user experience worse for people visiting the site
  • in the long term, we want to make the UX better

@tamilselvan1102
Copy link
Author

@sftim, @Andygol
Updated background colors.
if you have any suggestion about colors please share me the color codes.
I am happy to update it.

@sftim
Copy link
Contributor

sftim commented Sep 3, 2024

In either light or dark mode, I can't see an AppDirect logo on https://deploy-preview-45535--kubernetes-io-main-staging.netlify.app/case-studies/

I see a similar problem with NetEase.

Otherwise, I think this is looking good.

@111andre111
Copy link
Contributor

My problem looking to the page is as well that the main page looks good regarding dark.
But already when scrolling down, at the top part it's bright.
Screenshot 2024-09-04 at 12 01 39
Screenshot 2024-09-04 at 12 01 51

And when going to Documentation link, the dark mode is completely gone...
Screenshot 2024-09-04 at 12 01 56

@tamilselvan1102
Copy link
Author

tamilselvan1102 commented Sep 4, 2024

In either light or dark mode, I can't see an AppDirect logo on https://deploy-preview-45535--kubernetes-io-main-staging.netlify.app/case-studies/

I see a similar problem with NetEase.

Otherwise, I think this is looking good.

@sftim
Dark mode is enabled only in Main page
not in other pages.

@tamilselvan1102
Copy link
Author

@111andre111
This PR is only for Main page not other pages

@111andre111
Copy link
Contributor

Oh, sorry. Missed that fact. However the scrolling down issue would not count into that as well that I described in the first part of my comment?

@sftim
Copy link
Contributor

sftim commented Sep 4, 2024

However the scrolling down issue would not count into that as well that I described in the first part of my comment?

Please clarify the problem @111andre111 (why should we consider that behavior defective)?

@111andre111
Copy link
Contributor

Sure, I can repeat it again.

  1. I go to the Deploy Preview page https://deploy-preview-45535--kubernetes-io-main-staging.netlify.app/
  2. All looks good so far.
Screenshot 2024-09-04 at 12 01 39 3. I scroll a little down - the top page part shows up now in bright mode. Screenshot 2024-09-04 at 12 01 51

@sftim
Copy link
Contributor

sftim commented Sep 4, 2024

Thanks for the screenshots @111andre111. But, why is this behavior unwanted / something that means we can't merge this initial PR?

@111andre111
Copy link
Contributor

I just tried to understand if this is the intended behaviour that this PR should aim for. If so then looks good to me.

@sftim
Copy link
Contributor

sftim commented Sep 4, 2024

This PR wants to be an MVP, so the menu bar lightening on scroll is fine (by me).

Pending feedback though: #45535 (comment)

@sftim
Copy link
Contributor

sftim commented Sep 4, 2024

@tamilselvan1102 if you write a PR description, that will make it easier for people to review constructively.

@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 13, 2024
@111andre111
Copy link
Contributor

#45535 (comment)
What I meant is that the top stripe shows nonetheless as bright. But it could be a misunderstanding from my side that this is as well not part of the PR.

@divya-mohan0209
Copy link
Contributor

@tamilselvan1102 : Please could you rebase since there appears to be a merge conflict?

@sftim
Copy link
Contributor

sftim commented Nov 2, 2024

I sense contributor fatigue, or at least the possibility of fatigue.

If we can pick up the work @tamilselvan1102 has done, move it forward, and get it merged, I think that will help a lot.

@sftim
Copy link
Contributor

sftim commented Dec 21, 2024

Sorry about the wait on this one @tamilselvan1102

@varodrig
Copy link

@milinddethe15 to follow up on this.

@sftim
Copy link
Contributor

sftim commented Jan 28, 2025

/close

(in favor of PR #49586)

@k8s-ci-robot
Copy link
Contributor

@sftim: Closed this PR.

In response to this:

/close

(in favor of PR #45535)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/web-development Issues or PRs related to the kubernetes.io's infrastructure, design, or build processes cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow (auto)switching front page between light mode and dark mode
9 participants