add color support to coin module (#755)

* add color support to coin module

* remove whitespace
This commit is contained in:
chestm007 2019-07-17 05:15:23 +10:00 committed by GitHub
parent c2458e1857
commit 2016addf81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,7 @@ class Coin(IntervalModule):
settings = ( settings = (
("format", "format string used for output."), ("format", "format string used for output."),
("color"),
("coin", "cryptocurrency to fetch"), ("coin", "cryptocurrency to fetch"),
("decimal", "round coin price down to this decimal place"), ("decimal", "round coin price down to this decimal place"),
("currency", "fiat currency to show fiscal data"), ("currency", "fiat currency to show fiscal data"),
@ -42,6 +43,7 @@ class Coin(IntervalModule):
) )
symbol = "¤" symbol = "¤"
color = None
format = "{symbol} {price}{status}" format = "{symbol} {price}{status}"
coin = "ethereum" coin = "ethereum"
currency = "USD" currency = "USD"
@ -82,4 +84,7 @@ class Coin(IntervalModule):
fdict["price"] = str(round(Decimal(fdict["price"]), self.decimal)) fdict["price"] = str(round(Decimal(fdict["price"]), self.decimal))
self.data = fdict self.data = fdict
self.output = {"full_text": self.format.format(**fdict)} self.output = {"full_text": self.format.format(**fdict)}
if self.color is not None:
self.output['color'] = self.color