@c2n/task-icons

中文文档
1.0.23发布于 2026/11/08MITTypeScriptES Module近 30 天下载 2971

191 duotone icons for to-do items, one Lit web component each: <c2-task-icon-mail>, <c2-task-icon-meeting>, <c2-task-icon-run>, <c2-task-icon-cook>, and more. They cover the subjects a task list is usually about, in fifteen groups: work, communica

原始使用文档
文档目录5 节
  1. Installation
  2. Usage
  3. Picking an icon for a task
  4. Styling
  5. Adding an icon

Task icons

191 duotone icons for to-do items, one Lit web component each: <c2-task-icon-mail>, <c2-task-icon-meeting>, <c2-task-icon-run>, <c2-task-icon-cook>, and more. They cover the subjects a task list is usually about, in fifteen groups: work, communication, tech, learning, health, sport, home, family, food, shopping, finance, travel, leisure, nature and planning. @c2n/todo-list draws its task icons and its icon picker with them.

The artwork is drawn for this package (MIT, like the rest of the repository) on one 24×24 grid: an outline in currentColor over a soft tint of the same colour, so an icon takes the colour of the text or tile it sits in.

Installation

npm install @c2n/task-icons

Usage

Import only the icons you use:

import '@c2n/task-icons/icons/mail.js'
<c2-task-icon-mail></c2-task-icon-mail>

Or register the whole set:

import '@c2n/task-icons'

An icon is decorative by default (aria-hidden). Give it a label when no nearby text says the same thing:

<c2-task-icon-cart label="Groceries"></c2-task-icon-cart>

Picking an icon for a task

Every icon carries keywords (call: call, phone, ring, dial, contact, mom, dad…). suggestTaskIcon() returns the icon whose keywords best match a piece of text, which is how a to-do list can pick an icon for a list from its title:

import { suggestTaskIcon } from '@c2n/task-icons/suggest-task-icon.js'

suggestTaskIcon('Book the dentist') // 'tooth'
suggestTaskIcon('Team standup') // 'meeting'
suggestTaskIcon('Something unrelated') // undefined

taskIconCatalog (from @c2n/task-icons/task-icon-names.js) lists the name, title, category and keywords of every icon, for your own pickers and search fields; taskIconTag(name) gives the element's tag name.

Styling

VariableDefaultDescription
--c2-task-icon--size24pxWidth and height of the icon.
--c2-task-icon--colorcurrentColorOutline and solid colour.
--c2-task-icon--stroke-width1.75Outline width, in units of the 24×24 canvas.
--c2-task-icon__tone--colorcurrentColorColour of the soft duotone fill.
--c2-task-icon__tone--opacity0.18Opacity of the soft fill; 0 draws outlines only.

Adding an icon

Draw svg/<name>.svg on the 24×24 grid (wrapper exactly <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">), add its title, category and keywords to svg/catalog.json, then run npm run generate -w packages/icons/task-icons. An element without a class is an outline; class="tone" adds the soft fill, fill is the soft fill alone and solid a small solid mark. The generator rejects hard-coded colours, strokes and styles.

版本与发布记录

@c2n/task-icons 共发布 30 个版本,首次发布于 2026/10/02;过去 12 个月发布了 30 个版本。

版本发布日期距今
1.0.23latest2026/11/081 天前
1.0.222026/11/072 天前
1.0.212026/11/054 天前
1.0.202026/11/035 天前
1.0.192026/11/035 天前
1.0.182026/10/2811 天前

关于 @c2n/task-icons 的常见问题

@c2n/task-icons 是什么?

191 duotone icons for to-do items, one Lit web component each: <c2-task-icon-mail>, <c2-task-icon-meeting>, <c2-task-icon-run>, <c2-task-icon-cook>, and more. They cover the subjects a task list is usually about, in fifteen groups: work, communica

如何安装 @c2n/task-icons?

在项目目录运行 npm install @c2n/task-icons,或使用 pnpm add / yarn add / bun add。

@c2n/task-icons 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@c2n/task-icons 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@c2n/task-icons 可以商用吗?

@c2n/task-icons 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@c2n/task-icons 的下载量有多少?

根据 npm 官方下载统计,@c2n/task-icons 在 2026/10/09 – 2026/11/07 这 30 天内被下载 2,971 次,日均约 99 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@c2n/task-icons 还在维护吗?

最新版本 1.0.23 发布于 2026/11/08(1 天前);至今共发布 30 个版本,其中过去 12 个月发布了 30 个;首次发布于 2026/10/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。