My implementation involves a one-line change to default.hbs which can’t be done via code injection.
However, if you don’t want the option for Light mode or the option to for the mode to switch automatically, then it would be possible to read through my CSS, understand how to adapt it for that case, and then use code injection for a dark mode. It would be up to you to made that adaptation if you want to try it.
Site performance will be slightly better if code injection is avoided though. When CSS is implemented in screen.css, it can be loaded once and cached.
Whatever you add through Code Injection is loaded repeatedly on every page.
If you want to further modify the theme for your own use, I’ve published the full source here with instructions on how to this:
I made this for my personal use and am sharing it. Feedback is welcome, but I’m not taking feature requests for further changes and may make incompatible changes in the future.
Thank you for sharing this. I am using Journal free theme from Ghost marketplace and would like to add also this light/dark mode feature that depends on reader settings. Is it possible to do it the same way that you proceed with Headline ? Also, where can I find the code you added to add this feature in Headline ?
I noticed one minor thing in Dawn theme. When I have auto color selected, backticks (``) content looks inconsistent. Theme color is Auto:
In light theme: it looks good
In dark theme: it looks exactly like light(instead of what dark theme provides)
It seems like the backticks content in auto selection is not overwriting when the browser/computer theme is dark, keeps using the light one.