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

how can I make it as a default case where I dont require to enable dark theme again after opening a new notebook? #1

Open
nehamsoni opened this issue Oct 8, 2020 · 4 comments

Comments

@nehamsoni
Copy link

No description provided.

@jonniedie
Copy link

+1 on this. I tried putting it in my startup.jl file and apparently Pluto doesn't use that. So then I tried putting an include("...startup.jl") statement at the top of my notebook, and for some reason that doesn't work either. I have to manually put a separate using DarkMode; DarkMode.enable() in addition to my include("...startup.jl") line (which has my other defaults like plot backends and themes).

@Pocket-titan
Copy link
Owner

I can't think of a way to do this without modifying the Julia codebase, which will just get overwritten the next time you update Pluto. So until we have either 1) native support for dark mode or 2) a way to provide a notebook "template" from which your new notebooks are created (a sort of startup.jl but for html/css/js) (basically notebooks within notebooks), you'll have to just make a cell with using DarkMode; DarkMode.enable() in every notebook. But If you manage to get arthritis from repeatedly having to type this single line, I'll happily pay your medical bills 😛 (I won't, don't sue me)

@jonniedie The reason why that doesn't work is because cells returning an html object have their output inserted into the page by Pluto. However, if you execute html" ... " in a regular Julia process (which is basically what include'ing a file does), you will just have created an unnamed html object. You'll still have to somehow get that html into the page, by getting a cell to return it - you could, for example, have very_cool_html = html"..." in your startup.jl, include("...startup.jl"), and then write very_cool_html in an empty cell & evaluate it. Now, that cell will return that html, and Pluto can do its thing & render it into the page. But you'll still have to write roughly the same amount of characters, so no cigar 🤕

By the way, @jonniedie, do you think it's a good idea to also set a default dark theme for Plots in this package? You'll still be able to overwrite it, but this way those that don't know how/want to change it can still have the experience of a "grand unified theme" (like this but for themes - I was first btw they stole my acronym). If you do think it's a good idea, mind sending/linking me some code (maybe from your startup.jl that accomplishes this? I am still a rookie at Julia 🙃

@jonniedie
Copy link

Thanks for the tip with the html"..." thing, I'll give it a try.

I think it would be great to have unified themes for these. Unfortunately I'm having to do some Requires.jl workarounds to get themes set automatically in my startup.jl file and that's not ideal as a common solution for a lot of reasons. The way things are supposed to work is you're supposed to be able to set const PLOTS_DEFAULTS = Dict(:theme => :your_theme_name) in your startup.jl file and Plots.jl will use that, but it doesn't seem to be working for the latest versions (also, I don't think that is a good way to do it; this kind of stuff should be handled with ENV entries). I mentioned it here, but I should open up a real issue as well.

With all that said, I also opened an issues with Pluto.jl here about allowing templates for Pluto so you could open a template with the startup cells already pre-populated. I think doing it this way would allow for this kind of thing while remaining within the fully reproducible model that Pluto aims for.

@jonniedie
Copy link

I ended up making an issue for the Plots.jl part. But if the Pluto templates thing happens, that should fix it without having to wait for the Plots one to happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants