-
Notifications
You must be signed in to change notification settings - Fork 42
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
feat: add dark mode support #11
Conversation
@drewcook awesome! let me know when i should ping the dark site over to vitalik for review |
From Vitalik:
|
@drewcook this really looks awesome and very neat.. Adding 10px padding to img tag globally in css would solve this edge problem. |
Rather than cherry-picking what images get padding and which don't, I think a better solution would be to add the padding to all images that appear within the For comparison, one could use a class around the image to add the padding within the markdown files, but that's not very scalable and requires a bit of cognitive capacity to remember that. Most images already have the white (or light) background to them already, so it makes sense to equalize them all for those that don't, so that when dark mode is enabled, they all appear consistent. One additional idea I had was for these specific flow-chart type images as referenced, that the I think the best bang for the buck in this scenario is to just add some slight padding to all the images, give it background white/light, and optionally add a border to the images if desired (enhancement). I will reach back out and provide an update today after implementing this and publishing it to the demo URL for review. |
@owocki I've added in the image styling support and have re-published to the demo URL. The circuit diagrams look much better now with the additional padding. I've added in the subtle border as well, as it contrasts nicely with the non-white background. |
@owocki I've made one last final update to using a less intrusive sun and moon icons with subtler accent colors for the toggle for each state (open to exact hexadecimal suggestions if desired). I think overall this looks nicer and is cleaner than text. The live demo URL is up to date with these changes. I've opened up the PR for official review now. |
@drewcook can you DM me on telegram? i want to introduce you directly to vitalik to reduce the game of telephone (also u should get to know him :) ) i'm owocki there. |
General Changes
global.css
#doc
container to use these variables for colorslocalStorage
localStorage
for any previous saved value and applies it if so - defaults to light for new visitorsdark
class on toggle switch clicklocalStorage
with the newly selected valueNotes
I've added in utility classes for images and tables.
centered
for centering all text within a tabletransparent
for invisible tables vs the striped style - applied when tables are used for grid layoutstransparent
for images - applied when wanting to preserve a transparent background image - the image will inherit the light/dark mode background colorpadded
for images - used to apply 12px of padding around an image to give it more room - great for graphsinvert
for images - used when wanting to completely invert the colors of an image for dark modeDemo
I've created a version that mimics https://vitalik.ca in dark mode, and additionally have applied these utility classes to the images and tables throughout the posts as outlined in vbuterin/blog#40.
View the demo here.