Luyện nói tiếng Anh bằng Shadowing qua video: Build smarter color systems with relative colors

Đang tạo bài học...
1
Hi there my friend and friend.
2
If you're maintaining separate variables for lighter, darker, and transparent versions of the same color, there's a much better way to work because of CSS relative colors
3
that let us generate all of these variations based on a single value.
4
Let's dive in and see how this works.
5
I got a demo set up for us right here.
6
And we can take a look.
7
So you can see I have some variables set up and I have some, I'm using toast notifications for this
8
because I think it's a nice example of something where we can have multiple variations of this as well
9
and we can look at how we're saving a lot of time.
10
So the very first thing I'm going to do is let's come in
11
and sort of style the generic one and then we'll sort of fancy things up from there.
12
And really quickly there, I just made the font size bigger because I think it'd look better for our demo.
13
So here, let's set things up.
14
I'm going to come in and we're just going to come in on this to start with and do a, I call it toast color and put a color here.
15
And I'm going to use the base color for now.
16
So we're going to say it's our var of base color.
17
And this is going to help us a little bit out, just base like that.
18
This will help us out a little bit later on.
19
This could be a step that we do later.
20
It could even be a step that you skip
21
if this is something that you're only doing one thing of
22
and you don't need a bunch of variations like we're going to have here.
23
Now, next step, I'm going to do something
24
that looks a little bit weird because I'm going to say we're going to color.
25
I'm going to do an HSL from, and this is relative colors.
26
And I'll explain the syntax of this as we write it out.
27
I'm going to say var toast color.
28
And then I'm going to HSL.
29
and nothing really should change actually and I need a semicolon at the end
30
and as you can see nothing really much has changed
31
but what we're saying is the color is an HSL value
32
that is coming from the toast color and this H
33
and S and L are just placeholders for the hue saturation
34
and lightness and we'll see why that's important in a minute just
35
so we can see quickly that this is working
36
if I change this over to my info we're going to see
37
that the color of the text and the border has changed on all of them.
38
The reason the border color is currently changing is because my border is set to two pixels solid, I haven't declared a color, and borders by default will follow the color of the text.
39
But for now I'm going to keep this one as my base
40
and we'll come in with the modifications for the other ones as we go through.
41
Now where this gets a little bit more useful is let's come in with a background color.
42
So background color, I'm going to put this on a different line just
43
so we can keep it all without any horizontal scrolling.
44
I'm going to say HSL from, same thing, my var of toast, you gotta spell toast right,
45
toast color, and space, H space S space L, except this time if I do that I can't read my text.
46
But I want it to always be based on the color of the text.
47
I can just come here and actually change the lightness value.
48
So I can actually say this is at like 15%, except that's going to be really dark.
49
I meant to say something like 85% and go the other way around.
50
And we can have the exact same color, but 85%.
51
And maybe even we can come up to a 90 here, something like that.
52
But we're getting that a little bit of that same color coming in in the background now.
53
And this is cool, right?
54
We're just replacing whatever the lightness was with it being 90% now in our HSL.
55
And just for fun, we can also take this to another level
56
and we can add like a box shadow here as well.
57
So I'm going to actually move, we'll do the box shadow here, box shadow.
58
And again, I'll do this on two lines just so we can see the entire declaration.
59
And let's come in with zero offset, maybe 12 pixels, 12 pixels.
60
I'm going to leave it big for now.
61
Like it really is standing out obviously, but then we can come in with, and this is another really cool thing with our relative colors.
62
So HSL from var toast color and my H, my S, my L, except in this case, it's really dark and I go,
63
oh man, I need a shadow, but I want to lower the opacity of it.
64
We can do that with relative colors, which is amazing.
65
So I just do a forward slash here because this is the way the space separated syntax works in CSS.
66
If you'd like to learn more about that, I talked about it last week.
67
I'll put a link in the description
68
and there might be a card popping up you can check
69
that one out and I'll remind you at the end
70
but I can just come here and say something like 0.25
71
or whatever I want for the lower opacity of that same color
72
and you can see that's working I want to make this a bit more subtle
73
so I'm also going to give it a spread of negative
74
eight just to pull it in a little bit just give
75
us a little subtle shadow underneath each one of those cards
76
or toasts or whatever we want to call them awesome
77
so that's all working now this is where the other cool
78
thing comes in here is I have my info my warning and my error here.
79
And I'm just doing these with data attributes because this would be the easiest way to do it with JavaScript.
80
Especially if you're, you know, instead of using a class here, I think it makes a lot more sense to do it with a data attribute because if you're setting it with JavaScript, you just set it.
81
You don't have to worry about removing the info to put a warning or, you know, you just say if it's this one, the text is going to be coming in probably from JavaScript as well.
82
The whole thing's going to be triggered with JavaScript and you just do the data, what toast is equal to, and you style it that way.
83
So let's come down here
84
and we'll start with the first one where we can say the data toast is equal to info.
85
And because I was set this up with a custom property of toast color, we can just come here and say in this case, my toast color is my, did I call it info?
86
Yeah, I did.
87
Look at that.
88
There we go.
89
So my info comes in.
90
Now there's a bit of a problem here.
91
We're gonna solve that in a second, but let's come in with all three of them.
92
So that's my info.
93
And the last one will be, so info, I forget what I called them, warning and error.
94
So these two, that's a warning.
95
And then I can come on this one and say those are error.
96
And all the colors are coming in.
97
It's looking pretty cool that we can do all of this with a single color and everything is adapting automatically.
98
There's
99
So one problem that's coming in is like the text might
100
be a little bit hard to read depending on what color you're using.
101
Especially like, I don't know, I guess this one's okay, but we could definitely make it better.
102
So what I'm going to do is come back up to where we declared all of this.
103
And over here I want this color to actually always be dark no matter what value I'm using.
104
So maybe I come in with a 20% here for the lightness on the color and then it's going to be, you know, based on the red or based on that orange yellow,
105
but I know it's always going to be darker.
106
my borders have sort of gotten darker too, but we just do the same thing for the border where I never actually declared one.
107
I'm just going to copy and paste to speed things up, and this one will just use the original HSL.
108
And I guess I could, if you're not changing the value, you could just do the Vartos color and not worry about it,
109
and that would work, but this just opens up some extra doors I think.
110
So we have the border color always coming in with sort of the more bright, vibrant version
111
and then the text we can darken maybe 20 is a
112
bit low we could try like a 35 you can play with the number
113
that you want on that to just make sure
114
that it's always something that's decently readable but we can do better
115
and before i let you know how we can do better i just want to let you know
116
that this video is inspired by an article or two articles actually
117
that i wrote for picolily and
118
so i'm going to link to both of those down below
119
they're the pragmatic guide to modern colors discolors in css i
120
think is what we called it uh there's two articles in
121
there the first one is really for people who are copying
122
pasting colors the second one is going a little bit further
123
and diving into a lot more of the manipulations and other things
124
that you can do
125
and just you know we're talking about pick a lily people
126
have been asking me for javascript content for a long time
127
they do have a relatively new course called javascript for everyone and so
128
if you're somebody who's looking to learn more about javascript i definitely would recommend going to check it out
129
and no this is not a sponsored bit i just like spreading the word on good quality content
130
that is out there so check out the course check out those articles
131
if you're interested but now let's look at the other improvement
132
that we can make to this which is
133
while i have all of these set up using hsl rgb
134
hex you know your copy pasting from your design software whatever it is
135
and you're setting these here
136
when using relative colors you can often get a little bit of a better result by using oklch
137
and oklch is a newer it's like it's like came around more recently.
138
But the difference between HSL and OKLCH is as you go through the different hues, it works in a much more consistent way.
139
So what I mean by that really quickly is looking at this demo, I've set these both up with OKLCH and HSL.
140
And if I go through the different hues, as you get to here, you can see like this text becomes harder to read.
141
And it really depends on the color that we're using.
142
When you get to yellows, visually it gets a lot brighter, even though the saturation and the lightness values have stayed the same.
143
And the whole point of the OK LCH in general is to keep
144
that consistency as you're going through the different hues in terms of the perception of the brightness of the colors.
145
And so here's an example of looking at the differences between using, I've set these up exactly the same way, I just took away the gray one.
146
but you have the base toast color coming in and I've set them all up with OK LCH here instead.
147
The border I just set with the base color, like I said, we could do if it's staying the same.
148
But one thing you'll notice here, there's two important things is if I'm doing OK LCH on the outside here, I do need to use the LCH values.
149
So LCH instead of an HSL and the lightness being the first one now.
150
and I've done a little bit of extra math in here
151
for the background color to change the chroma a little bit
152
but you can see there's a little bit more consistency between the colors coming in
153
when I'm using the OKLCH versus using the HSL here with
154
the the border color is perceptually looks similar the vibrancy of
155
the color of the background looks much more similar whereas here
156
like the difference in the border color especially I find with
157
this one coming through the border looks much more faded out compared to the blue
158
which one is popping so much more
159
when I'm using the HSL it's not something
160
that a lot of users are going to notice
161
but by using OKLCH even though my base color is set to an HSL
162
or whatever you know hex or RGB it doesn't really matter by using the OKLCH throughout
163
and having my toast colors all set through an OKLCH rather than using an HSL and modifying it that way,
164
you just get a little bit more consistency between the different colors that are being generated for you.
165
So if you enjoyed this video, if you do want a bit of a primer on the space separated syntax, like I mentioned, that video should be showing up on the screen somewhere right now.
166
And also if you want to dive deeper into all of this, do go and check out those two Piccadilly articles and maybe their courses as well.
167
And with that, I would like to thank my enabler of awesome, Johnny, as well as all my other patrons and channel members for their monthly support.
168
And of course, until next time, don't forget to make your corner of the internet just a little bit more awesome.

Tại sao nên luyện nói với video này?

Trong video này, người nói đã giới thiệu cách làm việc thông minh với hệ thống màu sắc tương đối trong CSS. Điều này không chỉ giúp tiết kiệm thời gian mà còn thúc đẩy sự sáng tạo trong thiết kế. Khi bạn luyện nói theo video, bạn không chỉ cải thiện khả năng phát âm tiếng anh chuẩn mà còn nâng cao kỹ năng ngôn ngữ của mình bằng cách hiểu sâu sắc hơn về cách diễn đạt ý tưởng trong thực tế. Hãy tưởng tượng bạn có thể thảo luận về màu sắc và thiết kế mà vẫn giữ vững ngữ điệu và cách phát âm đúng. Điều này cực kỳ quan trọng trong mọi cuộc trò chuyện về nghệ thuật và công nghệ.

Cấu trúc ngữ pháp & Biểu thức trong bối cảnh

Người nói trong video đã sử dụng một số cấu trúc và biểu thức hữu ích mà bạn có thể áp dụng khi nói tiếng anh. Dưới đây là một vài điểm nổi bật:

  • “Let's dive in and see how this works.” - Cách nói này cho thấy sự hào hứng và mong chờ khám phá điều mới.
  • “I can actually say this is at like 85%.” - Câu này thể hiện sự không ngần ngại khi điều chỉnh thông tin, rất hữu ích khi bạn cần diễn đạt giả định hoặc ước lượng.
  • “I'm going to do something that looks a little bit weird.” - Cách diễn đạt này giúp tạo ra sự cởi mở và thân thiện trong giao tiếp, khuyến khích người nghe tham gia.

Khi luyện nói với những cụm từ này, bạn sẽ trở nên tự tin hơn trong việc diễn đạt ý kiến và cảm xúc của bản thân.

Các bẫy phát âm thường gặp

Trong video, có một số từ hoặc cách phát âm có thể gây khó khăn cho người học tiếng anh, bao gồm:

  • "HSL": Đây là viết tắt của hue (màu sắc), saturation (độ bão hòa) và lightness (độ sáng). Có thể gây nhầm lẫn khi phát âm nhanh.
  • "toast color": Khi nói nhanh, có thể khó nghe rõ ràng nếu bạn không chú ý đến cách phát âm các âm tiết.
  • "transparent versions": Từ này có âm tiết "trans" khá nhấn mạnh, cần luyện nhé để tránh bị phát âm sai.

Khi luyện nói tiếng anh bằng cách shadowing video, bạn cần chú ý đến các âm tiết này để phát âm tiếng anh chuẩn hơn. Sử dụng phần mềm shadowing cũng là một cách tuyệt vời để cải thiện khả năng phát âm của bạn.

Phương Pháp Shadowing Là Gì?

Shadowing là kỹ thuật học ngôn ngữ có cơ sở khoa học, ban đầu được phát triển cho chương trình đào tạo phiên dịch viên chuyên nghiệp và được phổ biến rộng rãi bởi nhà đa ngôn ngữ học Dr. Alexander Arguelles. Nguyên lý cốt lõi đơn giản nhưng cực kỳ hiệu quả: bạn nghe tiếng Anh của người bản xứ và lặp lại to ngay lập tức — như một "cái bóng" (shadow) đuổi theo người nói với độ trễ chỉ 1–2 giây. Khác với luyện ngữ pháp hay học từ vựng bị động, Shadowing buộc não bộ và cơ miệng phải đồng thời xử lý và tái tạo ngôn ngữ thực tế. Các nghiên cứu khoa học xác nhận phương pháp này cải thiện đáng kể phát âm, ngữ điệu, nhịp điệu, nối âm, kỹ năng nghe và độ lưu loát khi nói — đặc biệt hiệu quả cho người luyện IELTS Speaking và muốn giao tiếp tiếng Anh tự nhiên như người bản ngữ.