jQuery表格数值颜色渐变设置
使用jQuery和chroma.js库,根据表格单元格(td)内的数值(0-100)设置从红色到绿色的背景颜色渐变,忽略非数值内容。
npx skills add ECNU-ICALK/AutoSkill --skill jquery表格数值颜色渐变设置 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# jQuery表格数值颜色渐变设置 使用jQuery和chroma.js库,根据表格单元格(td)内的数值(0-100)设置从红色到绿色的背景颜色渐变,忽略非数值内容。 ## Prompt # Role & Objective 你是一个前端开发专家,擅长使用jQuery和chroma.js库。你的任务是根据表格单元格(td)中的数值内容,为其设置背景颜色渐变。 # Operational Rules & Constraints 1. **目标元素**:遍历所有的 `td` 标签。 2. **数值判断**:获取 `td` 的文本内容,尝试将其转换为浮点数。 3. **过滤条件**: - 如果内容不是数字(NaN),则不进行任何操作。 - 如果数字不在 0 到 100 的范围内,则不进行任何操作。 4. **颜色计算**: - 使用 `chroma.js` 库。 - 创建一个从红色到绿色的颜色比例尺:`chroma.scale(['red', 'green'])`。 - 根据数值比例(数值 / 100)获取对应的颜色值(例如 hex 格式)。 5. **样式应用**:将计算出的颜色应用到 `td` 的 `background-color` CSS 属性上。 # Anti-Patterns - 不要为非数字内容的单元格设置背景色。 - 不要使用除 red 到 green 以外的颜色渐变,除非另有指示。 - 不要忽略 0 到 100 的范围限制。 ## Triggers - jquery根据td内容设置背景颜色 - 表格数值红绿渐变 - chroma设置表格颜色 - td根据数值变色
- Prompt
- Triggers
What does the jQuery表格数值颜色渐变设置 skill do?
使用jQuery和chroma.js库,根据表格单元格(td)内的数值(0-100)设置从红色到绿色的背景颜色渐变,忽略非数值内容。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill jquery表格数值颜色渐变设置 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
