outputstyles


Nameoutputstyles JSON
Version 0.1.4 PyPI version JSON
download
home_pagehttps://github.com/dunieskysp/output_styles
SummaryApplying styles to CLI output
upload_time2024-04-19 20:56:36
maintainerNone
docs_urlNone
authorDuniesky Salazar Pérez
requires_pythonNone
licenseNone
keywords python outputstyles cli styles text styles
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Output Styles

Aplicarle estilos al texto de salida por CLI.

## Instalacion

```bash
  pip install outputstyles
```

## Uso/Ejemplos

### 1 - Usar los diferentes tipos de mensajes y estilos implementados

**Tipos de mensajes implementados:**

| Message   | Description                                   |
| --------- | --------------------------------------------- |
| `error`   | Admite las variantes: **_btn, ico, btn_ico_** |
| `warning` | Admite las variantes: **_btn, ico, btn_ico_** |
| `success` | Admite las variantes: **_btn, ico, btn_ico_** |
| `info`    | Admite las variantes: **_btn, ico, btn_ico_** |
| `bold`    | No tiene variantes.                           |

**Usar los tipos de mensajes implementados:**

```py
from outputstyles import error, warning, info, success, bold

# Print error messages.
print(error("Error!"))
print(error("Error!", "btn"))
print(error("Error!", "ico"))
print(error("Error!", "btn_ico"))

# Print warning messages.
print(warning("Warning!"))
print(warning("Warning!", "ico"))
print(warning("Warning!", "btn"))
print(warning("Warning!", "btn_ico"))

# Print warning messages.
print(success("Success!"))
print(success("Success!", "btn"))
print(success("Success!", "ico"))
print(success("Success!", "btn_ico"))

# Print info messages.
print(info("Info!"))
print(info("Info!", "btn"))
print(info("Info!", "ico"))
print(info("Info!", "btn_ico"))

# Print text in bold style.
print(bold("Bold!"))
```

Resultado:

![output_styles](https://raw.githubusercontent.com/dunieskysp/output_styles/main/docs/img/outputstyles_all.png)

### 2 - Agregar otros estilos al texto

**Modificadores y estilos que se le pueden aplicar al texto de salida:**

| Modifiers      | Foreground | Foreground light | Background | Background light |
| -------------- | ---------- | ---------------- | ---------- | ---------------- |
| reset          | fg_black   | fg_light_black   | bg_black   | bg_light_black   |
| bold           | fg_red     | fg_light_red     | bg_red     | bg_light_red     |
| disabled       | fg_green   | fg_light_green   | bg_green   | bg_light_green   |
| italic         | fg_yellow  | fg_light_yellow  | bg_yellow  | bg_light_yellow  |
| underline      | fg_blue    | fg_light_blue    | bg_blue    | bg_light_blue    |
| blink          | fg_magenta | fg_light_magenta | bg_magenta | bg_light_magenta |
| blink2         | fg_cyan    | fg_light_cyan    | bg_cyan    | bg_light_cyan    |
| reverse        | fg_white   | fg_light_white   | bg_white   | bg_light_white   |
| hidden         |            |                  |            |                  |
| strike_through |            |                  |            |                  |

**Aplicar estilos personalizados:**

```py
from outputstyles import add_text_styles

# Styles of the text.
styles = ["fg_red", "underline"]

print(add_text_styles("Hola", styles))
```

Resultado:

![output_styles](https://raw.githubusercontent.com/dunieskysp/output_styles/main/docs/img/custom_styles.png)

### 3 - Crear nuevas funciones

**Definir los datos y la funcion del nuevo tipo de mensaje:**

```py
from outputstyles import apply_styles

# Data of the new message.
msg_data = {
    "ico_code": "\u2726",
    "color": "cyan"
}


# Apply the style of the new message type.
def new_msg(text: str, msg_format: str = "", message_data: dict = msg_data) -> str:
    return apply_styles(text, msg_format, message_data)


print(new_msg("Nuevo estilo"))
print(new_msg("Nuevo estilo", "btn"))
print(new_msg("Nuevo estilo", "ico"))
print(new_msg("Nuevo estilo", "btn_ico"))
```

Resultado:

![output_styles](https://raw.githubusercontent.com/dunieskysp/output_styles/main/docs/img/new_message_type.png)

## Screenshots

![output_styles](https://raw.githubusercontent.com/dunieskysp/output_styles/main/docs/img/output_styles_light.png)

## License

[MIT](LICENSE)

## Authors

- [@dunieskysp](https://github.com/dunieskysp)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dunieskysp/output_styles",
    "name": "outputstyles",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "python, outputstyles, CLI styles, text styles",
    "author": "Duniesky Salazar P\u00e9rez",
    "author_email": "<duniesky.salazar@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/1c/92/9a4ec5b4624fdc8ffb3e0b87d2b3770a65552ebae050ee4e926c6ce1d932/outputstyles-0.1.4.tar.gz",
    "platform": null,
    "description": "# Output Styles\r\n\r\nAplicarle estilos al texto de salida por CLI.\r\n\r\n## Instalacion\r\n\r\n```bash\r\n  pip install outputstyles\r\n```\r\n\r\n## Uso/Ejemplos\r\n\r\n### 1 - Usar los diferentes tipos de mensajes y estilos implementados\r\n\r\n**Tipos de mensajes implementados:**\r\n\r\n| Message   | Description                                   |\r\n| --------- | --------------------------------------------- |\r\n| `error`   | Admite las variantes: **_btn, ico, btn_ico_** |\r\n| `warning` | Admite las variantes: **_btn, ico, btn_ico_** |\r\n| `success` | Admite las variantes: **_btn, ico, btn_ico_** |\r\n| `info`    | Admite las variantes: **_btn, ico, btn_ico_** |\r\n| `bold`    | No tiene variantes.                           |\r\n\r\n**Usar los tipos de mensajes implementados:**\r\n\r\n```py\r\nfrom outputstyles import error, warning, info, success, bold\r\n\r\n# Print error messages.\r\nprint(error(\"Error!\"))\r\nprint(error(\"Error!\", \"btn\"))\r\nprint(error(\"Error!\", \"ico\"))\r\nprint(error(\"Error!\", \"btn_ico\"))\r\n\r\n# Print warning messages.\r\nprint(warning(\"Warning!\"))\r\nprint(warning(\"Warning!\", \"ico\"))\r\nprint(warning(\"Warning!\", \"btn\"))\r\nprint(warning(\"Warning!\", \"btn_ico\"))\r\n\r\n# Print warning messages.\r\nprint(success(\"Success!\"))\r\nprint(success(\"Success!\", \"btn\"))\r\nprint(success(\"Success!\", \"ico\"))\r\nprint(success(\"Success!\", \"btn_ico\"))\r\n\r\n# Print info messages.\r\nprint(info(\"Info!\"))\r\nprint(info(\"Info!\", \"btn\"))\r\nprint(info(\"Info!\", \"ico\"))\r\nprint(info(\"Info!\", \"btn_ico\"))\r\n\r\n# Print text in bold style.\r\nprint(bold(\"Bold!\"))\r\n```\r\n\r\nResultado:\r\n\r\n![output_styles](https://raw.githubusercontent.com/dunieskysp/output_styles/main/docs/img/outputstyles_all.png)\r\n\r\n### 2 - Agregar otros estilos al texto\r\n\r\n**Modificadores y estilos que se le pueden aplicar al texto de salida:**\r\n\r\n| Modifiers      | Foreground | Foreground light | Background | Background light |\r\n| -------------- | ---------- | ---------------- | ---------- | ---------------- |\r\n| reset          | fg_black   | fg_light_black   | bg_black   | bg_light_black   |\r\n| bold           | fg_red     | fg_light_red     | bg_red     | bg_light_red     |\r\n| disabled       | fg_green   | fg_light_green   | bg_green   | bg_light_green   |\r\n| italic         | fg_yellow  | fg_light_yellow  | bg_yellow  | bg_light_yellow  |\r\n| underline      | fg_blue    | fg_light_blue    | bg_blue    | bg_light_blue    |\r\n| blink          | fg_magenta | fg_light_magenta | bg_magenta | bg_light_magenta |\r\n| blink2         | fg_cyan    | fg_light_cyan    | bg_cyan    | bg_light_cyan    |\r\n| reverse        | fg_white   | fg_light_white   | bg_white   | bg_light_white   |\r\n| hidden         |            |                  |            |                  |\r\n| strike_through |            |                  |            |                  |\r\n\r\n**Aplicar estilos personalizados:**\r\n\r\n```py\r\nfrom outputstyles import add_text_styles\r\n\r\n# Styles of the text.\r\nstyles = [\"fg_red\", \"underline\"]\r\n\r\nprint(add_text_styles(\"Hola\", styles))\r\n```\r\n\r\nResultado:\r\n\r\n![output_styles](https://raw.githubusercontent.com/dunieskysp/output_styles/main/docs/img/custom_styles.png)\r\n\r\n### 3 - Crear nuevas funciones\r\n\r\n**Definir los datos y la funcion del nuevo tipo de mensaje:**\r\n\r\n```py\r\nfrom outputstyles import apply_styles\r\n\r\n# Data of the new message.\r\nmsg_data = {\r\n    \"ico_code\": \"\\u2726\",\r\n    \"color\": \"cyan\"\r\n}\r\n\r\n\r\n# Apply the style of the new message type.\r\ndef new_msg(text: str, msg_format: str = \"\", message_data: dict = msg_data) -> str:\r\n    return apply_styles(text, msg_format, message_data)\r\n\r\n\r\nprint(new_msg(\"Nuevo estilo\"))\r\nprint(new_msg(\"Nuevo estilo\", \"btn\"))\r\nprint(new_msg(\"Nuevo estilo\", \"ico\"))\r\nprint(new_msg(\"Nuevo estilo\", \"btn_ico\"))\r\n```\r\n\r\nResultado:\r\n\r\n![output_styles](https://raw.githubusercontent.com/dunieskysp/output_styles/main/docs/img/new_message_type.png)\r\n\r\n## Screenshots\r\n\r\n![output_styles](https://raw.githubusercontent.com/dunieskysp/output_styles/main/docs/img/output_styles_light.png)\r\n\r\n## License\r\n\r\n[MIT](LICENSE)\r\n\r\n## Authors\r\n\r\n- [@dunieskysp](https://github.com/dunieskysp)\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Applying styles to CLI output",
    "version": "0.1.4",
    "project_urls": {
        "Homepage": "https://github.com/dunieskysp/output_styles"
    },
    "split_keywords": [
        "python",
        " outputstyles",
        " cli styles",
        " text styles"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "24e2130d613588624d77bbdbf5139be5aeb33b3f89e90b2acbf6074703ecb3b4",
                "md5": "0cf813f98ff65ff69d8f9ce9e6d45222",
                "sha256": "8187e5a0036c80966de566275e756edd0a4dddfc710fac114cd8b241b80b8ebc"
            },
            "downloads": -1,
            "filename": "outputstyles-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0cf813f98ff65ff69d8f9ce9e6d45222",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6926,
            "upload_time": "2024-04-19T20:56:33",
            "upload_time_iso_8601": "2024-04-19T20:56:33.894879Z",
            "url": "https://files.pythonhosted.org/packages/24/e2/130d613588624d77bbdbf5139be5aeb33b3f89e90b2acbf6074703ecb3b4/outputstyles-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1c929a4ec5b4624fdc8ffb3e0b87d2b3770a65552ebae050ee4e926c6ce1d932",
                "md5": "cbe3eeccb44ed979a3adf1dfb4c7842f",
                "sha256": "618cf65b26d912fabab5f9248ffdf3095b15940fe7b7a1ffcd80ddcd3ba8781d"
            },
            "downloads": -1,
            "filename": "outputstyles-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "cbe3eeccb44ed979a3adf1dfb4c7842f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6047,
            "upload_time": "2024-04-19T20:56:36",
            "upload_time_iso_8601": "2024-04-19T20:56:36.170289Z",
            "url": "https://files.pythonhosted.org/packages/1c/92/9a4ec5b4624fdc8ffb3e0b87d2b3770a65552ebae050ee4e926c6ce1d932/outputstyles-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-19 20:56:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dunieskysp",
    "github_project": "output_styles",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "outputstyles"
}
        
Elapsed time: 0.20345s