Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions bittensor_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
WalletOptions as WO,
WalletValidationTypes as WV,
Constants,
COLOR_PALETTE,
COLORS,
HYPERPARAMS,
)
from bittensor_cli.version import __version__, __version_as_int__
Expand Down Expand Up @@ -341,8 +341,8 @@ def get_optional_netuid(netuid: Optional[int], all_netuids: bool) -> Optional[in
return None
elif netuid is None and all_netuids is False:
answer = Prompt.ask(
f"Enter the [{COLOR_PALETTE['GENERAL']['SUBHEADING_MAIN']}]netuid"
f"[/{COLOR_PALETTE['GENERAL']['SUBHEADING_MAIN']}] to use. Leave blank for all netuids",
f"Enter the [{COLORS.G.SUBHEAD_MAIN}]netuid"
f"[/{COLORS.G.SUBHEAD_MAIN}] to use. Leave blank for all netuids",
default=None,
show_default=False,
)
Expand Down Expand Up @@ -950,7 +950,8 @@ def initialize_chain(
elif self.config["network"]:
self.subtensor = SubtensorInterface(self.config["network"])
console.print(
f"Using the specified network [{COLOR_PALETTE['GENERAL']['LINKS']}]{self.config['network']}[/{COLOR_PALETTE['GENERAL']['LINKS']}] from config"
f"Using the specified network [{COLORS.G.LINKS}]{self.config['network']}"
f"[/{COLORS.G.LINKS}] from config"
)
else:
self.subtensor = SubtensorInterface(defaults.subtensor.network)
Expand Down Expand Up @@ -1523,7 +1524,7 @@ def wallet_ask(
else:
wallet_name = Prompt.ask(
"Enter the [blue]wallet name[/blue]"
+ f" [{COLOR_PALETTE['GENERAL']['HINT']} italic](Hint: You can set this with `btcli config set --wallet-name`)",
+ f" [{COLORS.G.HINT} italic](Hint: You can set this with `btcli config set --wallet-name`)",
default=defaults.wallet.name,
)

Expand Down Expand Up @@ -2049,7 +2050,7 @@ def wallet_regen_coldkey(

if not wallet_name:
wallet_name = Prompt.ask(
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]new wallet (coldkey)",
f"Enter the name of the [{COLORS.G.CK}]new wallet (coldkey)",
default=defaults.wallet.name,
)

Expand Down Expand Up @@ -2106,7 +2107,7 @@ def wallet_regen_coldkey_pub(

if not wallet_name:
wallet_name = Prompt.ask(
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]new wallet (coldkey)",
f"Enter the name of the [{COLORS.G.CK}]new wallet (coldkey)",
default=defaults.wallet.name,
)
wallet = Wallet(wallet_name, wallet_hotkey, wallet_path)
Expand Down Expand Up @@ -2223,13 +2224,13 @@ def wallet_new_hotkey(

if not wallet_name:
wallet_name = Prompt.ask(
f"Enter the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]wallet name",
f"Enter the [{COLORS.G.CK}]wallet name",
default=defaults.wallet.name,
)

if not wallet_hotkey:
wallet_hotkey = Prompt.ask(
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['HOTKEY']}]new hotkey",
f"Enter the name of the [{COLORS.G.HK}]new hotkey",
default=defaults.wallet.hotkey,
)

Expand Down Expand Up @@ -2285,7 +2286,7 @@ def wallet_new_coldkey(

if not wallet_name:
wallet_name = Prompt.ask(
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]new wallet (coldkey)",
f"Enter the name of the [{COLORS.G.CK}]new wallet (coldkey)",
default=defaults.wallet.name,
)

Expand Down Expand Up @@ -2359,12 +2360,12 @@ def wallet_create_wallet(

if not wallet_name:
wallet_name = Prompt.ask(
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]new wallet (coldkey)",
f"Enter the name of the [{COLORS.G.CK}]new wallet (coldkey)",
default=defaults.wallet.name,
)
if not wallet_hotkey:
wallet_hotkey = Prompt.ask(
f"Enter the the name of the [{COLOR_PALETTE['GENERAL']['HOTKEY']}]new hotkey",
f"Enter the the name of the [{COLORS.G.HK}]new hotkey",
default=defaults.wallet.hotkey,
)

Expand Down Expand Up @@ -2742,9 +2743,10 @@ def wallet_sign(
self.verbosity_handler(quiet, verbose)
if use_hotkey is None:
use_hotkey = Confirm.ask(
f"Would you like to sign the transaction using your [{COLOR_PALETTE['GENERAL']['HOTKEY']}]hotkey[/{COLOR_PALETTE['GENERAL']['HOTKEY']}]?"
f"\n[Type [{COLOR_PALETTE['GENERAL']['HOTKEY']}]y[/{COLOR_PALETTE['GENERAL']['HOTKEY']}] for [{COLOR_PALETTE['GENERAL']['HOTKEY']}]hotkey[/{COLOR_PALETTE['GENERAL']['HOTKEY']}]"
f" and [{COLOR_PALETTE['GENERAL']['COLDKEY']}]n[/{COLOR_PALETTE['GENERAL']['COLDKEY']}] for [{COLOR_PALETTE['GENERAL']['COLDKEY']}]coldkey[/{COLOR_PALETTE['GENERAL']['COLDKEY']}]] (default is [{COLOR_PALETTE['GENERAL']['COLDKEY']}]coldkey[/{COLOR_PALETTE['GENERAL']['COLDKEY']}])",
f"Would you like to sign the transaction using your [{COLORS.G.HK}]hotkey[/{COLORS.G.HK}]?"
f"\n[Type [{COLORS.G.HK}]y[/{COLORS.G.HK}] for [{COLORS.G.HK}]hotkey[/{COLORS.G.HK}]"
f" and [{COLORS.G.CK}]n[/{COLORS.G.CK}] for [{COLORS.G.CK}]coldkey[/{COLORS.G.CK}]] "
f"(default is [{COLORS.G.CK}]coldkey[/{COLORS.G.CK}])",
default=False,
)

Expand Down Expand Up @@ -3035,11 +3037,11 @@ def stake_add(
raise typer.Exit()
if netuid is not None:
amount = FloatPrompt.ask(
f"Amount to [{COLOR_PALETTE['GENERAL']['SUBHEADING_MAIN']}]stake (TAO τ)"
f"Amount to [{COLORS.G.SUBHEAD_MAIN}]stake (TAO τ)"
)
else:
amount = FloatPrompt.ask(
f"Amount to [{COLOR_PALETTE['GENERAL']['SUBHEADING_MAIN']}]stake to each netuid (TAO τ)"
f"Amount to [{COLORS.G.SUBHEAD_MAIN}]stake to each netuid (TAO τ)"
)

if amount <= 0:
Expand Down Expand Up @@ -4112,7 +4114,8 @@ def sudo_set(
if not param_value:
if HYPERPARAMS.get(param_name):
param_value = Prompt.ask(
f"Enter the new value for [{COLOR_PALETTE['GENERAL']['SUBHEADING']}]{param_name}[/{COLOR_PALETTE['GENERAL']['SUBHEADING']}] in the VALUE column format"
f"Enter the new value for [{COLORS.G.SUBHEAD}]{param_name}[/{COLORS.G.SUBHEAD}] "
f"in the VALUE column format"
)
else:
param_value = None
Expand Down
163 changes: 105 additions & 58 deletions bittensor_cli/src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,64 +721,111 @@ class WalletValidationTypes(Enum):
},
}

COLOR_PALETTE = {
"GENERAL": {
"HEADER": "#4196D6", # Light Blue
"LINKS": "#8CB9E9", # Sky Blue
"HINT": "#A2E5B8", # Mint Green
"COLDKEY": "#9EF5E4", # Aqua
"HOTKEY": "#ECC39D", # Light Orange/Peach
"SUBHEADING_MAIN": "#7ECFEC", # Light Cyan
"SUBHEADING": "#AFEFFF", # Pale Blue
"SUBHEADING_EXTRA_1": "#96A3C5", # Grayish Blue
"SUBHEADING_EXTRA_2": "#6D7BAF", # Slate Blue
"CONFIRMATION_Y_N_Q": "#EE8DF8", # Light Purple/Pink
"SYMBOL": "#E7CC51", # Gold
"BALANCE": "#4F91C6", # Medium Blue
"COST": "#53B5A0", # Teal
"SUCCESS": "#53B5A0", # Teal
"NETUID": "#CBA880", # Tan
"NETUID_EXTRA": "#DDD5A9", # Light Khaki
"TEMPO": "#67A3A5", # Grayish Teal
},
"STAKE": {
"STAKE_AMOUNT": "#53B5A0", # Teal
"STAKE_ALPHA": "#53B5A0", # Teal
"STAKE_SWAP": "#67A3A5", # Grayish Teal
"TAO": "#4F91C6", # Medium Blue
"SLIPPAGE_TEXT": "#C25E7C", # Rose
"SLIPPAGE_PERCENT": "#E7B195", # Light Coral
"NOT_REGISTERED": "#EB6A6C", # Salmon Red
"EXTRA_1": "#D781BB", # Pink
},
"POOLS": {
"TAO": "#4F91C6", # Medium Blue
"ALPHA_IN": "#D09FE9", # Light Purple
"ALPHA_OUT": "#AB7CC8", # Medium Purple
"RATE": "#F8D384", # Light Orange
"TAO_EQUIV": "#8CB9E9", # Sky Blue
"EMISSION": "#F8D384", # Light Orange
"EXTRA_1": "#CAA8FB", # Lavender
"EXTRA_2": "#806DAF", # Dark Purple
},
"GREY": {
"GREY_100": "#F8F9FA", # Almost White
"GREY_200": "#F1F3F4", # Very Light Grey
"GREY_300": "#DBDDE1", # Light Grey
"GREY_400": "#BDC1C6", # Medium Light Grey
"GREY_500": "#5F6368", # Medium Grey
"GREY_600": "#2E3134", # Medium Dark Grey
"GREY_700": "#282A2D", # Dark Grey
"GREY_800": "#17181B", # Very Dark Grey
"GREY_900": "#0E1013", # Almost Black
"BLACK": "#000000", # Pure Black
},
"SUDO": {
"HYPERPARAMETER": "#4F91C6", # Medium Blue
"VALUE": "#D09FE9", # Light Purple
"NORMALIZED": "#AB7CC8", # Medium Purple
},
}

class Gettable:
def __getitem__(self, item):
return getattr(self, item)


class ColorPalette(Gettable):
def __init__(self):
self.GENERAL = self.General()
self.STAKE = self.Stake()
self.POOLS = self.Pools()
self.GREY = self.Grey()
self.SUDO = self.Sudo()
# aliases
self.G = self.GENERAL
self.S = self.STAKE
self.P = self.POOLS
self.GR = self.GREY
self.SU = self.SUDO

class General(Gettable):
HEADER = "#4196D6" # Light Blue
LINKS = "#8CB9E9" # Sky Blue
HINT = "#A2E5B8" # Mint Green
COLDKEY = "#9EF5E4" # Aqua
HOTKEY = "#ECC39D" # Light Orange/Peach
SUBHEADING_MAIN = "#7ECFEC" # Light Cyan
SUBHEADING = "#AFEFFF" # Pale Blue
SUBHEADING_EXTRA_1 = "#96A3C5" # Grayish Blue
SUBHEADING_EXTRA_2 = "#6D7BAF" # Slate Blue
CONFIRMATION_Y_N_Q = "#EE8DF8" # Light Purple/Pink
SYMBOL = "#E7CC51" # Gold
BALANCE = "#4F91C6" # Medium Blue
COST = "#53B5A0" # Teal
SUCCESS = "#53B5A0" # Teal
NETUID = "#CBA880" # Tan
NETUID_EXTRA = "#DDD5A9" # Light Khaki
TEMPO = "#67A3A5" # Grayish Teal
# aliases
CK = COLDKEY
HK = HOTKEY
SUBHEAD_MAIN = SUBHEADING_MAIN
SUBHEAD = SUBHEADING
SUBHEAD_EX_1 = SUBHEADING_EXTRA_1
SUBHEAD_EX_2 = SUBHEADING_EXTRA_2
SYM = SYMBOL
BAL = BALANCE

class Stake(Gettable):
STAKE_AMOUNT = "#53B5A0" # Teal
STAKE_ALPHA = "#53B5A0" # Teal
STAKE_SWAP = "#67A3A5" # Grayish Teal
TAO = "#4F91C6" # Medium Blue
SLIPPAGE_TEXT = "#C25E7C" # Rose
SLIPPAGE_PERCENT = "#E7B195" # Light Coral
NOT_REGISTERED = "#EB6A6C" # Salmon Red
EXTRA_1 = "#D781BB" # Pink
# aliases
AMOUNT = STAKE_AMOUNT
ALPHA = STAKE_ALPHA
SWAP = STAKE_SWAP

class Pools(Gettable):
TAO = "#4F91C6" # Medium Blue
ALPHA_IN = "#D09FE9" # Light Purple
ALPHA_OUT = "#AB7CC8" # Medium Purple
RATE = "#F8D384" # Light Orange
TAO_EQUIV = "#8CB9E9" # Sky Blue
EMISSION = "#F8D384" # Light Orange
EXTRA_1 = "#CAA8FB" # Lavender
EXTRA_2 = "#806DAF" # Dark Purple

class Grey(Gettable):
GREY_100 = "#F8F9FA" # Almost White
GREY_200 = "#F1F3F4" # Very Light Grey
GREY_300 = "#DBDDE1" # Light Grey
GREY_400 = "#BDC1C6" # Medium Light Grey
GREY_500 = "#5F6368" # Medium Grey
GREY_600 = "#2E3134" # Medium Dark Grey
GREY_700 = "#282A2D" # Dark Grey
GREY_800 = "#17181B" # Very Dark Grey
GREY_900 = "#0E1013" # Almost Black
BLACK = "#000000" # Pure Black
# aliases
G_100 = GREY_100
G_200 = GREY_200
G_300 = GREY_300
G_400 = GREY_400
G_500 = GREY_500
G_600 = GREY_600
G_700 = GREY_700
G_800 = GREY_800
G_900 = GREY_900

class Sudo(Gettable):
HYPERPARAMETER = "#4F91C6" # Medium Blue
VALUE = "#D09FE9" # Light Purple
NORMALIZED = "#AB7CC8" # Medium Purple
# aliases
HYPERPARAM = HYPERPARAMETER
NORMAL = NORMALIZED


COLOR_PALETTE = ColorPalette()
COLORS = COLOR_PALETTE


SUBNETS = {
Expand Down
2 changes: 1 addition & 1 deletion bittensor_cli/src/commands/subnets/subnets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ async def pow_register(
use_cuda,
dev_id,
threads_per_block,
prompt: bool
prompt: bool,
):
"""Register neuron."""

Expand Down
Loading