ocaml / v2.ocaml.org

Implementation of the ocaml.org website.
http://ocaml.org
Other
323 stars 349 forks source link

Dark extension for code examples (editors snaps where code is written) #1431

Open shreyaswikriti opened 3 years ago

shreyaswikriti commented 3 years ago

Programmers often like the dark theme. I found this eye-catching. Screenshot from 2021-04-06 13-35-28 rather than a light theme, we can convert the editor to a dark theme. I'll start working on this if you like. @patricoferris

pitag-ha commented 3 years ago

Having dark code snippets seems to break a bit with the rest of the site, which is light, doesn't it? Do you have an example of a site where that happens?

shreyaswikriti commented 3 years ago

image it's the website of the iconic framework. They also use dark extension. Actually, I thought this extension look quite new and eye-catching that's why I suggested it. Thank you for reviewing this issue.

pitag-ha commented 3 years ago

In the screenshot you've sent everything is dark. The proposal of the issue is making only the code blocks dark and leaving the rest light, right?

shreyaswikriti commented 3 years ago

yes, I proposed to make only code blocks dark not all websites. Just as the above screenshot I have sent (second one).

pitag-ha commented 3 years ago

Sorry, I've misinterpreted the (second) screenshot you've sent. I think this issue is a matter of taste :) Some sites have it one way, others have it the other way; some prefer it one way others prefer it the other way.

Have you seen that applicants can only work on 2, max 3 simple issues (I'm referring to this)? I think you already have 2 simple issues (or more) to work on, don't you? Or do you rely on this one to have something simple? :)

shreyaswikriti commented 3 years ago

I have given only one simple issue to work on. I would love to contribute more.

patricoferris commented 3 years ago

Hi @shreyaswikriti,

I agree with @pitag-ha that this is definitely one of those subjective issues, but I think to add a dark colour format now would entail two important aspects:

What do you think?

pitag-ha commented 3 years ago

The ability to toggle between the dark and light?

Yes, I agree that that might be an improvement, if it is for the whole site. @patricoferris, do you think it would also make sense to only have dark mode for code examples? I think that's what the issue is about. @shreyaswikriti , please correct me if I got that wrong and you actually wanted to implement dark mode for the whole site :)

shreyaswikriti commented 3 years ago

Primarily, I raised this issue to change the color of code blocks only but as mentioned by @patricoferris theme switcher can be added to the whole site. I have seen many websites that do use the theme switcher.

pitag-ha commented 3 years ago

Sounds great. Could you send me a link to a couple of websites with theme switcher? It rings a bell having seen that somewhere, but I don't know where and I'm curious :)

shreyaswikriti commented 3 years ago

Hii @pitag-ha, there is a theme switcher on the GitHub website itself, where we can toggle between dark and light themes. Actually, theme switcher is famous on that website where users spend a lot of time like book reading websites, coding websites, etc. The reason being dark mode gives less eye strain. For this website, we have to Learn section where users can spend more time reading codes, learning about OCaml, etc. So it would be beneficial for a user to have a theme customize option. This is not a compulsory thing but an additional facility for users.

shreyaswikriti commented 3 years ago

So, Can I start working on this??

pitag-ha commented 3 years ago

So, Can I start working on this??

Yes! :) Sounds good to me (and I'm pretty sure it also does to @patricoferris ). You're right: I should have made that clearer.

shreyaswikriti commented 3 years ago

I made a theme switcher for the site. Light mode is the same as previous.Since the video quality is not good, I am attaching some screenshots. Kindly have a look @pitag-ha @patricoferris @gs0510

https://user-images.githubusercontent.com/57635473/114870998-712a5180-9e16-11eb-93fe-d05878ac224d.mp4 Screenshots Screenshot from 2021-04-15 18-12-08 Screenshot from 2021-04-15 18-12-23 Screenshot from 2021-04-15 18-12-37 Screenshot from 2021-04-15 18-12-40 Screenshot from 2021-04-15 18-12-52 Screenshot from 2021-04-15 18-13-34 Screenshot from 2021-04-15 18-14-11 Screenshot from 2021-04-15 18-13-42

gs0510 commented 3 years ago

@shreyaswikriti This is a great start! I have a few comments:

  1. The code block that's gray is harder to read than before, maybe you can choose a different gray that's help with legibility.
  2. The toggle looks a little out of place with the emojis. It would look more consistent with a simpler toggle.
  3. Can you run an accessibility tool with your website, I feel there's a bunch of places where the contrast is wonky and makes it harder to see.
shreyaswikriti commented 3 years ago

@gs0510, I have made the changes as suggested. Also, I used the 'WAVE Evaluation Tool ' and it's showing no contrast errors. Kindly have a look.

https://user-images.githubusercontent.com/57635473/115051306-4d403c00-9efa-11eb-845e-4cb8f517b408.mp4

Screenshot from 2021-04-16 21-21-03 Screenshot from 2021-04-16 21-21-09 Screenshot from 2021-04-16 21-21-22 Screenshot from 2021-04-16 21-22-15 Screenshot from 2021-04-16 21-21-32

gs0510 commented 3 years ago

@shreyaswikriti It definitely looks better! But I think every time you switch to another link, there's a flash where the bright version is loaded first and then the dark version is applied which makes browsing the website uncomfortable. Can you fix that?

The switch can be something like this: Screenshot from 2021-04-16 18-11-19

Thanks!

shreyaswikriti commented 3 years ago

@gs0510,

shreyaswikriti commented 3 years ago

@gs0510, Kindly Have a look. thanks https://user-images.githubusercontent.com/57635473/115125553-8c4bbb80-9fe6-11eb-9a78-d63df69a4e82.mp4

gs0510 commented 3 years ago

Looks really good @shreyaswikriti!! you should go ahead and open a PR :)