tutil.py - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
tutil.py (709B)
---
1 from kivy.utils import get_color_from_hex
2
3
4 def address_colors(wallet, addr):
5 """
6 Chooses the appropriate text color and background color to
7 mark receiving, change and billing addresses.
8
9 Returns: color, background_color
10 """
11
12 # modified colors (textcolor, background_color) from electrum/gui/qt/util.py
13 GREEN = ("#000000", "#8af296")
14 YELLOW = ("#000000", "#ffff00")
15 BLUE = ("#000000", "#8cb3f2")
16 DEFAULT = ('#ffffff', '#4c4c4c')
17
18 colors = DEFAULT
19 if wallet.is_mine(addr):
20 colors = YELLOW if wallet.is_change(addr) else GREEN
21 elif wallet.is_billing_address(addr):
22 colors = BLUE
23 return (get_color_from_hex(color) for color in colors)