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