Skip to content

Commit 7558244

Browse files
committed
enhancement: core/themes: Enclosing the title inside popup.
This is a follow-up commit from #849. Particularly popup border and title styling is aimed in this commit.
1 parent 5a0ccd6 commit 7558244

File tree

2 files changed

+29
-13
lines changed

2 files changed

+29
-13
lines changed

zulipterminal/config/themes.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@
4343
'edit_tag': 'standout',
4444
'edit_author': 'bold',
4545
'edit_time': 'bold',
46+
'popup_border': 'standout',
47+
'popup_title': 'bold',
4648
}
4749

48-
4950
# 256-color base names for default theme (bold values added below)
5051
DEF_base = dict(
5152
dark_red='#a00',
@@ -171,6 +172,10 @@
171172
None, DEF['white'], DEF['black']),
172173
('muted', 'light blue', 'black',
173174
None, DEF['light_blue'], DEF['black']),
175+
('popup_title', 'black, bold', 'white',
176+
None, DEF['black:bold'], DEF['white']),
177+
('popup_border', 'white', 'black',
178+
None, DEF['white'], DEF['black']),
174179
],
175180
'gruvbox_dark': [
176181
# default colorscheme on 16 colors, gruvbox colorscheme
@@ -251,6 +256,10 @@
251256
None, WHITE, BLACK),
252257
('muted', 'light blue', 'black',
253258
None, LIGHTBLUE, BLACK),
259+
('popup_title', 'black, bold', 'white',
260+
None, DEF['black:bold'], DEF['white']),
261+
('popup_border', 'white', 'black',
262+
None, DEF['white'], DEF['black']),
254263
],
255264
'zt_light': [
256265
(None, 'black', 'white'),
@@ -291,6 +300,8 @@
291300
('edit_time', 'dark blue', 'white'),
292301
('current_user', 'dark gray', 'white'),
293302
('muted', 'dark gray', 'white'),
303+
('popup_title', 'white, bold', 'black'),
304+
('popup_border', 'black', 'white'),
294305
],
295306
'zt_blue': [
296307
(None, 'black', 'light blue'),
@@ -331,6 +342,8 @@
331342
('edit_time', 'dark blue', 'light blue'),
332343
('current_user', 'light gray', 'light blue'),
333344
('muted', 'light gray', 'light blue'),
345+
('popup_title', 'light blue, bold', 'white'),
346+
('popup_border', 'white', 'light blue'),
334347
]
335348
} # type: Dict[str, ThemeSpec]
336349

zulipterminal/core.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,22 @@ def maximum_popup_dimensions(self) -> Tuple[int, int]:
162162
return max_cols, max_rows
163163

164164
def show_pop_up(self, to_show: Any) -> None:
165-
double_lines = dict(tlcorner='╔', tline='═', trcorner='╗',
166-
rline='║', lline='║',
167-
blcorner='╚', bline='═', brcorner='╝')
165+
border_lines = dict(tlcorner='▃', tline='▃', trcorner='▃',
166+
rline='▐', lline='▌',
167+
blcorner='▙', bline='▄', brcorner='▟')
168+
text = urwid.Text(to_show.title, align='center')
168169
self.loop.widget = urwid.Overlay(
169-
urwid.LineBox(to_show,
170-
to_show.title,
171-
**double_lines),
172-
self.view,
173-
align='center',
174-
valign='middle',
175-
# +2 to both of the following, due to LineBox
176-
width=to_show.width + 2,
177-
height=to_show.height + 2,
170+
urwid.AttrMap(urwid.LineBox(urwid.Frame(
171+
header=urwid.BoxAdapter(urwid.AttrMap(
172+
urwid.Filler(text), 'popup_title'), height=1),
173+
body=to_show),
174+
**border_lines), 'popup_border'),
175+
bottom_w=self.view,
176+
align='center',
177+
valign='middle',
178+
# +2 to both of the following, due to LineBox
179+
width=to_show.width + 2,
180+
height=to_show.height + 2,
178181
)
179182

180183
def exit_popup(self) -> None:

0 commit comments

Comments
 (0)