-
Notifications
You must be signed in to change notification settings - Fork 0
Formatting
This sub-module contains classes and functionality which enables users to enrich their terminal output with text color, background color and formatting.
This data class enables the user to decorate terminal output with background color. It is simply a class which holds the formatting codes for background color and a test method for testing the terminal color output.
from jutl.formatting import Background
print(Background.colors["BLUE"] + "Hello, there!" + Background.colors["DEFAULT"]) # prints "Hello, there!" with a blue
background and then resets it.Note Using
apply()to apply formatting instead of directly using the data classes is highly recommended for a better experience.
This method lets users test the
This data class lets the user reset individual types of formatting or all types simultaneously. It is simply a class which holds the formatting codes for resetting formatting.
from jutl.formatting import Reset
Note Using
apply()to apply formatting instead of directly using the data classes is highly recommended for a better experience.
This data class enables the user to decorate terminal output with text color. It is simply a class which holds the formatting codes for text color and a test method for testing the terminal color output.
from jutl.formatting import Text
Note Using
apply()to apply formatting instead of directly using the data classes is highly recommended for a better experience.
This data class enables the user to decorate terminal output with background color. It is simply a class which holds the formatting codes for typography formatting and a test method for testing the terminal formatting output.
from jutl.formatting import Typography
Note Using
apply()to apply formatting instead of directly using the data classes is highly recommended for a better experience.
This function lets the user easily format their terminal output with optional formatting types.
from jutl.formatting import apply
print(apply(text="Hello, World!",
text_color="red",
background_color="white",
typography="bold"
)
) # prints "Hello, World!" in bold, red text with
a white background and resets the styling.| Argument | Data type | Default | Description |
|---|---|---|---|
text |
string | The text to be formatted | |
text_color |
string | None |
The desired color of the text |
background_color |
string | None |
The desired color of the background |
typography |
string | None |
The desired typography formatting |
| Argument | Required | Accepted values |
|---|---|---|
| `` |
This class/function/method returns/does not return
This class/object/method does/does not have
This class lets the user test how their chosen terminal handles formatting.
from jutl.formatting import test
test()Note This function does not take any arguments.
Note This function does not take any arguments.
This function does not return anything.
This function calls the test methods in , , and ``, so the side-effects of this function are the side-effects of those methods collectively.
Created, and maintained by Jordan Welsman @ BU.
jutils, jutl Copyright (c) 2022-2023, Jordan Welsman.
All rights reserved.