Layout & Design

Light and Dark Mode Themes in Framer (Fundamentals Lesson 20)

Light and Dark Mode Themes in Framer (Fundamentals Lesson 20)

Light and Dark Mode Themes in Framer (Fundamentals Lesson 20)

Joseph

·

6:30

·

27K views

·

About this lesson

Color styles in Framer have a major trick up their sleeve — the ability to split them between themes for light and dark mode. Which means a single Color Style can dynamically switch theme’s to display based on your visitor's device settings.

If a user’s device is set to light mode, your site loads the light theme. And if their device is set to dark mode, your site automatically loads the dark theme instead.

Let’s take a look at how crazy easy it is to make this happen in Framer.

https://www.youtube.com/watch?v=aR81Mx5a4As&t=0s Intro

https://www.youtube.com/watch?v=aR81Mx5a4As&t=7s How light and dark mode color styles work in Framer

https://www.youtube.com/watch?v=aR81Mx5a4As&t=30s Editing color styles for dark mode

https://www.youtube.com/watch?v=aR81Mx5a4As&t=68s Toggling between light and dark mode on the canvas

https://www.youtube.com/watch?v=aR81Mx5a4As&t=109s Applying dark mode colors to content and surfaces

https://www.youtube.com/watch?v=aR81Mx5a4As&t=163s Why functional names matter for color styles

https://www.youtube.com/watch?v=aR81Mx5a4As&t=198s Publishing and testing theme switching in the browser

https://www.youtube.com/watch?v=aR81Mx5a4As&t=220s Creating static colors that don’t change between themes

https://www.youtube.com/watch?v=aR81Mx5a4As&t=288s Converting a dynamic color style into a static one

https://www.youtube.com/watch?v=aR81Mx5a4As&t=360s Wrap up

🌞 Start for free: https://framer.link/yt

📚 Learn more at: https://framer.link/yt-academy

💎 Join the Community: https://framer.link/yt-community

🎉 Follow on X: https://framer.link/yt-x

0:00color styles and framer have a major0:02trick up their sleeve the ability to0:04split them between themes for light and0:06dark mode which means a single color0:08style can dynamically switch themes0:11based on your visitor's device settings0:13if a visitor's device is set to light0:14mode your site loads the light theme and0:17if their devices set to dark mode your0:19site automatically loads the Dark theme0:21instead let's take a look at how crazy0:24easy it is to make this happen in framer0:30in the previous lesson we looked at how0:31to create color styles and apply them to0:34the properties of layers which is how we0:36ended up with this example project with0:38some color styles that have already been0:40created and applied to the appropriate0:42layers but each time we created a new0:44color style we were technically only0:46defining the color for the light mode0:48theme which is always what will happen0:50by default think of the light mode theme0:52as the base theme it's the dark mode0:55theme that we have to go out of our way0:57to define if and when we decide to do so1:00and we do this one color style at a time1:03when we create or edit a color style we1:05get this little toggle that always1:07starts off in light mode but when we1:09toggle over we can set a different color1:11for dark mode which means every property1:14connected to this color style will be1:16able to swap back and forth but if I1:18play around with the dark mode version1:20of this color we're not getting any1:22visual feedback on the canvas and the1:25reason for that is that the canvas is1:26still set to show us light mode down1:29here we have a little toggle to go1:31between light mode and dark mode and you1:33might have thought that that just1:34toggles the framer UI because the framer1:36UI actually does go from light mode to1:38dark mode but more importantly we are1:40now seeing the dark mode version of all1:42of our color styles directly on the1:44canvas so for my content 100 my highest1:47contrast content I'm going to go all the1:49way up here to White which looks1:52terrible at the moment but give it a sec1:54now let's go down to Content inverted1:57which is the content that is reversed1:59against against our theme before in our2:01light theme it was light so naturally in2:04our Dark theme we'd want it to be dark2:06so I'm going to go all the way to Black2:07on this our content 50 which is our kind2:11of middle gray content I'm actually2:12going to try to leave that alone I'm2:13going to see if that looks okay in both2:15light mode and dark mode so I'm not2:16going to switch that one over but our2:18surface which is our background color2:20here I am going to add a dark mode2:22version and I am going to make that2:24pretty much jet black let's just go jet2:26black to keep things simple and then for2:28surface one I'm I'm going to switch over2:30to dark mode and you'll notice I'm2:31clicking to toggle over to dark mode2:33each time because when you create a2:34color style even if you're looking at2:36dark mode on the canvas it defaults to2:39light mode that is the base version of2:41the color so if you want to create a2:43dark mode version of a color again you2:45have to explicitly go into the dark mode2:47tab here and for this surface which is2:50applied to these cards here I'm just2:52going to go a little bit of a lighter2:54gray and give it kind of a cool tone and2:57now I think we're looking good this2:58whole thing is pretty much much themed3:00for dark mode now you see why I named my3:02colors the way I did in the previous3:04lesson I named them after what they do3:06what their function is within the design3:08rather than the color that they were3:10because the color changed and the name3:12wouldn't make sense anymore between3:13light mode and dark mode now let's3:16actually publish this thing so I can3:17show you what it looks like in the3:19browser I'll open up our little staging3:22link and then here we see dark mode3:24because my computer is actually set to3:26dark mode but if I open up my system3:28settings and head to to the appearance3:30tab when I switch my operating system3:32from dark mode to light mode you'll3:34notice that our site responds instantly3:37and automatically how awesome is that3:41now this result is cool and all but we3:43really kind of took the easy way out and3:45just inverted everything what if we3:47wanted the footer to stay black instead3:50of flipping to White which would also3:51mean the text on the footer should stay3:54white instead of flipping to Black it's3:56an easy fix really we just need a couple3:58of color styles that don't change4:00between light mode and dark mode these4:03are sometimes referred to as static4:04colors so I'm going to head down here to4:07my footer and I'm going to select the4:09frame that has the fill applied to it4:11and I'm going to come down here to the4:12fill and we can see that it is connected4:14to content 100 but again like we talked4:16about in the previous lesson if I make a4:17change up here it'll automatically4:19become detached from the color style and4:21I can choose to create a new style so in4:24this case I'm going to name this static4:27slash static4:30black now the reason I'm calling it4:32static black even though I said not to4:34name the color after the color that it4:36appears to be is because this static4:38black is always going to be black so4:40it's totally cool in this case and I'm4:42going to click create now because I4:44didn't explicitly set a dark mode4:46version of this color it's going to4:48remain the same all of the layers that4:50are attached to this style are going to4:52remain the same whether we're in light4:54mode or dark mode you can see here if I4:56toggle back and forth on the canvas the4:58black stays black5:00I just got to do the same thing for5:01these white layers here so I'm going to5:03select all of these holding the shift5:06key so I can select each one and then5:08I'm going to come down here and for the5:09color of these I'll wiggle this up here5:12to detach it from the style make it5:14white and then I'll come down here to5:15new style and name it static slash to5:18create a folder called Static and I'll5:20name this one static white and when I5:23click create there we go now I have5:25static black and static white and when I5:27toggle back and forth everything that5:29uses the static black or static white5:31doesn't change but what if we've created5:33a dark mode version of a color and we5:35later change our minds and we say you5:36know what I want this to be static5:38instead that's also an easy fix back on5:41the assets panel let's say that content5:4350 that middle gray that I said I didn't5:46want to change in dark mode let's say5:48that I accidentally fiddled with this5:50and now I've got a dark mode color that5:52I don't want at any point on the assets5:55panel I can go to the overflow menu and5:57I can choose clear dark Style now we're6:00back to just having the one static light6:02mode style that will show up in both6:03light mode and dark mode and there you6:06have it now you know how easy it is to6:08create light and dark themes for your6:10color styles and how to be selective6:12about what changes dynamically and what6:14remains static that's it for this one6:17I'll see you in the next one

Watch on YouTube ↗

More in this topic

8 Framer shortcuts you're probably sleeping on4:19
8 Framer shortcuts you're probably sleeping on
Layout & Design3K views · 2 months ago
Framer Update: Stack Sorting and Bento Grids2:16
Framer Update: Stack Sorting and Bento Grids
Framer Update7K views · 2 months ago
Sharing Vector Sets Across Projects (Vectors Lesson 7)3:41
Sharing Vector Sets Across Projects (Vectors Lesson 7)
Layout & Design1K views · 3 months ago
Connecting Vector Sets to the Framer CMS (Vectors Lesson 6)3:38
Connecting Vector Sets to the Framer CMS (Vectors Lesson 6)
Layout & Design2K views · 3 months ago
Animating Vectors in Framer (Vectors Lesson 5)4:25
Animating Vectors in Framer (Vectors Lesson 5)
Layout & Design4K views · 3 months ago
Customizing Vectors with Variables in Framer (Vectors Lesson 4)4:59
Customizing Vectors with Variables in Framer (Vectors Lesson 4)
Layout & Design3K views · 3 months ago
Replace component instances site-wide in Framer1:39
Replace component instances site-wide in Framer
Layout & Design4K views · 4 months ago
Creating and Organizing Vector Sets in Framer (Vectors Lesson 3)6:58
Creating and Organizing Vector Sets in Framer (Vectors Lesson 3)
Layout & Design3K views · 4 months ago

Create a free website with Framer, the website builder loved by startups, designers and agencies.