Skip to content

Commit

Permalink
💄 oneliners css overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
haliphax committed Oct 12, 2023
1 parent b9337a5 commit c44fb72
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions userland/scripts/oneliners.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,24 @@ class OnlinersApp(XthuluApp):
width: 100%;
}
ListItem {
background: grey;
color: black;
}
ListItem.even {
background: black;
color: grey;
}
ListItem.--highlight {
background: red;
color: white;
}
#err {
background: #a00;
color: #fff;
background: red;
color: white;
}
"""
"""Stylesheet"""
Expand All @@ -63,6 +78,7 @@ def __init__(
self.artwork = artwork
self.oneliners = oneliners
super().__init__(context, **kwargs)
self.bind("escape", "quit")

def _update_banner(self):
padded = []
Expand All @@ -89,7 +105,10 @@ def compose(self):

# oneliners
list = ListView(
*[ListItem(Label(o.message)) for o in self.oneliners],
*[
ListItem(Label(o.message), classes="even" if idx % 2 else "")
for idx, o in enumerate(self.oneliners)
],
initial_index=len(self.oneliners) - 1,
)

Expand Down Expand Up @@ -143,10 +162,6 @@ async def on_input_submitted(self, event: Input.Submitted) -> None:

self.exit()

async def on_key(self, event: events.Key) -> None:
if event.key == "escape":
self.exit()

def on_resize(self, event: events.Resize) -> None:
if event.size.height < len(self.artwork) + BANNER_PADDING:
self.banner.update("")
Expand Down

0 comments on commit c44fb72

Please sign in to comment.