Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now fully flake8 linted #9

Merged
merged 3 commits into from
Oct 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from setuptools import setup, find_packages
from setuptools import setup
from pathlib import Path

project_dir = Path(__file__).parent
Expand All @@ -9,7 +9,8 @@
url="https://github.com/TechWiz-3/bubblewrap",
author="Zac the Wise aka TechWiz-3",
version='0.1.2',
description="A Python library that makes beautiful text bubbles in your terminal using NerdFont icons.",
description="A Python library that makes beautiful text bubbles"
"in your terminal using NerdFont icons.",
long_description_content_type='text/markdown',
long_description=long_description,
package_dir={'': 'src'},
Expand Down
28 changes: 19 additions & 9 deletions src/bubblewrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ class Bubbles():
def __init__(self):
pass

def get_rich_bubble(self, txt, bg_color="blue", fg_color="white", rich=True):
def get_rich_bubble(self, txt, bg_color="blue",
fg_color="white", rich=True):
circle_style = f"[{bg_color}]"
circle_close = f"{circle_style[:1]}/{circle_style[1:]}"
body_open = f"[{fg_color} on {bg_color}]"
body_close = f"{body_open[:1]}/{body_open[1:]}"
return f"{circle_style}{circle_close}{body_open}{txt}{body_close}{circle_style}{circle_close}"
return_str = f"{circle_style}{circle_close}{body_open}{txt}" \
f"{body_close}{circle_style}{circle_close}"
return return_str

def get_ansi_bubbles(self, txt, circle_style, txt_style, reset):
bubble = f"{circle_style}{reset}{txt_style}{txt}{reset}{circle_style}{reset}"
bubble = f"{circle_style}{reset}{txt_style}" \
f"{txt}{reset}{circle_style}{reset}"
return bubble


Expand All @@ -24,19 +28,25 @@ def cli() -> None:
c.print(b.get_rich_bubble("I love bubblewrap", bg_color="red"), end=" ")
c.print(b.get_rich_bubble("try it now", bg_color="blue"))
print()
c.print(b.get_rich_bubble("Bubble up words", bg_color="dark_green", fg_color="grey66"), end=" ")
c.print(b.get_rich_bubble("Bubble up words",
bg_color="dark_green", fg_color="grey66"), end=" ")
c.print(b.get_rich_bubble("or entire sentences", bg_color="blue"), end=" ")
c.print(b.get_rich_bubble("try it now", bg_color="purple"))
print()
c.print(b.get_rich_bubble("Use Rich, or ANSI colors of your choosing", bg_color="purple"))
c.print(b.get_rich_bubble("Use Rich, or ANSI colors of your choosing",
bg_color="purple"))
print()
c.print(b.get_rich_bubble("Fully control", bg_color="blue"), end=" ")
c.print(b.get_rich_bubble("background", bg_color="dark_green"), end=" ")
c.print(b.get_rich_bubble("and", bg_color="purple"), end=" ")
c.print(b.get_rich_bubble("foreground", bg_color="blue", fg_color="dark_red"), end=" ")
c.print(b.get_rich_bubble("colors", bg_color="grey66", fg_color="grey3"))
c.print(b.get_rich_bubble("foreground", bg_color="blue",
fg_color="dark_red"), end=" ")
c.print(b.get_rich_bubble("colors", bg_color="grey66",
fg_color="grey3"))
print()
c.print(b.get_rich_bubble("Create beautiful CLI applications, with ease!", bg_color="deep_pink4"))
c.print(b.get_rich_bubble("Create beautiful CLI applications, with ease!",
bg_color="deep_pink4"))
print()

#print(b.get_ansi_bubbles("Ayo how are you", "\033[31m", "\033[32;41m", "\033[0m"))
# print(b.get_ansi_bubbles("Ayo how are you",
# "\033[31m", "\033[32;41m", "\033[0m"))