Add styles
This commit is contained in:
parent
3a70003ff2
commit
6c5461cec2
1 changed files with 48 additions and 0 deletions
48
lib/style.rb
48
lib/style.rb
|
@ -21,6 +21,8 @@ class Style
|
||||||
Curses.init_pair message_time_id, message_time_color, message_time_bg
|
Curses.init_pair message_time_id, message_time_color, message_time_bg
|
||||||
Curses.init_pair message_author_id, message_author_color, message_author_bg
|
Curses.init_pair message_author_id, message_author_color, message_author_bg
|
||||||
Curses.init_pair online_mark_id, online_mark_color, online_mark_bg
|
Curses.init_pair online_mark_id, online_mark_color, online_mark_bg
|
||||||
|
Curses.init_pair away_mark_id, away_mark_color, away_mark_bg
|
||||||
|
Curses.init_pair busy_mark_id, busy_mark_color, busy_mark_bg
|
||||||
Curses.init_pair peer_info_name_id, peer_info_name_color, peer_info_name_bg
|
Curses.init_pair peer_info_name_id, peer_info_name_color, peer_info_name_bg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -94,6 +96,20 @@ class Style
|
||||||
window.attroff online_mark_attr
|
window.attroff online_mark_attr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def away_mark(window)
|
||||||
|
window.attron away_mark_attr
|
||||||
|
yield
|
||||||
|
ensure
|
||||||
|
window.attroff away_mark_attr
|
||||||
|
end
|
||||||
|
|
||||||
|
def busy_mark(window)
|
||||||
|
window.attron busy_mark_attr
|
||||||
|
yield
|
||||||
|
ensure
|
||||||
|
window.attroff busy_mark_attr
|
||||||
|
end
|
||||||
|
|
||||||
def peer_info_name(window)
|
def peer_info_name(window)
|
||||||
window.attron peer_info_name_attr
|
window.attron peer_info_name_attr
|
||||||
yield
|
yield
|
||||||
|
@ -143,6 +159,14 @@ private
|
||||||
Curses.color_pair online_mark_id
|
Curses.color_pair online_mark_id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def away_mark_attr
|
||||||
|
Curses.color_pair away_mark_id
|
||||||
|
end
|
||||||
|
|
||||||
|
def busy_mark_attr
|
||||||
|
Curses.color_pair busy_mark_id
|
||||||
|
end
|
||||||
|
|
||||||
def peer_info_name_attr
|
def peer_info_name_attr
|
||||||
Curses.color_pair(peer_info_name_id) | Curses::A_BOLD
|
Curses.color_pair(peer_info_name_id) | Curses::A_BOLD
|
||||||
end
|
end
|
||||||
|
@ -187,6 +211,14 @@ private
|
||||||
@online_mark_id ||= self.class.counter
|
@online_mark_id ||= self.class.counter
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def away_mark_id
|
||||||
|
@away_mark_id ||= self.class.counter
|
||||||
|
end
|
||||||
|
|
||||||
|
def busy_mark_id
|
||||||
|
@busy_mark_id ||= self.class.counter
|
||||||
|
end
|
||||||
|
|
||||||
def peer_info_name_id
|
def peer_info_name_id
|
||||||
@peer_info_name_id ||= self.class.counter
|
@peer_info_name_id ||= self.class.counter
|
||||||
end
|
end
|
||||||
|
@ -271,6 +303,22 @@ private
|
||||||
Curses::COLOR_BLACK
|
Curses::COLOR_BLACK
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def away_mark_color
|
||||||
|
Curses::COLOR_YELLOW
|
||||||
|
end
|
||||||
|
|
||||||
|
def away_mark_bg
|
||||||
|
Curses::COLOR_BLACK
|
||||||
|
end
|
||||||
|
|
||||||
|
def busy_mark_color
|
||||||
|
Curses::COLOR_RED
|
||||||
|
end
|
||||||
|
|
||||||
|
def busy_mark_bg
|
||||||
|
Curses::COLOR_BLACK
|
||||||
|
end
|
||||||
|
|
||||||
def peer_info_name_color
|
def peer_info_name_color
|
||||||
Curses::COLOR_WHITE
|
Curses::COLOR_WHITE
|
||||||
end
|
end
|
||||||
|
|
Reference in a new issue