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

Dark mode #1661

Merged
merged 37 commits into from
Jan 15, 2022
Merged

Dark mode #1661

merged 37 commits into from
Jan 15, 2022

Conversation

pbignardi
Copy link
Contributor

@pbignardi pbignardi commented Nov 14, 2021

Addresses issue #23

Outline of the changes:

Extracted colors from editor.css into separate css files

All the colors in editor.css have been replaced by CSS variables that are defined in light_color.css and dark_color.css.
These two files contains media queries to decide which of the variables to use depending on the prefered user theme.
For simplicity, all the variables are set in the :root scope, but the names are quite descriptive, in case they need to be modified down the line.

Included cm-cursor and cm-docs-binding styling in editor.css

Styling for cm-cursor and cm-docs-binding classes are moved in editor.css for clarity and improve code maintainability. CSS variables are created in light_color.css and dark_color.css to specify the colors.

Modified CellInput.js and FilePicker.js to allow for dark theming

The default code-mirror setup only support light theming. An optional parameter was added to allow for dark theming in the cell input and file picker.

SVG graphics inverted

SVG graphics are reused with appropriate filters in editor.css. A good improvement would be to create custom svg graphics for the dark theme.

Try this Pull Request!

Open Julia and type:

julia> ]
(@v1.6) pkg> activate --temp
(@v1.6) pkg> add https://github.com/pbignardi/Pluto.jl#main
(@v1.6) pkg> # press backspace/delete to go back
julia> import Pluto; Pluto.run()

@fonsp
Copy link
Owner

fonsp commented Nov 15, 2021

This looks really good @pbignardi, thanks so much! Can you resolve the merge conflicts?

@fonsp fonsp linked an issue Nov 15, 2021 that may be closed by this pull request
@fonsp fonsp requested a review from pankgeorg November 15, 2021 21:55
@pankgeorg
Copy link
Collaborator

This is awesome, from a software engineering perspective! I tried to push a commit with some styling adjustments - can you give us access? I'll get a more detailed list soon!

Great work overall!!

@pbignardi
Copy link
Contributor Author

Thank you for the kind words 😄 Shall I set you as collaborator in my forked repo?

@pbignardi
Copy link
Contributor Author

I also pushed some changes to resolve the conflicts earlier this morning.

@pankgeorg
Copy link
Collaborator

Thank you for the kind words 😄 Shall I set you as collaborator in my forked repo?

Can you check if you can do this process? if yes, it will be easier

@pbignardi
Copy link
Contributor Author

Thank you for the kind words 😄 Shall I set you as collaborator in my forked repo?

Can you check if you can do this process? if yes, it will be easier

Done, box checked. Sorry, it's my first PR 😅

@pankgeorg pankgeorg closed this Nov 16, 2021
@pankgeorg
Copy link
Collaborator

pankgeorg commented Nov 16, 2021

Oops I closed this by mistake - I messed the git - the commits got lost but managed to restore the code.

@pankgeorg pankgeorg reopened this Nov 16, 2021
@pbignardi
Copy link
Contributor Author

Sorry, I'm quite newbie in project contributing. Are there any changes that I need to do to the code?

@fonsp
Copy link
Owner

fonsp commented Nov 18, 2021

Hi @pbignardi, thanks again for contributing! I think there were some technical problems because this PR is coming from the main branch of your fork instead of a new branch for your PR. Something to remember for your next contribution to Pluto!

I think the PR will take a couple of weeks of tweaking from our side until we are happy with how all the styles look, and we will have to try how well it plays together with other packages, but the technical side looks really good!

@pbignardi
Copy link
Contributor Author

Oh, ok thank you for the heads up! I'll start looking for a new issue to contribute to 😄

@fonsp fonsp added wide audience This affects a wide audience of Pluto users and future Pluto users frontend Concerning the HTML editor labels Dec 13, 2021
frontend/components/CellInput.js Outdated Show resolved Hide resolved
@fonsp
Copy link
Owner

fonsp commented Dec 23, 2021

Sorry for the slow response! The reason is: we think dark mode is a really exciting feature, and we are saving it up for our next big release, either 0.18.0 (or 1.0.0 if that is soon). 🙊

@pbignardi
Copy link
Contributor Author

It's exciting to see so much hype for this feature 😄 😎

Also removed SyntaxColorsParsers.js as it's no longer needed
@pbignardi
Copy link
Contributor Author

Just noticed the background in the dark mode. Very nice, I like it! 👍🏻

@fonsp
Copy link
Owner

fonsp commented Jan 11, 2022

We are getting close!

TODO:

  • errored focused cell in light mode has glitched traffic light
  • selection highlight color in CM needs more contrast

Future PR:

  • Pattern for background on main menu and large screens!

@icweaver
Copy link
Contributor

icweaver commented Jan 12, 2022

Y'all got thiss
teddy-bear-break-dancing

@pbignardi
Copy link
Contributor Author

pbignardi commented Jan 12, 2022

  • errored focused cell in light mode has glitched traffic light

@fonsp Are you referring to this?
Screenshot 2022-01-12 at 22 35 29

@pbignardi
Copy link
Contributor Author

pbignardi commented Jan 13, 2022

  • selection highlight color in CM needs more contrast

Regarding this problem, the best solution would be to modify the CodeMirror config files, since in there it is defined the selection background color that it's used when in dark mode. Alternatively we could also bodge it by forcing such color afterwards by changing it in the css and using the !important keyword; not the cleanest solution but it works.

Edit: fyi, in the index.es.js file the selection background color is at line 10862.

@pankgeorg
Copy link
Collaborator

  • selection highlight color in CM needs more contrast

Regarding this problem, the best solution would be to modify the CodeMirror config files, since in there it is defined the selection background color that it's used when in dark mode. Alternatively we could also bodge it by forcing such color afterwards by changing it in the css and using the !important keyword; not the cleanest solution but it works.

Edit: fyi, in the index.es.js file the selection background color is at line 10862.

there is a clean CSS solution, but we are looking for the right candidate color!!

@pbignardi
Copy link
Contributor Author

Fair point 😄

@pbignardi
Copy link
Contributor Author

Ok I updated the color, I made it green. See if you like it 😉

@fonsp fonsp merged commit 8f854a2 into fonsp:main Jan 15, 2022
@fonsp
Copy link
Owner

fonsp commented Jan 15, 2022

@diegozea
Copy link
Contributor

This is awesome! 🎉 I want to test it; how should we do to activate the dark mode? 🌑

@pankgeorg
Copy link
Collaborator

Just update to the latest version and set you operating system theme to dark!

@diegozea
Copy link
Contributor

It seems that it doesn't work in Ubuntu 18.04. I have followed these instructions to set the dark mode on the system: https://nixytrix.com/how-do-i-enable-dark-mode-in-ubuntu-18-04/

@pankgeorg
Copy link
Collaborator

pankgeorg commented Jan 21, 2022

What pluto version are you on? If you go here https://github.com/settings/appearance and set
"Sync with system" does it get dark?
image

@diegozea
Copy link
Contributor

No, it doesn't work with the GitHub page either. So, it should be a problem with Ubuntu 18.04 and Tweaks.

@diegozea
Copy link
Contributor

Ok. It was a problem with Chrome & Ubuntu; I have fixed it following this steps: https://radu.link/enable-dark-mode-chrome-ubuntu/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Concerning the HTML editor wide audience This affects a wide audience of Pluto users and future Pluto users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dark mode
5 participants