Metadata-Version: 2.5
Name: terminal-styler
Version: 1.0.0
Summary: CLI tool for adding foreground and background colours, as well as styles such as bold, underline, and more to your terminal output.
Project-URL: Homepage, https://github.com/SamJohn04/terminal-styler
Project-URL: Bug Tracker, https://github.com/SamJohn04/terminal-styler/issues
Author-email: Samuel John <samuel.john.codes@gmail.com>
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.7
Description-Content-Type: text/markdown

# Terminal Styler

CLI tool for transpiling your code, adding foreground and background colours, as well as styles such as bold, underline, and more to your terminal output.

## Prerequisites

- Python
- Support for ANSI codes in your terminal

## Installation

To install the program, you may use pip or any package manager of your choice as the program is available on PyPI. To install using pipx, execute the following command:

> ```pipx install terminal-styler```

## Execution

To run the program, execute the following command from the root directory of the project:

> ```stylet <input-file> [<output-file>]```

If no output file is specified, the output file will be `stdout`

## Input File

The input file should be a file containing the text you wish to style. The text can be styled using the following syntax:

> ```<codes [<styles>]>``` for getting just the code. ```<codes default>``` for going back to normal
> ```<console [<styles>]>text</console>``` for nesting and the like

Each style is separated by a whitespace.

> Eg: ```<console bold underline color-green>text</console>```

The following styles are supported:
- bold
- underline
- reverse-text
- color-\<color\>
- bg-\<color\>

The following colours are supported:
- black
- red
- green
- yellow
- blue
- magenta
- cyan
- white
- grey

RGB colors can be specified in place of the default colors, using the syntax [#hexcode].
> Eg: ```<console.bg-[#ff0000]>text</console>```

Each color has a dark alternative, except black and white, represented as dark-\<color\>.
> Eg: ```<console.color-dark-red>text</console>```

You may also nest console tags within each other.
> Eg: ```<console.bold>Hello<console.underline>World!</console> How are you?</console>```

**Note:** If you wish to use ```<console``` or ```</console>``` in your text without it being transpiled, you must enter a bang ```!``` after `<`
> Eg: ```<!console>text</!console>``` will be transpiled to ```<console>text</console>```

One exclaimation mark will be removed from after each ```<```, if present.

## Output File

The output file will be a copy of the input file, with the text styled according to the input file. If no output file is specified, the output file will be `stdout`.

**Note:** If the output file already exists, it will be overwritten.

## Examples

### Input

```test.py```
```
print("<console color-dark-red bg-green bold>Hello <console underline>World!</console></console>")
print("<console color-[#00ff00]>How are you?</console>!")
print("I <console color-dark-grey>am</console> <console color-gray>good</console>")
print("<codes color-dark-red>Goodbye<codes default> World!")
```

### Output

```
print("\033[31m\033[102m\033[1mHello \033[4mWorld!\033[0m\033[31m\033[102m\033[1m\033[0m")
print("\033[38;2;0;255;0mHow are you?\033[0m!")
print("I \033[37mam\033[0m \033[90mgood\033[0m")
print("\033[31mGoodbye\033[0m World!")
```
