Fire - Adding Colors with TermColor

Building Command Line Tools with Python, Julia and Nodejs Module 02 - Building Command Line Tools in Python with Google's Fire
6 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€65.78
List Price:  €93.98
You save:  €28.19
£56.19
List Price:  £80.28
You save:  £24.08
CA$96.65
List Price:  CA$138.08
You save:  CA$41.42
A$109.01
List Price:  A$155.74
You save:  A$46.72
S$95.37
List Price:  S$136.25
You save:  S$40.88
HK$548.06
List Price:  HK$782.98
You save:  HK$234.91
CHF 63.79
List Price:  CHF 91.14
You save:  CHF 27.34
NOK kr768.84
List Price:  NOK kr1,098.40
You save:  NOK kr329.55
DKK kr490.83
List Price:  DKK kr701.21
You save:  DKK kr210.38
NZ$118.45
List Price:  NZ$169.22
You save:  NZ$50.77
د.إ257.03
List Price:  د.إ367.20
You save:  د.إ110.17
৳7,684.20
List Price:  ৳10,977.89
You save:  ৳3,293.69
₹5,855.32
List Price:  ₹8,365.11
You save:  ₹2,509.78
RM335.35
List Price:  RM479.10
You save:  RM143.74
₦84,069.65
List Price:  ₦120,104.65
You save:  ₦36,035
₨19,482.60
List Price:  ₨27,833.48
You save:  ₨8,350.88
฿2,577.20
List Price:  ฿3,681.88
You save:  ฿1,104.67
₺2,276
List Price:  ₺3,251.57
You save:  ₺975.56
B$370
List Price:  B$528.60
You save:  B$158.59
R1,331.99
List Price:  R1,902.92
You save:  R570.93
Лв128.63
List Price:  Лв183.76
You save:  Лв55.13
₩96,774.91
List Price:  ₩138,255.79
You save:  ₩41,480.88
₪263.45
List Price:  ₪376.37
You save:  ₪112.92
₱4,005.56
List Price:  ₱5,722.47
You save:  ₱1,716.91
¥10,822.37
List Price:  ¥15,461.20
You save:  ¥4,638.82
MX$1,188.83
List Price:  MX$1,698.40
You save:  MX$509.57
QR255.45
List Price:  QR364.94
You save:  QR109.49
P967.75
List Price:  P1,382.56
You save:  P414.81
KSh9,273.67
List Price:  KSh13,248.67
You save:  KSh3,975
E£3,415.20
List Price:  E£4,879.07
You save:  E£1,463.86
ብር3,983.99
List Price:  ብር5,691.67
You save:  ብር1,707.67
Kz58,616.62
List Price:  Kz83,741.62
You save:  Kz25,125
CLP$68,622.39
List Price:  CLP$98,036.19
You save:  CLP$29,413.80
CN¥506.62
List Price:  CN¥723.78
You save:  CN¥217.15
RD$4,136.69
List Price:  RD$5,909.81
You save:  RD$1,773.12
DA9,432.45
List Price:  DA13,475.51
You save:  DA4,043.05
FJ$159.25
List Price:  FJ$227.51
You save:  FJ$68.26
Q544.58
List Price:  Q778.01
You save:  Q233.42
GY$14,660.07
List Price:  GY$20,943.86
You save:  GY$6,283.78
ISK kr9,900.78
List Price:  ISK kr14,144.58
You save:  ISK kr4,243.80
DH712.14
List Price:  DH1,017.39
You save:  DH305.25
L1,250.72
List Price:  L1,786.82
You save:  L536.10
ден4,047.46
List Price:  ден5,782.34
You save:  ден1,734.87
MOP$564.82
List Price:  MOP$806.92
You save:  MOP$242.10
N$1,331.20
List Price:  N$1,901.80
You save:  N$570.60
C$2,577.12
List Price:  C$3,681.76
You save:  C$1,104.64
रु9,367.18
List Price:  रु13,382.26
You save:  रु4,015.08
S/261.74
List Price:  S/373.93
You save:  S/112.19
K265.15
List Price:  K378.80
You save:  K113.65
SAR262.54
List Price:  SAR375.07
You save:  SAR112.53
ZK1,755.70
List Price:  ZK2,508.25
You save:  ZK752.55
L327.30
List Price:  L467.60
You save:  L140.29
Kč1,658.88
List Price:  Kč2,369.93
You save:  Kč711.05
Ft25,827.61
List Price:  Ft36,898.16
You save:  Ft11,070.55
SEK kr766.20
List Price:  SEK kr1,094.62
You save:  SEK kr328.41
ARS$60,803.53
List Price:  ARS$86,865.91
You save:  ARS$26,062.38
Bs485.55
List Price:  Bs693.67
You save:  Bs208.12
COP$273,550.12
List Price:  COP$390,802.63
You save:  COP$117,252.51
₡35,067.63
List Price:  ₡50,098.77
You save:  ₡15,031.13
L1,728.60
List Price:  L2,469.54
You save:  L740.93
₲518,508.49
List Price:  ₲740,758.16
You save:  ₲222,249.67
$U2,722.73
List Price:  $U3,889.78
You save:  $U1,167.05
zł286.18
List Price:  zł408.85
You save:  zł122.66
Already have an account? Log In

Transcript

All right, so welcome back again. So in the previous tutorial we saw how to work with fire and to see the abuse we could, we could work with position argument and as well as a fragment, and let's see how to add colors to your fasciae. So I've already created a file called color underscore CLA copy the same thing we did. And unless you have to, okay so the most important thing you need is that you can use colorama or you can use temple but let's go with the temple. So to install it just go with PIP three install colorama case you want to use colorama or go with Tim color by sube using damn color to 10 color it's very nice to be trying to use. Now let's see how to work with 10 color.

So the simplest way is to input Tim color would be from Tim color, input color. And then we also have another function for C right which is colored print to the benefit is for adding colors using 10 colors. Just going to go into a colored Then go to passing your test, then you're going to pass in your foreground color, your background color, and then you attribute. So attributes must always be in the format of a list. So based on the opinions you're using, if you're on a unit basis, then there is support for reverse. There's support for blink.

Boat is about them. But if you're on Windows, some of these things are not supported Lincoln bold and the rest of us put it all your best support indicator, you can reduce the steps. So that is the basic syntax for adding colors to your CLA using 10 color right there is going to be the format for this document. So let's see how to add color to our grid function. So I'm just going to add a color by coming in passing it here to call it to this entire stuff here. It's going to be our test right for this particular test that you have.

Then the next option is going to be the foreground which can be And then cut out the background in it so let's quickly before gone fully go into spot lotion and come back that's finishing stolen perfectly. So we're going to go with Python three they don't know they can't see tool three. Enough I see my colors yellow. That's Dutch says hope to see whether everything is working as expected. So medium stick somewhere we did dif here with how to create it with this option to close it to let's run it again. clear the screen and not destroyed.

If we run it you're going to see the various result is going to give to us so if so we have the greeting we have our C but to be able to get the greet and to show the color suggests run it is same format. We have our greet then I'll pass in the name the agent agenda. So let's go into the Bushido format. So in Name is going to be GC. And then the HPC 24. And an agenda is going to be, right, who is visible, because if I run this one, I would see that UML was the colored one should write to me to show our blue color where they stood as the big idea of adding colors to it.

So the simplest format is just to call the call it and then you just pass in your foreground color, in case you want to add a background color is good, the same thing is going to be on white, right, so there certainly are seven of them which are being supported. So we have on white to be blue on white, there's going to give us a blue color. So if I come back to Claire on the same thing, and now this could be your cameo, it's going to be your meal with blue on white, right? That is the basic idea. So to add a blue color to it, continue the same thing. Repeat it for the red.

So let's copy. Same thing here as we call it. Just as we did above, good to make it easy read then on sign or on blue or something, right? This is going to give us stuff, okay? This must be their format you can't change it is very, very strict. You can't change contest, you cannot bring the assembly before you're ready to make a comeback.

Can I run it again, we're supposed to close our fashion. Let's run again that you Jesse is now in blue, red and blue, right? Because red is the red one. And then the blue is behind is the basic idea. If you change it from, let's say this to on blue and then this one becomes red. It's still going to give us an arrow right?

It is very, very strict with the order. So the focus Just as a synthesis, so basically of this lecture and again, that's given us an error, right Suki arrow. So the format and the sentence, it's very, very important, it might be the test, the foreground, and then the background before you add attribute. So let's see Dennis attributed to a new ad to put to change this one. And then let's add an attribute of the attributes to it. Not passing the race.

So this is the only one that is supported on Windows. But on Unix based system, like Linus and Macintosh, the rest are supported. So I'll come back to the same thing could have this run, it's good to see that that's reversed. It's so nice read in a nice blue, right, it's going to reverse the color. So red, and then blue. If you check this one, because it has an underrated background, right?

And then the blue is a foreground, right? it reverses it because we set that attribute to reverse. Very interesting Kevin used to blanket but he reduces supported. Okay, so that is how to add colors to each one, this format is quite nice, but it can be confusing, right? print color. So there's a simple format of this, the printer did a combination of the color print.

So instead of doing the same thing here, can you think of this and then go with the C print. The sequence means colored print combination on the print in a college if I see an option, and if I run it, it's going to give us the same result. So just it's giving you the same result. As above. That is the basic idea. So the secret is quite easy to use.

You just call this you print them just do the same thing that you'd have done above, or the basic idea about how to add colors to pasty light as well as et CIE that Shambo didn't even understand no package. Thank you for watching, and see you next session. stateless

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.