Skip to content

Commit

Permalink
docs: fix docstring
Browse files Browse the repository at this point in the history
fix: clean up code black formater
  • Loading branch information
mdsanima committed Apr 2, 2022
1 parent ae4b5af commit 656615f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
10 changes: 6 additions & 4 deletions docs/source/modules/colors.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ just for fun.
:name: show-complex-color-true-dk-b
```

```{admonition} Note
Now you know what numbers you have withs different colors, now you can use the
function {bdg-link-primary-line}`get_complex_color <#function-get-complex-color>`
in your code.
```{eval-rst}
.. note::
Now you know what numbers you have withs different colors, now you can use
the function
:bdg-link-primary-line:`get_complex_color <#function-get-complex-color>`
in your code.
```
29 changes: 14 additions & 15 deletions src/mdsanima_dev/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
def set_complex_color() -> str:
"""Define color console variables.
.. warning:: Do not use this function in your code, it is needed to perform
other functions.
:return: Color console literal variable.
:rtype: str
Expand All @@ -16,12 +19,6 @@ def set_complex_color() -> str:
sx, xm, ex = complex_color()
start_c, middle_c, end_c = complex_color()
.. admonition:: WARNING
:class: warning
Do not use this function in your code, it is needed to perform
other functions.
"""
sx = "\x1b[38;5;"
xm = "m"
Expand All @@ -30,7 +27,7 @@ def set_complex_color() -> str:
return sx, xm, ex


def get_color(text: str="mdsanima", color: int=255) -> str:
def get_color(text: str = "mdsanima", color: int = 255) -> str:
"""This function is almost the same as
:bdg-link-primary-line:`get_complex_color <#function-get-complex-color>`
function.
Expand All @@ -40,10 +37,10 @@ def get_color(text: str="mdsanima", color: int=255) -> str:
print function.
:param text: The text you want to use for color output in the console,
defaults to mdsanima.
defaults to `mdsanima`.
:type text: str, optional
:param color: The color number you want to use for color output in the
console, defaults to 255.
console, defaults to `255`.
:type color: int, optional
:return: Colored text output in the console.
:rtype: str
Expand Down Expand Up @@ -84,17 +81,19 @@ def get_color(text: str="mdsanima", color: int=255) -> str:
return sx + str(color - 1) + xm + text + ex


def get_complex_color(text: str="mdsanima", color: int=255, end=None) -> str:
def get_complex_color(
text: str = "mdsanima", color: int = 255, end=None
) -> str:
"""This feature allows you to print colored text to the output of the
console. Now the function works the same like print function.
:param text: The text you want to use for color output in the console,
defaults to mdsanima.
defaults to `mdsanima`.
:type text: str, optional
:param color: The color number you want to use for color output in the
console, defaults to 255.
console, defaults to `255`.
:type color: int, optional
:param end: End of line print, defaults to None.
:param end: End of line print, defaults to `None`.
:type end: str, optional
:return: Colored text output in the console.
:rtype: str
Expand All @@ -120,10 +119,10 @@ def get_complex_color(text: str="mdsanima", color: int=255, end=None) -> str:
return str


def show_complex_color(number: bool=False) -> str:
def show_complex_color(number: bool = False) -> str:
"""Function prints all available colors with a number or only text.
:param number: Show color number, defaults to False.
:param number: Show color number, defaults to `False`.
:type number: bool, optional
:return: Show all colors in the console output.
:rtype: str
Expand Down

0 comments on commit 656615f

Please sign in to comment.