ConsoleColorText 10.0
Comprehensive Utility Library for changing the color of text and background of a python console.

# ConsoleColorText Max-Loaded
#### This module is used to change the color of text and background of the python console designed for *Windows Operating System.*
___
___
# What's New ?
### => Easier importing of functions.
### => Functions updated to work with Dictionaries.
### => 4 more functions added.
### => Automatic package installation for unavailable libraries.
### => Arguements are Case Insensitive.
### => Increased error tolerance.
___
___
# Importing Functions:
#### `from ConsoleColorText import *` statement is used to import all necessary functions from Color_Console module.
### This version contains the following functions which we'll be discussing shortly.
#### $ __color()__
#### $ __ctext()__
#### $ __transTime()__
#### $ __hackerMan()__
#### $ __help()__
___
___
# Color()
#### **`color()`** is used to change the text color and background color of the whole python console.
#### **`color ( text = "bright white" , bg = "black" , delay = 0.67 ,repeat = -1 , dict = {} )`** is the function header.
#### **`text`** is used to specify the color of the text.
#### **`bg`** is used to specify the color of the background.
## The permitted colors are:
#### 1.  *Black*
#### 2.  *Blue*
#### 3.  *Green*
#### 4.  *Aqua*
#### 5.  *Red*
#### 6.  *Purple*
#### 7.  *Yellow*
#### 8.  *White*
#### 9.  *Gray*
#### 10. *Light Blue*
#### 11. *Light Green*
#### 12. *Light Aqua*
#### 13. *Light Red*
#### 14. *Light Purple*
#### 15. *Light Yellow*
#### 16. *Bright White*

### **None of the arguements are case sensitive. Text color and background color cannot be the same.**
___
#### If a _**list**_ of permitted colors is passed to either **`text`** or **`bg`**, the colors change in accordance to their position in the list.
```python
# Constant background color with altering text color:
li = [ 'black','bright white' ]
print("Hello World !")
color( li , 'aqua' )
# This will make the text color of the console change to black and bright white alternatively and indefinitely
# with it's background color set to aqua
```
```python
# Constant text color with altering background color:
li = [ 'black','bright white' ]
print("Hello World !")
color( 'aqua' , li )
# This will make the background color of the console change to black and bright white alternatively and indefinitely
# with it's text color set to aqua
```
___
#### **`delay`** parameter is used to specify the time between two transitions. The **default value is set to 0.67 seconds** which can be changed.
```python
# Changing color transition time:
li = [ 'black','bright white' ]
print("Hello World !")
color( 'aqua' , li , delay = 1 )
# and hence the color transition would take 1 second.
```
___
#### **`repeat`** parameter is used to specify the number of times the list of colors has to be repeated. The **default value is -1** which makes the color transition occur indefinitely. Note that if color transition is set to indefinite, the program will not move further ( The code next to it will not be executed ! ). **`repeat`** parameter would allow the code to proceed once the list is iterated the given number of times. Time taken for this is dependent on both **`delay`** and **`repeat`**.
```python
# repeating the color transition only certain number of times
li = [ 'black','bright white' ]
print("Hello World !")
color( 'aqua' , li , delay = 1 , repeat = 2 )
# The transition will be repeated two times with a time delay of 1 second each and hence would take 4 seconds
# since the number of elements in the list is 2.
```
#### Total time required to complete transition can be found out by using **`transTime()`** which will be explained later.
#### **`delay`** and **`repeat`** are optional parameters.
___

#### When the parameters of both "text" and "bg" are lists, the color transition is as follows:
```python
# When both text and bg recieve arguements that are of list type,
# the corresponding text and bg colors are used as they are iterated
print("Hello World")
color( ['green','blue'] , ['black','bright white'] )
# This would result in a console with the following text and bg color which repeats indefinitely
# green text color with black as bg color
# blue text color with bright white as bg color
```
#### **Note that if the size of two lists are different, an error will be thrown.**
___
#### A dictionary with valid color combinations can be passed to **`dict`** to get an output similar to the previous one using two lists.
```python
# Passing dictionary to color()
Dictionary={
'green' : 'black' ,
'blue' : 'bright white'
}
color( dict = Dictionary )
# This output is similar to the previous one.
```
#### **Limitations in passing a dictionary:**
#### A color in the key cannot be present in the value. So Don't mix the keys and values in a dictionary.
#### _Reminder:_ *`dictionary ={ key1 : value1 , key2 : value2 }`* _Dictionary consists of key:value pairs_
```python
Dictionary={
'green' : 'black' ,
'black' : 'bright white'
}
print("Hello World")
color( dict=Dictionary )
# This code would throw an error since 'black' is both in keys and values of the dictionary.
```
```python
Dictionary={
'red'   : 'bright white',
'black' : 'bright white'
}
print("Hello World")
color( dict=Dictionary )
# This code wouldn't throw an error since 'bright white' is only values and not in keys of the dictionary.
```
### **Thus repetition of colors is allowed but intermixing of keys and values of a dictionary are not permitted!**
___
___
# ctext()
#### **`ctext()`** is used to change the text and background color of only one line in the python console.
#### **`ctext( String , text = "white" , bg = "black" , delay = 0 , repeat = 1 , dict = {} )`** is the function header.
#### **`String`** is used to send the required string to be colored.
#### **`text`** is used to specify the color of the text.
#### **`bg`** is used to specify the color of the background.
___
## The permitted colors are:
#### 1.  *Blue*
#### 2.  *Green*
#### 3.  *Red*
#### 4.  *Magenta*
#### 5.  *Yellow*
#### 6.  *White*
#### 7.  *Cyan*
#### 8.  *Black* **only for background**
### **None of the arguements are case sensitive. Text color and background color cannot be the same.**
___
> **Note:**
>     _**`ctext()`** **requires two modules namely** **`colorama` and `termcolor`** **to work.
>     Whenever you run ctext, the presence of these two modules are verified and imported automatically. If absent these two modules are automatically installed via pip. In such a case, good internet connection is recommended. If the installation process fails even in the presence of internet(the program will notify you!), try installing these two modules via pip manually.**_
___
## Similarities between ctext and color:
#### **Parameters like `text`, `bg`, `delay`, `repeat` and `dict` work in a similar manner with slight exceptions which will be discussed later.**
___
## Exceptions:
#### **`String`** parameter takes a string as an arguement and this line alone is printed with different colors as instructed by text and bg parameters. Passing a string alone to **`ctext()`** would be similar to **`print()`** statement.
#### **`String` parameter is a mandatory one and should not be omitted"**
```python
ctext("Hello World","Green",'white') # This would affect only this line unlike color()
ctext("Hello World") # This statement is similar to print()
```
___
#### **The permitted colors are different for `color()` and `ctext()` and they were already mentioned above**
___
#### **`delay`** refers to the time between printing consecutive statements in a list. When a list is passed to text or bg, the **`String`** is printed in the respective colors one after the other depending on **`repeat`** parameter. The default value of **`delay`** is set to **0 units** and **`repeat`** is set to **1**
___
___
# transTime()
#### **`transTime`** is used to find the total time required to complete all color transitions. Only after all the transitions are complete, the code following **`color()`** or **`ctext()`** will be executed.
#### **`transTime( n , delay , repeat , print = True )`** is the function header.
#### Either the 'number of colors in the list or dictionary' or 'the list and dictionary itself' can be passed to **`n`**.
#### **`delay`** parameter takes the delay value you are planning to use.
#### **`repeat`** parameter takes the delay value you are planning to use.
#### This function both prints and returns the total transition time. Not using the return value will not throw an error.
#### **`print`** is an optional parameter which is set to True by default. If this is changed to False, **`transTime()`** would only return a value and not print anything on the console.
```python
Dictionary = {
'red'   : 'bright white',
'black' : 'bright white'
}
li = ['red' , 'black']
number_of_elements = 2
transTime(Dictionary,1,3)
transTime(li,1,3)
transTime(number_of_elements,1,3)
# All this will result in the same output "Total time required = 6 units" and return 6
time = transTime(li,1,3,print=False) # This will only return a value and not print anything else
print(time) # This would print "6"
```
___
___
# hackerMan()
#### This function is added just for fun in case if you wish to look like a hacker amongst your friends.
#### This would make the text color 'green' and background 'black'.
#### This takes no arguements. Just add this function at the beginning of your program !
```python
hackerMan()
print("ipconfig /flushdns")
print("ping www.google.com")
print("tracert www.google.com")
print("bruteForce -library='n10' someone's_mail@gmail.com")
# All these statements will be printed in green with black background.
```
___
___
# help()
#### **`help()`** will provide you the same information in a python console offline
#### **`help( c = True )`** is the function header.
#### If you use **`help()`** the text and background will start changing automatically based on a predefined instruction of colors after 30 seconds. If you find it disturbing, you can use **`help(False)`** to shut down the color transitions and display instructions in default color.
___
___
#             Developed by SAYAD PERVEZ
#             Email-Id : pervez2504@gmail.com
___
___