Hi everyone. In this video we are going to look at light mode and dark mode. Okay? It means that we can select a frame and say, you my friend, are now the color of light mode. Nope, you're dark mode and it goes and changes everything inside the frame. To do it.
We need to learn what a collection is and what a mode is. They're not particularly hard. So let's jump in and make this awesomeness happen. I love it. Oh, dark mode. Light mode, dark mode.
Light mode. Okay, to get this started, I have got just a couple of bits of text. There's nothing going on in an image, okay? Uh, the first thing I want to do is have nothing selected. Let's go to our local variables, okay? And we are going to realize that we have already got our first collection.
So we're talking about collections and modes, right? Collection. Just think of as, as a group of different rules at the moment, we've got this one called collection one. Okay? I'm gonna rename it and just call general, okay? Uh, my junk drawer of stuff I want, okay?
But there's more specific, um, collection that I want to do with colors. We'll do another one for sizes in a bit. Those are all different collections. So I'm gonna say let's create a new collection. It's called this one. Uh, colors American New Zealand.
Okay? So we put use in everything, um, and we're gonna create a variable, okay? And we're gonna start with this color variable. Okay? So just to reiterate, we've got collections, we've now got two, a general one that was doing our totals and our cart switching. And now we've got color and you'll end up with a few different collections.
Okay? So I'm gonna go to this one. Uh, we're gonna name this first color, okay? And we, when you're naming these, if you're gonna use variables to change colors and it's kind of like styles, they do a lot of the same thing. Um, you can use the same naming convention. So this one's gonna be my primary, uh, primary color, but we'll do text primary, okay?
So this is my primary text color. What color is it gonna be? I am going to use a dark color. I've kept this green so we can see it change. So I'm gonna use, ah, dark gray. Okay?
So that's gonna be my value for primary text. Now we've done collections, we know what variables are, but what's this button? Okay, because wait, I keep clicking it by accident. Lemme get this extra category. These are the modes. So mode one, mode two, okay, this one here is gonna be my light mode, okay?
And you can't tab across yet, but this one here is going to be dark mode. Oh, it's getting exciting. Okay, so here I'm gonna say where my text, I'm just using this one definition text, okay? And I'm gonna apply it to this text here. But there's two different modes that I can switch between. Okay?
So I'm gonna have light mode and dark mode. Light mode is just gonna be light text E, okay? And that's the first part. So collections, different modes. Modes can be lots of different options. It could be small and medium sizings, okay?
In terms of maybe spacing and padding. Okay? So let's close that down. And what I wanna do is first apply it. So I'm gonna say you have got the fill color of, I'm gonna go to my styles panel and it's kind of, you know, bumped into all the SI styles. They haven't really separated it nicely yet.
And this might look different on yours, but there we go. Text primary boom, you text primary as well. So you're adding it to the things you want to be able to switch between modes. Then how do you switch it? Okay? So it's applied, but it's in light mode, right?
So that darker color, how do we get it to go to that white color dark mode you select on it, go to the layers panel. So layers will have this little icon here, okay? We can change the variable mode that only appears once you've got modes. Okay, there it is. There's color and ready set. Dark mode.
Exciting, eh, eh, make it more exciting Dan. Okay, so I'm gonna back out of that. What we can do is I'm gonna, I should have made this before we started. Let me quickly turn this into an auto layout shift A, then I'm gonna make another auto layout that combines these two shift A. There we go. 'cause I want the spacing and stuff to be played with.
All right, so we've got this, we could do it to this whole parent frame and change it and it would look through everything that has a mode applied to it and try and change it from light mode to dark mode. So got the parent selected, okay? Which in my case is called frame two. It's gonna make it called card. And same place. Go to your layers panel.
There it is there. Okay? Color and everything inside of here should go dark mode. Look at that. Let's make it even better. Okay?
We want the background to change as well, so we can actually read that text. So what we'll do is two things. Let's, uh, escape, escape, escape so that we can see local variables. We've only got one color, color here. Let's add not another mode. That's what I want to click every time.
It's this one down here. Let's add another color variable. Okay? So we're getting there, right? We've learned color number bullion. Okay, let's give this one a name.
So we're gonna do interface and uh, face. Sometimes it's called surface, okay? I'm calling mine interface primary. Okay? And I can use that once, but I've got two different options for it. I'm going to pick, I don't know, dark purple for my light mode.
Nope, that's for dark mode. Okay? So I'm gonna use just uh, off white. Okay? And this one's gonna be darker. There we go.
So two different options that is nicely contrasted against that. And the text is nicely contrasted against the interface background. So let's apply it. What do we apply it to? Let's do it to this auto layout frame. So you have a background fill of using the little symbols.
Um, picker. Okay, I'm gonna use interface. Great. Let's give it some 16 by 16 padding. Okay? And are you ready?
Okay, we can say you my friend are going to be layer panel. This whole thing inside of it is gonna be dark mode. Prepare yourselves. Ah, I'm excited. Are you excited? Doesn't me?
Ah, it's new stuff. I like it. Super awesome. Gets even better. Let's undo that. Okay, what happens is it defaults here?
Can you see it just defaults to whatever the first mode is. So it's Defaulted to light mode. Okay, whatever the first one was. Okay, so it's actually got a mode applied to it. Okay, so if I have two of these or three of these and what if I could grab the whole frame and just say layer is now dark mode, way cool. A all right, so the things to remember is local variables.
I have got collections now. Okay, we've got more than one. We had collection that we're renamed general and we've got this new one called color. We added a variant to it and we added an extra mode. So collections are just basically groups. Modes are things that we can change between, we can give the object, like in this case a color, one name, okay?
A token to say you are text primary, but it has other functions that we can toggle between. From there you go and apply those colors to the things that you want to apply it to. And then the parent frame, whether it's the text box, uh, the auto layout that's just above it, or the one that's surrounding it, or in our case the whole phone, you can then go to layer and then switch between the different modes. Alright, good work team. Let's do another version of that in the next video.