---
# `st_format` - Streamlit Formatting Utilities
`st_format` is a Python library designed to enhance the presentation of Streamlit apps by providing utility functions for formatting and layout customization. This library allows you to easily set backgrounds, center images, create custom text alignments, and more.
## Installation
You can install `st_format` directly from PyPI:
```bash
pip install st-format
```
## Functions
### 1. `set_background`
Sets a background image for the Streamlit app.
**Parameters:**
- `image_url` (str): The URL of the background image.
- `size` (str): The size of the background image. (default: `"180%"`)
- `position` (str): The position of the background image. (default: `"top left"`)
- `repeat` (str): The background image repeat behavior. (default: `"repeat"`)
- `attachment` (str): The background image attachment behavior. (default: `"local"`)
**Usage:**
```python
import streamlit as st
from st_format import set_background
set_background(
image_url="https://raw.githubusercontent.com/Willy71/background/main/picture/pxfuel%20(1).jpg"
)
```
### 2. `center_picture`
Centers an image on the Streamlit page.
**Parameters:**
- `image` (str): The URL of the image.
- `width` (str): The width of the image.
**Usage:**
```python
from st_format import center_picture
center_picture(
image="https://example.com/image.png",
width="300px"
)
```
### 3. `line`
Draws a horizontal line on the Streamlit page.
**Parameters:**
- `size` (str): The thickness of the line.
- `color` (str): The color of the line.
**Usage:**
```python
from st_format import line
line(
size="2",
color="black"
)
```
### 4. `center_text`
Centers text on the Streamlit page.
**Parameters:**
- `text` (str): The text to display.
- `size` (str): The size of the text (HTML heading size, e.g., `"1"` for `<h1>`).
- `color` (str): The color of the text.
**Usage:**
```python
from st_format import center_text
center_text(
text="Welcome to My App",
size="2",
color="blue"
)
```
### 5. `text_left`
Aligns text to the left on the Streamlit page.
**Parameters:**
- `text` (str): The text to display.
- `size` (str): The size of the text (HTML heading size, e.g., `"1"` for `<h1>`).
- `color` (str): The color of the text.
**Usage:**
```python
from st_format import text_left
text_left(
text="This is left-aligned text.",
size="3",
color="green"
)
```
### 6. `center_text_link`
Centers a hyperlink on the Streamlit page.
**Parameters:**
- `link_text` (str): The text to display as a hyperlink.
- `link_url` (str): The URL the link points to.
- `size` (str): The size of the text (HTML heading size, e.g., `"1"` for `<h1>`).
- `color` (str): The color of the text.
**Usage:**
```python
from st_format import center_text_link
center_text_link(
link_text="Visit My Website",
link_url="https://example.com",
size="3",
color="red"
)
```
### 7. 'left_text_link'
Place a hyperlink on the left
**Parameters:**
- link_text (str): The text to display as a hyperlink.
- link_url (str): The URL the link points to.
- size (str): The size of the text (HTML heading size, e.g., "1" for <h1>).
- color (str): The color of the text.
**Usage:**
```python
from st_format import left_text_link
left_text_link(
link_text="Visit My Website",
link_url="https://example.com",
size="3",
color="red"
)
```
### 8. `photo_link`
Creates a hyperlink with an image on the Streamlit page.
**Parameters:**
- `alt_text` (str): The alt text for the image.
- `img_url` (str): The URL of the image.
- `link_url` (str): The URL the image links to.
- `img_width` (str): The width of the image in pixels.
**Usage:**
```python
from st_format import photo_link
photo_link(
alt_text="Image description",
img_url="https://example.com/image.png",
link_url="https://example.com",
img_width="200"
)
```
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
Raw data
{
"_id": null,
"home_page": "https://github.com/Willy71/st_format",
"name": "st-format",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "utilitys streamlit center text background",
"author": "Guillermo Cerato",
"author_email": "gcerato@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/96/4d/d4bef1db343dfedf822e444f6ac00cb293c8d97cc383cc7a69ebaf514036/st_format-0.2.tar.gz",
"platform": null,
"description": "---\r\n\r\n# `st_format` - Streamlit Formatting Utilities\r\n\r\n`st_format` is a Python library designed to enhance the presentation of Streamlit apps by providing utility functions for formatting and layout customization. This library allows you to easily set backgrounds, center images, create custom text alignments, and more.\r\n\r\n## Installation\r\n\r\nYou can install `st_format` directly from PyPI:\r\n\r\n```bash\r\npip install st-format\r\n```\r\n\r\n## Functions\r\n\r\n### 1. `set_background`\r\n\r\nSets a background image for the Streamlit app.\r\n\r\n**Parameters:**\r\n- `image_url` (str): The URL of the background image.\r\n- `size` (str): The size of the background image. (default: `\"180%\"`)\r\n- `position` (str): The position of the background image. (default: `\"top left\"`)\r\n- `repeat` (str): The background image repeat behavior. (default: `\"repeat\"`)\r\n- `attachment` (str): The background image attachment behavior. (default: `\"local\"`)\r\n\r\n**Usage:**\r\n\r\n```python\r\nimport streamlit as st\r\nfrom st_format import set_background\r\n\r\nset_background(\r\n image_url=\"https://raw.githubusercontent.com/Willy71/background/main/picture/pxfuel%20(1).jpg\"\r\n)\r\n```\r\n\r\n### 2. `center_picture`\r\n\r\nCenters an image on the Streamlit page.\r\n\r\n**Parameters:**\r\n- `image` (str): The URL of the image.\r\n- `width` (str): The width of the image.\r\n\r\n**Usage:**\r\n\r\n```python\r\nfrom st_format import center_picture\r\n\r\ncenter_picture(\r\n image=\"https://example.com/image.png\",\r\n width=\"300px\"\r\n)\r\n```\r\n\r\n### 3. `line`\r\n\r\nDraws a horizontal line on the Streamlit page.\r\n\r\n**Parameters:**\r\n- `size` (str): The thickness of the line.\r\n- `color` (str): The color of the line.\r\n\r\n**Usage:**\r\n\r\n```python\r\nfrom st_format import line\r\n\r\nline(\r\n size=\"2\",\r\n color=\"black\"\r\n)\r\n```\r\n\r\n### 4. `center_text`\r\n\r\nCenters text on the Streamlit page.\r\n\r\n**Parameters:**\r\n- `text` (str): The text to display.\r\n- `size` (str): The size of the text (HTML heading size, e.g., `\"1\"` for `<h1>`).\r\n- `color` (str): The color of the text.\r\n\r\n**Usage:**\r\n\r\n```python\r\nfrom st_format import center_text\r\n\r\ncenter_text(\r\n text=\"Welcome to My App\",\r\n size=\"2\",\r\n color=\"blue\"\r\n)\r\n```\r\n\r\n### 5. `text_left`\r\n\r\nAligns text to the left on the Streamlit page.\r\n\r\n**Parameters:**\r\n- `text` (str): The text to display.\r\n- `size` (str): The size of the text (HTML heading size, e.g., `\"1\"` for `<h1>`).\r\n- `color` (str): The color of the text.\r\n\r\n**Usage:**\r\n\r\n```python\r\nfrom st_format import text_left\r\n\r\ntext_left(\r\n text=\"This is left-aligned text.\",\r\n size=\"3\",\r\n color=\"green\"\r\n)\r\n```\r\n\r\n### 6. `center_text_link`\r\n\r\nCenters a hyperlink on the Streamlit page.\r\n\r\n**Parameters:**\r\n- `link_text` (str): The text to display as a hyperlink.\r\n- `link_url` (str): The URL the link points to.\r\n- `size` (str): The size of the text (HTML heading size, e.g., `\"1\"` for `<h1>`).\r\n- `color` (str): The color of the text.\r\n\r\n**Usage:**\r\n\r\n```python\r\nfrom st_format import center_text_link\r\n\r\ncenter_text_link(\r\n link_text=\"Visit My Website\",\r\n link_url=\"https://example.com\",\r\n size=\"3\",\r\n color=\"red\"\r\n)\r\n```\r\n### 7. 'left_text_link'\r\n\r\nPlace a hyperlink on the left\r\n\r\n**Parameters:**\r\n - link_text (str): The text to display as a hyperlink.\r\n - link_url (str): The URL the link points to.\r\n - size (str): The size of the text (HTML heading size, e.g., \"1\" for <h1>).\r\n - color (str): The color of the text.\r\n\r\n**Usage:**\r\n\r\n```python\r\nfrom st_format import left_text_link\r\n\r\nleft_text_link(\r\n link_text=\"Visit My Website\",\r\n link_url=\"https://example.com\",\r\n size=\"3\",\r\n color=\"red\"\r\n)\r\n```\r\n\r\n### 8. `photo_link`\r\n\r\nCreates a hyperlink with an image on the Streamlit page.\r\n\r\n**Parameters:**\r\n- `alt_text` (str): The alt text for the image.\r\n- `img_url` (str): The URL of the image.\r\n- `link_url` (str): The URL the image links to.\r\n- `img_width` (str): The width of the image in pixels.\r\n\r\n**Usage:**\r\n\r\n```python\r\nfrom st_format import photo_link\r\n\r\nphoto_link(\r\n alt_text=\"Image description\",\r\n img_url=\"https://example.com/image.png\",\r\n link_url=\"https://example.com\",\r\n img_width=\"200\"\r\n)\r\n```\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n---\r\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Utility functions for enhancing Streamlit apps",
"version": "0.2",
"project_urls": {
"Homepage": "https://github.com/Willy71/st_format"
},
"split_keywords": [
"utilitys",
"streamlit",
"center",
"text",
"background"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "964dd4bef1db343dfedf822e444f6ac00cb293c8d97cc383cc7a69ebaf514036",
"md5": "821f23040cc3d5ddf87ed953e694cf0a",
"sha256": "b6df42f948400d84c8812516ba79ff9733dff12913866e504bc15836779875da"
},
"downloads": -1,
"filename": "st_format-0.2.tar.gz",
"has_sig": false,
"md5_digest": "821f23040cc3d5ddf87ed953e694cf0a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3997,
"upload_time": "2024-08-09T16:37:19",
"upload_time_iso_8601": "2024-08-09T16:37:19.574375Z",
"url": "https://files.pythonhosted.org/packages/96/4d/d4bef1db343dfedf822e444f6ac00cb293c8d97cc383cc7a69ebaf514036/st_format-0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-09 16:37:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Willy71",
"github_project": "st_format",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "st-format"
}