Skip to content

Commit

Permalink
Merge branch 'release/3.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jramrath committed Oct 25, 2023
2 parents c62fad8 + 3879285 commit 2e27216
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 29 deletions.
48 changes: 22 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,37 @@ print(textColor.yellow("YELLOW")) # 'YELLOW' will be yellow

You can also use special 'pre-fixes':
```
print(textColor.input("Name: ")) # will output '[?] Name: ' while '[?]' is yellow
print(textColor.prompt("Name: ")) # will output '[?] Name: ' while '[?]' is yellow
print(textColor.info("Info")) # will output '[-] Info' while '[-]' is blue
print(textColor.error("ERROR")) # will output '[!] ERROR' while '[!]' is red
print(textColor.output("Success")) # will output '[>] Success' while '[>]' is green
```

If you dont' want to type input()/print() you can use the 'print functions':
```
textColor.pPromt("Name: ") # will call input("[?] Name: ") and return
# the output, while '[?]’ is yellow
textColor.pInfo("Info") # will output '[-] Info' while '[-]' is blue
textColor.pError("Error") # will output '[!] ERROR' while '[!]' is red
textColor.pOutput("Success") # will output '[>] Success' while '[>]' is green
```


# License

This library was published under the **GNU General Public License**. For more information take a look at the **LICENSE** file.


# Uploading to PyPi

More info [here](https://packaging.python.org/en/latest/tutorials/packaging-projects/).

Remove all old distribution files in 'dist/'

Make sure you have the latest version of 'build':

> python3 -m pip install --upgrade build
In the same directory as 'pyproject.toml':
If those function names seem too long, you should use abbreviations:
```
green ––> g
red ––> r
blue ––> b
yellow ––> y
> python3 -m build
error ––> err
output ––> out
Now that the distribution files have been generated, make sure twine is up to date:
pError ––> pErr
pOutput ––> pOut
```

> python3 -m pip install --upgrade twine

Again, in the same directory as 'pyproject.toml':
# License

> python3 -m twine upload dist/*
>
> username: \_\_token__
>
> password: \<API token from pypi>
This library was published under the **GNU General Public License**. For more information take a look at the **LICENSE** file.
Binary file removed dist/textcolor-3.0.1.tar.gz
Binary file not shown.
Binary file not shown.
Binary file added dist/textcolor-3.1.0.tar.gz
Binary file not shown.
25 changes: 25 additions & 0 deletions docs/PyPi-upload.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Uploading to PyPi

More info [here](https://packaging.python.org/en/latest/tutorials/packaging-projects/).

Remove all old distribution files in 'dist/'

Make sure you have the latest version of 'build':

> python3 -m pip install --upgrade build
In the same directory as 'pyproject.toml':

> python3 -m build
Now that the distribution files have been generated, make sure twine is up to date:

> python3 -m pip install --upgrade twine
Again, in the same directory as 'pyproject.toml':

> python3 -m twine upload dist/*
>
> username: \_\_token__
>
> password: \<API token from pypi>
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "textColor"
version = "3.0.1"
version = "3.1.0"
authors = [
{ name="Jannik Ramrath", email="[email protected]" },
]
Expand Down
81 changes: 79 additions & 2 deletions textColor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,113 @@
###


def green(text, whiteText="", space=True):
if space:
return "\033[1;32;49m" + str(text) + " \033[0;37;49m" + str(whiteText)
else:
return "\033[2;32;49m" + str(text) + "\033[0;37;49m" + str(whiteText)


def red(text, whiteText="", space=True):
if space:
return "\033[1;31;49m" + str(text) + " \033[0;37;49m" + str(whiteText)
else:
return "\033[1;31;49m" + str(text) + "\033[0;37;49m" + str(whiteText)


def blue(text, whiteText="", space=True):
if space:
return "\033[1;34;49m" + str(text) + " \033[0;37;49m" + str(whiteText)
else:
return "\033[1;34;49m" + str(text) + "\033[0;37;49m" + str(whiteText)


def yellow(text, whiteText="", space=True):
if space:
return "\033[1;33;49m" + str(text) + " \033[0;37;49m" + str(whiteText)
else:
return "\033[1;33;49m" + str(text) + "\033[0;37;49m" + str(whiteText)


def input(text):
###


def g(*args, **kwargs):
return green(*args, **kwargs)


def r(*args, **kwargs):
return green(*args, **kwargs)


def b(*args, **kwargs):
return green(*args, **kwargs)


def y(*args, **kwargs):
return green(*args, **kwargs)


###


def prompt(text):
return "\033[1;33;49m" + "[?]" + " \033[0;37;49m" + str(text)


def info(text):
return "\033[1;34;49m" + "[-]" + " \033[0;37;49m" + str(text)


def error(text):
return "\033[1;31;49m" + "[!]" + " \033[0;37;49m" + str(text)


def output(text):
return "\033[1;32;49m" + "[>]" + " \033[0;37;49m" + str(text)
return "\033[1;32;49m" + "[>]" + " \033[0;37;49m" + str(text)


# backwards compatibility only:
def input(text):
return prompt(text)


###


def err(*args, **kwargs):
return error(*args, **kwargs)


def out(*args, **kwargs):
return output(*args, **kwargs)


###


def pPrompt(text):
print(prompt(text))


def pInfo(text):
print(info(text))


def pError(text):
print(error(text))


def pOutput(text):
print(output(text))


###


def pErr(*args, **kwargs):
return pError(*args, **kwargs)


def pOut(*args, **kwargs):
return pOutput(*args, **kwargs)

0 comments on commit 2e27216

Please sign in to comment.