mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2026-05-26 15:13:36 +00:00
Support theme font
This commit is contained in:
@@ -85,6 +85,32 @@ class Style(Route):
|
||||
self.finish()
|
||||
|
||||
|
||||
@url(r'/theme/font/([^/]+)')
|
||||
class Font(Route):
|
||||
|
||||
def get(self, name):
|
||||
if not tornado.options.options.theme or not name:
|
||||
raise tornado.web.HTTPError(404)
|
||||
font = 'themes/%s/font/%s' % (
|
||||
tornado.options.options.theme,
|
||||
name)
|
||||
for fn in [
|
||||
'/etc/butterfly/%s' % font,
|
||||
os.path.expanduser('~/.butterfly/%s' % font)]:
|
||||
if os.path.exists(fn):
|
||||
ext = fn.split('.')[-1]
|
||||
self.set_header("Content-Type", "application/x-font-%s" % ext)
|
||||
with open(fn, 'rb') as s:
|
||||
while True:
|
||||
data = s.read(16384)
|
||||
if data:
|
||||
self.write(data)
|
||||
else:
|
||||
break
|
||||
self.finish()
|
||||
raise tornado.web.HTTPError(404)
|
||||
|
||||
|
||||
@url(r'/ws(?:/user/([^/]+))?/?(?:/wd/(.+))?')
|
||||
class TermWebSocket(Route, tornado.websocket.WebSocketHandler):
|
||||
|
||||
@@ -303,16 +329,18 @@ class TermWebSocket(Route, tornado.websocket.WebSocketHandler):
|
||||
|
||||
TermWebSocket.terminals.add(self)
|
||||
|
||||
motd = (self.render_string(
|
||||
tornado.options.options.motd,
|
||||
butterfly=self,
|
||||
version=__version__,
|
||||
opts=tornado.options.options,
|
||||
colors=utils.ansi_colors)
|
||||
.decode('utf-8')
|
||||
.replace('\r', '')
|
||||
.replace('\n', '\r\n'))
|
||||
self.write_message(motd)
|
||||
if tornado.options.options.motd != '':
|
||||
motd = (self.render_string(
|
||||
tornado.options.options.motd,
|
||||
butterfly=self,
|
||||
version=__version__,
|
||||
opts=tornado.options.options,
|
||||
colors=utils.ansi_colors)
|
||||
.decode('utf-8')
|
||||
.replace('\r', '')
|
||||
.replace('\n', '\r\n'))
|
||||
self.write_message(motd)
|
||||
|
||||
self.pty()
|
||||
|
||||
def on_message(self, message):
|
||||
|
||||
@@ -18,22 +18,22 @@
|
||||
|
||||
/* Here are the 16 "normal" colors for theming */
|
||||
|
||||
+termcolor(0, #2e3436)
|
||||
+termcolor(1, #cc0000)
|
||||
+termcolor(2, #4e9a06)
|
||||
+termcolor(3, #c4a000)
|
||||
+termcolor(4, #3465a4)
|
||||
+termcolor(5, #75507b)
|
||||
+termcolor(6, #06989a)
|
||||
+termcolor(7, #d3d7cf)
|
||||
+termcolor(8, #555753)
|
||||
+termcolor(9, #ef2929)
|
||||
+termcolor(10, #8ae234)
|
||||
+termcolor(11, #fce94f)
|
||||
+termcolor(12, #729fcf)
|
||||
+termcolor(13, #ad7fa8)
|
||||
+termcolor(14, #34e2e2)
|
||||
+termcolor(15, #eeeeec)
|
||||
+termcolor(0, #2e3436) /* Black */
|
||||
+termcolor(1, #cc0000) /* Red */
|
||||
+termcolor(2, #4e9a06) /* Green */
|
||||
+termcolor(3, #c4a000) /* Yellow */
|
||||
+termcolor(4, #3465a4) /* Blue */
|
||||
+termcolor(5, #75507b) /* Magenta */
|
||||
+termcolor(6, #06989a) /* Cyan */
|
||||
+termcolor(7, #d3d7cf) /* White */
|
||||
+termcolor(8, #555753) /* Bright Black */
|
||||
+termcolor(9, #ef2929) /* Bright Red */
|
||||
+termcolor(10, #8ae234) /* Bright Green */
|
||||
+termcolor(11, #fce94f) /* Bright Yellow */
|
||||
+termcolor(12, #729fcf) /* Bright Blue */
|
||||
+termcolor(13, #ad7fa8) /* Bright Magenta */
|
||||
+termcolor(14, #34e2e2) /* Bright Cyan */
|
||||
+termcolor(15, #eeeeec) /* Bright White */
|
||||
|
||||
$bg: #110f13
|
||||
$fg: #f4ead5
|
||||
|
||||
@@ -192,6 +192,11 @@
|
||||
this.body.contentEditable = 'true';
|
||||
}
|
||||
this.initmouse();
|
||||
addEventListener('load', (function(_this) {
|
||||
return function() {
|
||||
return _this.resize();
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
|
||||
Terminal.prototype.cloneAttr = function(a, char) {
|
||||
|
||||
5
butterfly/static/main.min.js
vendored
5
butterfly/static/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -100,6 +100,7 @@ class Terminal
|
||||
@body.contentEditable = 'true'
|
||||
|
||||
@initmouse()
|
||||
addEventListener 'load', => @resize()
|
||||
|
||||
cloneAttr: (a, char=null) ->
|
||||
bg: a.bg
|
||||
|
||||
Reference in New Issue
Block a user