refactor(hermes_cli): skin_engine style overrides as palette+template tables; branding/wings builders; drop bundle getattr shims
This commit is contained in:
+14
-28
@@ -43,11 +43,7 @@ _EXTRA_META_LABELS = (
|
||||
|
||||
def _display_source(r) -> str:
|
||||
"""Source label for a result row: GitHub-tap rows surface their per-tap provider label."""
|
||||
if r.source == "github":
|
||||
provider = (getattr(r, "extra", None) or {}).get("provider")
|
||||
if provider:
|
||||
return provider
|
||||
return r.source
|
||||
return ((r.extra or {}).get("provider") if r.source == "github" else None) or r.source
|
||||
|
||||
|
||||
def _trust_cell(trust_level: str, source: str, official_label: str = "official") -> str:
|
||||
@@ -174,8 +170,6 @@ def _skill_md_preview(bundle) -> Optional[str]:
|
||||
|
||||
def _format_extra_metadata_lines(extra: Dict[str, Any]) -> list[str]:
|
||||
lines: list[str] = []
|
||||
if not extra:
|
||||
return lines
|
||||
for key, label in _EXTRA_META_LABELS:
|
||||
value = extra.get(key)
|
||||
if value is not None and (value or key == "installs"): # installs: 0 is still shown
|
||||
@@ -366,13 +360,12 @@ def do_search(query: str, source: str = "all", limit: int = 10, console: Optiona
|
||||
def _rank_and_page(all_results, page: int, page_size: int):
|
||||
"""Dedupe by identifier (higher trust wins; names are NOT unique across browse-sh sites),
|
||||
sort official-first, slice one page -> (deduped, page_items, page, total_pages, start)."""
|
||||
rank = lambda r: _TRUST_RANK.get(r.trust_level, 0) # noqa: E731
|
||||
seen: dict = {}
|
||||
for r in all_results:
|
||||
rank = _TRUST_RANK.get(r.trust_level, 0)
|
||||
if r.identifier not in seen or rank > _TRUST_RANK.get(seen[r.identifier].trust_level, 0):
|
||||
if r.identifier not in seen or rank(r) > rank(seen[r.identifier]):
|
||||
seen[r.identifier] = r
|
||||
deduped = sorted(seen.values(), key=lambda r: (
|
||||
-_TRUST_RANK.get(r.trust_level, 0), r.source != "official", r.name.lower()))
|
||||
deduped = sorted(seen.values(), key=lambda r: (-rank(r), r.source != "official", r.name.lower()))
|
||||
total_pages = max(1, (len(deduped) + page_size - 1) // page_size)
|
||||
page = max(1, min(page, total_pages))
|
||||
start = (page - 1) * page_size
|
||||
@@ -530,7 +523,7 @@ def _resolve_url_bundle_name(c: Console, bundle, meta, identifier: str,
|
||||
name_override: str, skip_confirm: bool) -> bool:
|
||||
"""Name a URL-sourced bundle whose SKILL.md has none: --name override, else TTY prompt,
|
||||
else an actionable refusal on non-interactive surfaces. False => abort the install."""
|
||||
bundle_meta = getattr(bundle, "metadata", {}) or {}
|
||||
bundle_meta = bundle.metadata
|
||||
if bundle.source != "url" or (bundle.name and not bundle_meta.get("awaiting_name")):
|
||||
return True
|
||||
url = bundle_meta.get("url") or identifier
|
||||
@@ -631,11 +624,8 @@ def _scan_quarantined(c: Console, q_path: Path, bundle, meta, identifier: str):
|
||||
from tools.skills_hub import HUB_DIR, source_url_for_bundle
|
||||
from tools.skills_guard import scan_skill_cached, format_scan_report
|
||||
c.print("[bold]Running security scan...[/]")
|
||||
if bundle.source == "official":
|
||||
scan_source = "official"
|
||||
else:
|
||||
scan_source = (getattr(bundle, "identifier", "") or getattr(meta, "identifier", "")
|
||||
or identifier)
|
||||
scan_source = ("official" if bundle.source == "official"
|
||||
else bundle.identifier or getattr(meta, "identifier", "") or identifier)
|
||||
result, prov = scan_skill_cached(
|
||||
q_path, source=scan_source, source_url=source_url_for_bundle(bundle),
|
||||
cache_dir=HUB_DIR / "scan-cache")
|
||||
@@ -716,8 +706,7 @@ def do_install(identifier: str, category: str = "", force: bool = False,
|
||||
c.print("Use --force to reinstall.\n")
|
||||
return
|
||||
|
||||
extra_metadata = dict(getattr(meta, "extra", {}) or {})
|
||||
extra_metadata.update(getattr(bundle, "metadata", {}) or {})
|
||||
extra_metadata = {**(getattr(meta, "extra", {}) or {}), **bundle.metadata}
|
||||
|
||||
try:
|
||||
q_path = quarantine_bundle(bundle)
|
||||
@@ -903,12 +892,10 @@ def do_audit(name: Optional[str] = None, console: Optional[Console] = None,
|
||||
if not installed:
|
||||
c.print("[dim]No hub-installed skills to audit.[/]\n")
|
||||
return
|
||||
targets = installed
|
||||
if name:
|
||||
targets = [e for e in installed if e["name"] == name]
|
||||
if not targets:
|
||||
_print_error(c, f"'{name}' is not a hub-installed skill.")
|
||||
return
|
||||
targets = [e for e in installed if e["name"] == name] if name else installed
|
||||
if not targets:
|
||||
_print_error(c, f"'{name}' is not a hub-installed skill.")
|
||||
return
|
||||
c.print(f"\n[bold]Auditing {len(targets)} skill(s)...[/]\n")
|
||||
if deep:
|
||||
from tools.skills_ast_audit import ast_scan_path, format_ast_report
|
||||
@@ -1108,8 +1095,7 @@ def do_tap(action: str, repo: str = "", console: Optional[Console] = None) -> No
|
||||
return
|
||||
table = _table(("Repo", {"style": "bold cyan"}), "Path", title="Configured Taps")
|
||||
for t in taps:
|
||||
label = t.get("repo") or t.get("name") or t.get("path", "unknown")
|
||||
table.add_row(label, t.get("path", "skills/"))
|
||||
table.add_row(t.get("repo") or t.get("name") or t.get("path", "unknown"), t.get("path", "skills/"))
|
||||
c.print(table)
|
||||
c.print()
|
||||
elif action in _TAP_OPS:
|
||||
@@ -1144,7 +1130,7 @@ def do_publish(skill_path: str, target: str = "github", repo: str = "",
|
||||
path = Path(skill_path)
|
||||
if not path.is_absolute():
|
||||
path = SKILLS_DIR / path
|
||||
if not path.exists() or not (path / "SKILL.md").exists():
|
||||
if not (path / "SKILL.md").exists():
|
||||
_print_error(c, f"No SKILL.md found at {path}")
|
||||
return
|
||||
skill_md = (path / "SKILL.md").read_text(encoding="utf-8").lstrip("\ufeff") # tolerate BOM
|
||||
|
||||
+81
-109
@@ -31,21 +31,33 @@ class SkinConfig:
|
||||
def get_color(self, key: str, fallback: str = "") -> str:
|
||||
return self.colors.get(key, fallback)
|
||||
|
||||
def get_branding(self, key: str, fallback: str = "") -> str:
|
||||
return self.branding.get(key, fallback)
|
||||
|
||||
def get_spinner_wings(self) -> List[Tuple[str, str]]:
|
||||
"""Spinner wing pairs, or empty list if none."""
|
||||
return [(str(pair[0]), str(pair[1])) for pair in self.spinner.get("wings", [])
|
||||
if isinstance(pair, (list, tuple)) and len(pair) == 2]
|
||||
|
||||
def get_branding(self, key: str, fallback: str = "") -> str:
|
||||
return self.branding.get(key, fallback)
|
||||
|
||||
def _branding(who: str, symbol: str, goodbye: str, prompt: str = "", help_header: str = "") -> Dict[str, str]:
|
||||
"""Branding block for a "<who> Agent" persona keyed by its glyph."""
|
||||
return {
|
||||
"agent_name": f"{who} Agent",
|
||||
"welcome": f"Welcome to {who} Agent! Type your message or /help for commands.",
|
||||
"goodbye": goodbye, "response_label": f" {symbol} {who} ", "prompt_symbol": prompt or symbol,
|
||||
"help_header": help_header or f"({symbol}) Available Commands"}
|
||||
|
||||
|
||||
def _wings(*glyphs) -> List[List[str]]:
|
||||
"""Spinner wing pairs `⟪g` / `g⟫`; a (left, right) tuple gives asymmetric glyphs."""
|
||||
return [[f"⟪{g[0] if isinstance(g, tuple) else g}", f"{g[1] if isinstance(g, tuple) else g}⟫"]
|
||||
for g in glyphs]
|
||||
|
||||
|
||||
# Branding shared by every Hermes-named built-in (mono/daylight override help_header).
|
||||
_HERMES_BRANDING: Dict[str, str] = {
|
||||
"agent_name": "Hermes Agent",
|
||||
"welcome": "Welcome to Hermes Agent! Type your message or /help for commands.",
|
||||
"goodbye": "Goodbye! ⚕", "response_label": " ⚕ Hermes ", "prompt_symbol": "❯",
|
||||
"help_header": "(^_^)? Available Commands"}
|
||||
_HERMES_BRANDING: Dict[str, str] = _branding(
|
||||
"Hermes", "⚕", "Goodbye! ⚕", prompt="❯", help_header="(^_^)? Available Commands")
|
||||
|
||||
_BUILTIN_SKINS: Dict[str, Dict[str, Any]] = {
|
||||
"default": {
|
||||
@@ -101,12 +113,8 @@ _BUILTIN_SKINS: Dict[str, Dict[str, Any]] = {
|
||||
"thinking_verbs": [
|
||||
"forging", "marching", "sizing the field", "holding the line",
|
||||
"hammering plans", "tempering steel", "plotting impact", "raising the shield"],
|
||||
"wings": [["⟪⚔", "⚔⟫"], ["⟪▲", "▲⟫"], ["⟪╸", "╺⟫"], ["⟪⛨", "⛨⟫"]]},
|
||||
"branding": {
|
||||
"agent_name": "Ares Agent",
|
||||
"welcome": "Welcome to Ares Agent! Type your message or /help for commands.",
|
||||
"goodbye": "Farewell, warrior! ⚔", "response_label": " ⚔ Ares ", "prompt_symbol": "⚔",
|
||||
"help_header": "(⚔) Available Commands"},
|
||||
"wings": _wings("⚔", "▲", ("╸", "╺"), "⛨")},
|
||||
"branding": _branding("Ares", "⚔", "Farewell, warrior! ⚔"),
|
||||
"tool_prefix": "╎",
|
||||
"banner_logo": """[bold #A3261F] █████╗ ██████╗ ███████╗███████╗ █████╗ ██████╗ ███████╗███╗ ██╗████████╗[/]
|
||||
[bold #B73122]██╔══██╗██╔══██╗██╔════╝██╔════╝ ██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝[/]
|
||||
@@ -218,12 +226,8 @@ _BUILTIN_SKINS: Dict[str, Dict[str, Any]] = {
|
||||
"charting currents", "sounding the depth", "reading foam lines",
|
||||
"steering the trident", "tracking undertow", "plotting sea lanes",
|
||||
"calling the swell", "measuring pressure"],
|
||||
"wings": [["⟪≈", "≈⟫"], ["⟪Ψ", "Ψ⟫"], ["⟪∿", "∿⟫"], ["⟪◌", "◌⟫"]]},
|
||||
"branding": {
|
||||
"agent_name": "Poseidon Agent",
|
||||
"welcome": "Welcome to Poseidon Agent! Type your message or /help for commands.",
|
||||
"goodbye": "Fair winds! Ψ", "response_label": " Ψ Poseidon ", "prompt_symbol": "Ψ",
|
||||
"help_header": "(Ψ) Available Commands"},
|
||||
"wings": _wings("≈", "Ψ", "∿", "◌")},
|
||||
"branding": _branding("Poseidon", "Ψ", "Fair winds! Ψ"),
|
||||
"tool_prefix": "│",
|
||||
"banner_logo": """[bold #B8E8FF]██████╗ ██████╗ ███████╗███████╗██╗██████╗ ██████╗ ███╗ ██╗ █████╗ ██████╗ ███████╗███╗ ██╗████████╗[/]
|
||||
[bold #97D6FF]██╔══██╗██╔═══██╗██╔════╝██╔════╝██║██╔══██╗██╔═══██╗████╗ ██║ ██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝[/]
|
||||
@@ -266,12 +270,8 @@ _BUILTIN_SKINS: Dict[str, Dict[str, Any]] = {
|
||||
"finding traction", "measuring the grade", "resetting the boulder",
|
||||
"counting the ascent", "testing leverage", "setting the shoulder",
|
||||
"pushing uphill", "enduring the loop"],
|
||||
"wings": [["⟪◉", "◉⟫"], ["⟪◬", "◬⟫"], ["⟪◌", "◌⟫"], ["⟪⬤", "⬤⟫"]]},
|
||||
"branding": {
|
||||
"agent_name": "Sisyphus Agent",
|
||||
"welcome": "Welcome to Sisyphus Agent! Type your message or /help for commands.",
|
||||
"goodbye": "The boulder waits. ◉", "response_label": " ◉ Sisyphus ",
|
||||
"prompt_symbol": "◉", "help_header": "(◉) Available Commands"},
|
||||
"wings": _wings("◉", "◬", "◌", "⬤")},
|
||||
"branding": _branding("Sisyphus", "◉", "The boulder waits. ◉"),
|
||||
"tool_prefix": "│",
|
||||
"banner_logo": """[bold #F5F5F5]███████╗██╗███████╗██╗ ██╗██████╗ ██╗ ██╗██╗ ██╗███████╗ █████╗ ██████╗ ███████╗███╗ ██╗████████╗[/]
|
||||
[bold #E7E7E7]██╔════╝██║██╔════╝╚██╗ ██╔╝██╔══██╗██║ ██║██║ ██║██╔════╝ ██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝[/]
|
||||
@@ -316,12 +316,8 @@ _BUILTIN_SKINS: Dict[str, Dict[str, Any]] = {
|
||||
"banking into the draft", "measuring burn", "reading the updraft",
|
||||
"tracking ember fall", "setting wing angle", "holding the flame core",
|
||||
"plotting a hot landing", "coiling for lift"],
|
||||
"wings": [["⟪✦", "✦⟫"], ["⟪▲", "▲⟫"], ["⟪◌", "◌⟫"], ["⟪◇", "◇⟫"]]},
|
||||
"branding": {
|
||||
"agent_name": "Charizard Agent",
|
||||
"welcome": "Welcome to Charizard Agent! Type your message or /help for commands.",
|
||||
"goodbye": "Flame out! ✦", "response_label": " ✦ Charizard ", "prompt_symbol": "✦",
|
||||
"help_header": "(✦) Available Commands"},
|
||||
"wings": _wings("✦", "▲", "◌", "◇")},
|
||||
"branding": _branding("Charizard", "✦", "Flame out! ✦"),
|
||||
"tool_prefix": "│",
|
||||
"banner_logo": """[bold #FFF0D4] ██████╗██╗ ██╗ █████╗ ██████╗ ██╗███████╗ █████╗ ██████╗ ██████╗ █████╗ ██████╗ ███████╗███╗ ██╗████████╗[/]
|
||||
[bold #FFD39A]██╔════╝██║ ██║██╔══██╗██╔══██╗██║╚══███╔╝██╔══██╗██╔══██╗██╔══██╗ ██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝[/]
|
||||
@@ -398,28 +394,21 @@ def list_skins() -> List[Dict[str, str]]:
|
||||
result = [{"name": name, "description": data.get("description", ""), "source": "builtin"}
|
||||
for name, data in _BUILTIN_SKINS.items()]
|
||||
skins_path = _skins_dir()
|
||||
if skins_path.is_dir():
|
||||
for f in sorted(skins_path.glob("*.yaml")):
|
||||
data = _load_skin_from_yaml(f)
|
||||
if data:
|
||||
skin_name = data.get("name", f.stem)
|
||||
if any(s["name"] == skin_name for s in result):
|
||||
continue
|
||||
result.append({"name": skin_name, "description": data.get("description", ""), "source": "user"})
|
||||
for f in sorted(skins_path.glob("*.yaml")) if skins_path.is_dir() else ():
|
||||
data = _load_skin_from_yaml(f)
|
||||
if data and not any(s["name"] == data.get("name", f.stem) for s in result):
|
||||
result.append({"name": data.get("name", f.stem), "description": data.get("description", ""),
|
||||
"source": "user"})
|
||||
return result
|
||||
|
||||
|
||||
def load_skin(name: str) -> SkinConfig:
|
||||
"""Load a skin by name: user skins first, then built-in, then default."""
|
||||
user_file = _skins_dir() / f"{name}.yaml"
|
||||
if user_file.is_file():
|
||||
data = _load_skin_from_yaml(user_file)
|
||||
if data:
|
||||
return _build_skin_config(data)
|
||||
if name in _BUILTIN_SKINS:
|
||||
return _build_skin_config(_BUILTIN_SKINS[name])
|
||||
logger.warning("Skin '%s' not found, using default", name)
|
||||
return _build_skin_config(_BUILTIN_SKINS["default"])
|
||||
data = _load_skin_from_yaml(user_file) if user_file.is_file() else None
|
||||
if not data and name not in _BUILTIN_SKINS:
|
||||
logger.warning("Skin '%s' not found, using default", name)
|
||||
return _build_skin_config(data or _BUILTIN_SKINS.get(name) or _BUILTIN_SKINS["default"])
|
||||
|
||||
|
||||
def get_active_skin() -> SkinConfig:
|
||||
@@ -470,6 +459,46 @@ def get_active_goodbye(fallback: str = "Goodbye! ⚕") -> str:
|
||||
return _active_branding("goodbye", fallback)
|
||||
|
||||
|
||||
# Palette resolution order for prompt_toolkit styles: (name, skin color key, fallback). A
|
||||
# fallback starting with "@" names an earlier entry (so a missing key inherits its remapped value).
|
||||
_STYLE_PALETTE = (
|
||||
("prompt", "prompt", ""), ("input_rule", "input_rule", "#CD7F32"),
|
||||
("title", "banner_title", "#FFD700"), ("text", "banner_text", "#FFF8DC"),
|
||||
("dim", "banner_dim", "#555555"), ("label", "ui_label", "@title"), ("warn", "ui_warn", "#FF8C00"),
|
||||
("error", "ui_error", "#FF6B6B"), ("status_bg", "status_bar_bg", "#1a1a2e"),
|
||||
("status_text", "status_bar_text", "@text"), ("status_strong", "status_bar_strong", "@title"),
|
||||
("status_dim", "status_bar_dim", "@dim"), ("ok", "ui_ok", "#8FBC8F"),
|
||||
("status_good", "status_bar_good", "@ok"), ("status_warn", "status_bar_warn", "@warn"),
|
||||
("accent", "banner_accent", "@warn"), ("status_bad", "status_bar_bad", "@accent"),
|
||||
("status_critical", "status_bar_critical", "@error"), ("voice_bg", "voice_status_bg", "@status_bg"),
|
||||
("menu_bg", "completion_menu_bg", "#1a1a2e"), ("menu_current_bg", "completion_menu_current_bg", "#333355"),
|
||||
("menu_meta_bg", "completion_menu_meta_bg", "@menu_bg"),
|
||||
("menu_meta_current_bg", "completion_menu_meta_current_bg", "@menu_current_bg"))
|
||||
|
||||
# prompt_toolkit style class -> format template over the resolved palette names.
|
||||
_STYLE_TEMPLATES = {
|
||||
"input-area": "", # terminal default fg/bg — `prompt` styles the symbol, NOT typed text
|
||||
"placeholder": "{dim} italic", "prompt": "{prompt}", "prompt-working": "{dim} italic",
|
||||
"hint": "{dim} italic",
|
||||
"status-bar": "bg:{status_bg} {status_text}", "status-bar-strong": "bg:{status_bg} {status_strong} bold",
|
||||
"status-bar-dim": "bg:{status_bg} {status_dim}", "status-bar-good": "bg:{status_bg} {status_good} bold",
|
||||
"status-bar-warn": "bg:{status_bg} {status_warn} bold", "status-bar-bad": "bg:{status_bg} {status_bad} bold",
|
||||
"status-bar-critical": "bg:{status_bg} {status_critical} bold",
|
||||
"input-rule": "{input_rule}", "image-badge": "{label} bold",
|
||||
"completion-menu": "bg:{menu_bg} {text}", "completion-menu.completion": "bg:{menu_bg} {text}",
|
||||
"completion-menu.completion.current": "bg:{menu_current_bg} {title}",
|
||||
"completion-menu.meta.completion": "bg:{menu_meta_bg} {dim}",
|
||||
"completion-menu.meta.completion.current": "bg:{menu_meta_current_bg} {label}",
|
||||
"clarify-border": "{input_rule}", "clarify-title": "{title} bold", "clarify-question": "{text} bold",
|
||||
"clarify-choice": "{dim}", "clarify-selected": "{title} bold", "clarify-active-other": "{title} italic",
|
||||
"clarify-countdown": "{input_rule}",
|
||||
"sudo-prompt": "{error} bold", "sudo-border": "{input_rule}", "sudo-title": "{error} bold",
|
||||
"sudo-text": "{text}",
|
||||
"approval-border": "{input_rule}", "approval-title": "{warn} bold", "approval-desc": "{text} bold",
|
||||
"approval-cmd": "{dim} italic", "approval-choice": "{dim}", "approval-selected": "{title} bold",
|
||||
"voice-status": "bg:{voice_bg} {label}", "voice-status-recording": "bg:{voice_bg} {error} bold"}
|
||||
|
||||
|
||||
def get_prompt_toolkit_style_overrides() -> Dict[str, str]:
|
||||
"""Return prompt_toolkit style overrides derived from the active skin."""
|
||||
try:
|
||||
@@ -478,65 +507,8 @@ def get_prompt_toolkit_style_overrides() -> Dict[str, str]:
|
||||
return {}
|
||||
# `prompt` is unset by default so typed text inherits the terminal's foreground (readable
|
||||
# on light and dark schemes); skins opt into a colored prompt symbol via `prompt` in YAML.
|
||||
c = skin.get_color
|
||||
prompt = c("prompt", "")
|
||||
input_rule = c("input_rule", "#CD7F32")
|
||||
title = c("banner_title", "#FFD700")
|
||||
text = c("banner_text", "#FFF8DC")
|
||||
dim = c("banner_dim", "#555555")
|
||||
label = c("ui_label", title)
|
||||
warn = c("ui_warn", "#FF8C00")
|
||||
error = c("ui_error", "#FF6B6B")
|
||||
status_bg = c("status_bar_bg", "#1a1a2e")
|
||||
status_text = c("status_bar_text", text)
|
||||
status_strong = c("status_bar_strong", title)
|
||||
status_dim = c("status_bar_dim", dim)
|
||||
status_good = c("status_bar_good", c("ui_ok", "#8FBC8F"))
|
||||
status_warn = c("status_bar_warn", warn)
|
||||
status_bad = c("status_bar_bad", c("banner_accent", warn))
|
||||
status_critical = c("status_bar_critical", error)
|
||||
voice_bg = c("voice_status_bg", status_bg)
|
||||
menu_bg = c("completion_menu_bg", "#1a1a2e")
|
||||
menu_current_bg = c("completion_menu_current_bg", "#333355")
|
||||
menu_meta_bg = c("completion_menu_meta_bg", menu_bg)
|
||||
menu_meta_current_bg = c("completion_menu_meta_current_bg", menu_current_bg)
|
||||
|
||||
return {
|
||||
"input-area": "", # terminal default fg/bg — `prompt` styles the symbol, NOT typed text
|
||||
"placeholder": f"{dim} italic",
|
||||
"prompt": prompt,
|
||||
"prompt-working": f"{dim} italic",
|
||||
"hint": f"{dim} italic",
|
||||
"status-bar": f"bg:{status_bg} {status_text}",
|
||||
"status-bar-strong": f"bg:{status_bg} {status_strong} bold",
|
||||
"status-bar-dim": f"bg:{status_bg} {status_dim}",
|
||||
"status-bar-good": f"bg:{status_bg} {status_good} bold",
|
||||
"status-bar-warn": f"bg:{status_bg} {status_warn} bold",
|
||||
"status-bar-bad": f"bg:{status_bg} {status_bad} bold",
|
||||
"status-bar-critical": f"bg:{status_bg} {status_critical} bold",
|
||||
"input-rule": input_rule,
|
||||
"image-badge": f"{label} bold",
|
||||
"completion-menu": f"bg:{menu_bg} {text}",
|
||||
"completion-menu.completion": f"bg:{menu_bg} {text}",
|
||||
"completion-menu.completion.current": f"bg:{menu_current_bg} {title}",
|
||||
"completion-menu.meta.completion": f"bg:{menu_meta_bg} {dim}",
|
||||
"completion-menu.meta.completion.current": f"bg:{menu_meta_current_bg} {label}",
|
||||
"clarify-border": input_rule,
|
||||
"clarify-title": f"{title} bold",
|
||||
"clarify-question": f"{text} bold",
|
||||
"clarify-choice": dim,
|
||||
"clarify-selected": f"{title} bold",
|
||||
"clarify-active-other": f"{title} italic",
|
||||
"clarify-countdown": input_rule,
|
||||
"sudo-prompt": f"{error} bold",
|
||||
"sudo-border": input_rule,
|
||||
"sudo-title": f"{error} bold",
|
||||
"sudo-text": text,
|
||||
"approval-border": input_rule,
|
||||
"approval-title": f"{warn} bold",
|
||||
"approval-desc": f"{text} bold",
|
||||
"approval-cmd": f"{dim} italic",
|
||||
"approval-choice": dim,
|
||||
"approval-selected": f"{title} bold",
|
||||
"voice-status": f"bg:{voice_bg} {label}",
|
||||
"voice-status-recording": f"bg:{voice_bg} {error} bold"}
|
||||
# Every read goes through skin.get_color (cli.py wraps it for light-mode remapping).
|
||||
palette: Dict[str, str] = {}
|
||||
for name, key, fallback in _STYLE_PALETTE:
|
||||
palette[name] = skin.get_color(key, palette[fallback[1:]] if fallback.startswith("@") else fallback)
|
||||
return {cls: tpl.format(**palette) for cls, tpl in _STYLE_TEMPLATES.items()}
|
||||
|
||||
Reference in New Issue
Block a user