1
00:00:04,100 --> 00:00:08,300
Now after installing, how can we use a package?

2
00:00:08,450 --> 00:00:14,840
Well, package usage depends on the implementation by the author.

3
00:00:15,020 --> 00:00:18,020
So always you need to read the documentation.

4
00:00:18,020 --> 00:00:19,820
How is being used?

5
00:00:19,820 --> 00:00:25,850
Because usage of a package varies depending on the type of a package.

6
00:00:26,060 --> 00:00:29,600
So always it follow the same format.

7
00:00:29,660 --> 00:00:32,590
They give us a sample of usage here.

8
00:00:32,990 --> 00:00:40,140
So the first step is we need to require the package so we copy this one and then get back to visualizing

9
00:00:40,160 --> 00:00:40,910
the code.

10
00:00:40,910 --> 00:00:48,680
And next is we need to create a file for this so this one we can make it up to JZ or index to JZ.

11
00:00:48,680 --> 00:00:56,300
But for me I always use several dot g's now because I install it as def dependencies.

12
00:00:56,300 --> 00:01:00,260
I have this file, so let me remove that and now let me stick to this.

13
00:01:00,650 --> 00:01:08,690
So now it's time to require the package so const and then uppercase color, that is the implementation.

14
00:01:08,690 --> 00:01:18,350
You can see that is uppercase color and then equal to require the package and the name of the package

15
00:01:18,350 --> 00:01:19,550
is called color.

16
00:01:20,000 --> 00:01:26,660
We are able to get this color because it is inside the node module, which is this one and this what

17
00:01:26,660 --> 00:01:28,100
we are requiring here.

18
00:01:28,730 --> 00:01:31,820
So now let's see how we can use the package.

19
00:01:31,820 --> 00:01:35,090
Well, you have given us a sample here.

20
00:01:35,120 --> 00:01:42,770
First of all, after requiring this package, then we pass in any color and then the alpha channel we

21
00:01:42,770 --> 00:01:46,100
want, and then how the brightness of the color.

22
00:01:46,100 --> 00:01:51,500
And then we can console.log and use any color method and we are good to go.

23
00:01:51,590 --> 00:01:54,290
So let's see how we can generate random colors.

24
00:01:54,290 --> 00:01:56,450
So here generate.

25
00:01:57,560 --> 00:01:58,730
Random.

26
00:01:59,660 --> 00:02:00,500
Colors.

27
00:02:00,500 --> 00:02:02,240
So here we go.

28
00:02:02,690 --> 00:02:10,729
After this one, we are going to assign to a variable called color, which is equal to the color object

29
00:02:10,729 --> 00:02:19,160
as we got and start and then we pass in any color value, it can be hex color, it can be any color

30
00:02:19,160 --> 00:02:20,060
of your choice.

31
00:02:20,390 --> 00:02:26,390
So here we pass in a color that we want to get random colors out of it.

32
00:02:26,390 --> 00:02:35,930
So let's use seven seven for three and then see that a color for three like that.

33
00:02:36,140 --> 00:02:46,670
And then on that I want to have the alpha channel for this color and 0.5, 0.5 and the lighting of this

34
00:02:46,670 --> 00:02:49,550
color, let's also provide 0.5.

35
00:02:49,550 --> 00:02:52,160
These are from the documentation.

36
00:02:53,030 --> 00:02:56,900
So let's go ahead and generate a color from this.

37
00:02:56,900 --> 00:03:01,220
So const, let's say single color.

38
00:03:03,700 --> 00:03:06,160
And is equal to.

39
00:03:06,400 --> 00:03:10,030
So for this I want generate a hassle.

40
00:03:10,060 --> 00:03:15,760
And then as a method on that I need to convert everything to string as that.

41
00:03:15,760 --> 00:03:20,440
So let's go ahead and then console.log the single color.

42
00:03:20,800 --> 00:03:23,590
So now let's start a server.

43
00:03:24,430 --> 00:03:25,420
And let's see that.

44
00:03:25,420 --> 00:03:31,720
Now we see that for this hex color, we're able to get this color from that.

45
00:03:31,720 --> 00:03:33,790
And this is what we have.

