yzsp-studio/mediakit-shared-suite / ppt
ppt
Unverified飞书幻灯片:创建和编辑幻灯片。创建演示文稿、读取幻灯片内容、管理幻灯片页面(创建、删除、读取、局部替换)。当用户需要创建或编辑幻灯片、读取或修改单个页面时使用。
scripts/svg_relation_lib/attributes/category.py
View on GitHub"""
A5 · Category attribute · categorical group / cluster
字段:group (v1 alias: category)
默认视觉通道:color_categorical (palette 里循环)
备用通道:halo_border (给 node 加外圈)
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Optional, Tuple
_DEFAULT_PALETTE = [
"#2563eb", # blue-600
"#dc2626", # red-600
"#16a34a", # green-600
"#f59e0b", # amber-500
"#7c3aed", # violet-600
"#0891b2", # cyan-600
"#db2777", # pink-600
"#65a30d", # lime-600
]
@dataclass
class Category:
"""Category attribute · 离散分组。"""
field_name: str = "group"
v1_aliases: Tuple[str, ...] = ("category", "cluster", "class")
channel: str = "color_categorical"
fallback_channel: str = "halo_border"
def resolve_value(self, element: dict) -> Optional[str]:
for name in (self.field_name,) + tuple(self.v1_aliases):
if name in element and element[name] is not None:
return str(element[name])
return None
def encode(self, value: str, channel: str, palette=None) -> dict:
pal = palette if palette else _DEFAULT_PALETTE
idx = abs(hash(value)) % max(len(pal), 1)
color = pal[idx]
if channel == "color_categorical":
return {"fill": color, "stroke": color}
if channel == "halo_border":
return {"halo-color": color, "halo-width": 3}
return {}
DEFAULT_CATEGORY = Category()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |