sablier-icon
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRecolor the Sablier icon SVG to a user-specified color with an analogous gradient, and optionally export to PNG, JPG, or ICO (favicon).
将Sablier图标SVG重新着色为用户指定的颜色,并添加相似色渐变,还可选择导出为PNG、JPG或ICO(网站图标favicon)。
Source
来源
The base icon is at (relative to this skill directory). It is a two-path SVG with
(aspect ratio ~0.802:1). Two CSS classes (, ) reference two elements in :
assets/icon.svgviewBox="0 0 189.9 236.73".cls-1.cls-2<linearGradient><defs>- — contains two
<linearGradient id="linear-gradient">elements:<stop>- →
offset="0"(top / darker)stop-color="#f77423" - →
offset="1"(bottom / lighter)stop-color="#fbce5b"
- — inherits stops from the first via
<linearGradient id="linear-gradient-2">xlink:href="#linear-gradient"
To recolor, replace the two values inside . Always preserve the original
viewBox and aspect ratio — never add or change / attributes on the SVG.
stop-color<linearGradient id="linear-gradient">widthheightA flat variant is at — a single-path SVG with and (aspect
ratio ~0.804:1). Used only when is passed.
assets/icon-white.svgfill="white"viewBox="0 0 386 480"--flat基础图标位于(相对于本技能目录)。它是一个包含两条路径的SVG,(宽高比约0.802:1)。两个CSS类(、)引用了中的两个元素:
assets/icon.svgviewBox="0 0 189.9 236.73".cls-1.cls-2<defs><linearGradient>- — 包含两个
<linearGradient id="linear-gradient">元素:<stop>- →
offset="0"(顶部/较深颜色)stop-color="#f77423" - →
offset="1"(底部/较浅颜色)stop-color="#fbce5b"
- — 通过
<linearGradient id="linear-gradient-2">继承第一个渐变的颜色节点xlink:href="#linear-gradient"
重新着色时,替换内的两个值。请始终保留原始的viewBox和宽高比——切勿在SVG上添加或修改/属性。
<linearGradient id="linear-gradient">stop-colorwidthheight纯色变体位于——这是一个单路径SVG,且(宽高比约0.804:1),仅在传入参数时使用。
assets/icon-white.svgfill="white"viewBox="0 0 386 480"--flatColor Resolution
颜色解析
Resolve the user's color input using this priority (first match wins):
- Exact alias — ,
primary,secondary,orange(see aliases in palette below)blue - Exact palette name — e.g. ,
primary-start,dark-300gray-400 - Raw hex — accept or
#RRGGBB(6-digit only, reject 3/8-digit). Normalize to lowercaseRRGGBB#rrggbb - CSS color name — standard CSS named colors (e.g. ,
red,teal)cornflowerblue
If multiple palette entries match a prefix (e.g. matches , , ), prefer the exact match.
If no exact match exists, ask the user to be more specific.
darkdarkdark-100dark-300按照以下优先级解析用户的颜色输入(匹配到第一个即停止):
- 精确别名 — 、
primary、secondary、orange(见下方调色板中的别名)blue - 精确调色板名称 — 例如、
primary-start、dark-300gray-400 - 原始十六进制值 — 接受或
#RRGGBB格式(仅6位,拒绝3位/8位),统一转换为小写RRGGBB#rrggbb - CSS颜色名称 — 标准CSS命名颜色(例如、
red、teal)cornflowerblue
如果多个调色板条目匹配某个前缀(例如匹配、、),优先选择精确匹配。如果没有找到精确匹配,请要求用户提供更明确的输入。
darkdarkdark-100dark-300Sablier Brand Palette
Sablier品牌调色板
Source: sablier-labs/branding
| Name | Hex | Notes |
|---|---|---|
| primary-start | | Orange gradient start |
| primary-end | | Orange gradient end |
| primary / orange | | Median orange (default primary) |
| secondary-start | | Blue gradient start |
| secondary-end | | Blue gradient end |
| secondary / blue | | Median blue (default secondary) |
| secondary-desaturated | | Desaturated blue |
| dark | | Darkest background |
| dark-100 | | App background |
| dark-300 | | Card borders |
| dark-400 | | Input borders |
| gray-100 | | Body text |
| gray-400 | | Labels |
| red | | Error / destructive |
| white | | Original icon color |
| black | | Pure black (rarely used) |
| 名称 | 十六进制值 | 说明 |
|---|---|---|
| primary-start | | 橙色渐变起始色 |
| primary-end | | 橙色渐变结束色 |
| primary / orange | | 中间橙色(默认主色调) |
| secondary-start | | 蓝色渐变起始色 |
| secondary-end | | 蓝色渐变结束色 |
| secondary / blue | | 中间蓝色(默认次色调) |
| secondary-desaturated | | 低饱和度蓝色 |
| dark | | 最深背景色 |
| dark-100 | | 应用背景色 |
| dark-300 | | 卡片边框色 |
| dark-400 | | 输入框边框色 |
| gray-100 | | 正文文本色 |
| gray-400 | | 标签文本色 |
| red | | 错误/破坏性操作色 |
| white | | 原始图标颜色 |
| black | | 纯黑色(极少使用) |
Gradient Generation
渐变生成
Brand gradient pairs
品牌渐变组合
Use these exact hex pairs — no computation needed:
| Alias | Start (offset=0, top) | End (offset=1, bottom) |
|---|---|---|
| primary / orange | | |
| secondary / blue | | |
When the user says "primary" or "orange", the output is identical to (no stop-color changes needed).
When the user says "secondary" or "blue", replace the two stop-colors with the blue pair.
icon.svg使用以下精确的十六进制颜色对——无需计算:
| 别名 | 起始色(offset=0,顶部) | 结束色(offset=1,底部) |
|---|---|---|
| primary / orange | | |
| secondary / blue | | |
当用户指定“primary”或“orange”时,输出结果与完全一致(无需修改stop-color值)。当用户指定“secondary”或“blue”时,将两个stop-color值替换为蓝色渐变对。
icon.svgArbitrary colors — piecewise HSL algorithm
任意颜色——分段HSL算法
For any color not in the brand gradient pairs above, generate an analogous two-stop gradient:
- Convert the resolved hex to HSL
(h, s%, l%) - Branch by saturation:
- Achromatic (): keep
s < 10for both stops, vary only lightnesss = 0- Start:
hsl(h, 0%, max(l - 8, 10)%) - End:
hsl(h, 0%, min(l + 12, 90)%)
- Start:
- Chromatic (): keep hue constant, adjust lightness and gently reduce end saturation
s >= 10- Start:
hsl(h, s%, max(l - 8, 15)%) - End:
hsl(h, floor(s * 0.9)%, min(l + 12, 88)%)
- Start:
- Achromatic (
- Ensure after clamps; if not, set
endL > startLstartL = endL - 10 - Convert both HSL values back to 6-digit lowercase hex
对于上述品牌渐变组合之外的任意颜色,生成相似色双节点渐变:
- 将解析后的十六进制值转换为HSL格式
(h, s%, l%) - 根据饱和度分支处理:
- 无彩色():保持两个节点的
s < 10,仅调整亮度s = 0- 起始色:
hsl(h, 0%, max(l - 8, 10)%) - 结束色:
hsl(h, 0%, min(l + 12, 90)%)
- 起始色:
- 有彩色():保持色相不变,调整亮度并略微降低结束色的饱和度
s >= 10- 起始色:
hsl(h, s%, max(l - 8, 15)%) - 结束色:
hsl(h, floor(s * 0.9)%, min(l + 12, 88)%)
- 起始色:
- 无彩色(
- 确保调整后;如果不满足,设置
endL > startLstartL = endL - 10 - 将两个HSL值转换回6位小写十六进制格式
SVG Generation
SVG生成
Gradient mode (default)
渐变模式(默认)
- Read
assets/icon.svg - Resolve gradient start/end colors:
- If the color matches a brand gradient pair alias, use the exact hex pair
- Otherwise, apply the piecewise HSL algorithm
- Find the two elements inside
<stop>and replace their<linearGradient id="linear-gradient">values:stop-color- → start hex
offset="0" - → end hex
offset="1"
- Structural checks:
- Exactly two replacements occurred
stop-color - on
xlink:href="#linear-gradient"is still intactlinear-gradient-2 - preserved, no
viewBox="0 0 189.9 236.73"/widthattributes addedheight
- Exactly two
- Write to
sablier-icon-<color-name>.svg
- 读取
assets/icon.svg - 解析渐变起始/结束颜色:
- 如果颜色匹配品牌渐变组合的别名,使用对应的精确十六进制颜色对
- 否则,应用分段HSL算法
- 找到内的两个
<linearGradient id="linear-gradient">元素,替换它们的<stop>值:stop-color- → 起始色十六进制值
offset="0" - → 结束色十六进制值
offset="1"
- 结构检查:
- 已完成恰好两次替换
stop-color - 上的
linear-gradient-2仍保持完整xlink:href="#linear-gradient" - 已保留,未添加
viewBox="0 0 189.9 236.73"/width属性height
- 已完成恰好两次
- 写入文件
sablier-icon-<color-name>.svg
Flat mode (--flat
flag)
--flat纯色模式(--flat
参数)
--flat- Read
assets/icon-white.svg - Resolve the color to a single hex value:
- If the color matches a brand gradient pair alias (,
primary), use the median palette hex (secondary,#ff9c00)#0063ff - Otherwise, use the resolved hex directly
- If the color matches a brand gradient pair alias (
- Replace on the
fill="white"element only — never touch<path>on the rootfill="none"element<svg> - Verify exactly one replacement occurred
- Verify preserved, no
viewBox="0 0 386 480"/widthattributes addedheight - Write to
sablier-icon-<color-name>.svg
- 读取
assets/icon-white.svg - 将颜色解析为单个十六进制值:
- 如果颜色匹配品牌渐变组合的别名(、
primary),使用调色板中的中间色十六进制值(secondary、#ff9c00)#0063ff - 否则,直接使用解析后的十六进制值
- 如果颜色匹配品牌渐变组合的别名(
- 仅替换元素上的
<path>——切勿修改根fill="white"元素上的<svg>fill="none" - 验证已完成恰好一次替换
- 验证已保留,未添加
viewBox="0 0 386 480"/width属性height - 写入文件
sablier-icon-<color-name>.svg
Filenames
文件名规则
Use the brand alias when matched by name (e.g. ), otherwise strip the prefix and lowercase the hex value
(e.g. → ). If the color cannot be resolved, ask the user to provide a valid hex code.
primary##E52E52e52e52如果匹配到品牌别名,则使用该别名作为文件名的一部分(例如 → );否则,去掉十六进制值的前缀并转换为小写(例如 → )。如果颜色无法解析,请要求用户提供有效的十六进制代码。
primarysablier-icon-primary.svg##E52E52e52e52PNG / JPG Export
PNG / JPG导出
If the user passes or :
--format png--format jpg- Generate the recolored SVG first
- Verify is available:
rsvg-convertcommand -v rsvg-convert >/dev/null 2>&1 || { echo "Error: rsvg-convert not found. Install with: brew install librsvg"; exit 1; } - Use for SVG→PNG (it correctly renders CSS gradients, unlike ImageMagick's SVG renderer which produces grayscale)
rsvg-convert - For JPG, convert the PNG with (verify availability:
magick)command -v magick >/dev/null 2>&1
Gradient mode (from , viewBox 189.9×236.73):
icon.svgbash
undefined如果用户传入或参数:
--format png--format jpg- 先生成重新着色后的SVG
- 检查是否可用:
rsvg-convertcommand -v rsvg-convert >/dev/null 2>&1 || { echo "Error: rsvg-convert not found. Install with: brew install librsvg"; exit 1; } - 使用将SVG转换为PNG(它能正确渲染CSS渐变,而ImageMagick的SVG渲染器会生成灰度图)
rsvg-convert - 若要导出JPG,先转换为PNG再使用处理(需检查
magick是否可用:magick)command -v magick >/dev/null 2>&1
渐变模式(基于,viewBox为189.9×236.73):
icon.svgbash
undefinedPNG (transparent background, 1024px height, width auto-computed from aspect ratio ≈822px)
PNG(透明背景,高度1024px,宽度根据宽高比自动计算≈822px)
rsvg-convert -h 1024 "<input>.svg" -o "<output>.png"
rsvg-convert -h 1024 "<input>.svg" -o "<output>.png"
JPG (dark background since JPG has no transparency) — render PNG first, then convert
JPG(因JPG不支持透明,使用深色背景)——先生成PNG再转换
rsvg-convert -h 1024 "<input>.svg" -o "<output>.tmp.png"
magick "<output>.tmp.png" -background "#14161f" -flatten "<output>.jpg"
rm "<output>.tmp.png"
**Flat mode** (from `icon-white.svg`, viewBox 386×480):
```bashrsvg-convert -h 1024 "<input>.svg" -o "<output>.tmp.png"
magick "<output>.tmp.png" -background "#14161f" -flatten "<output>.jpg"
rm "<output>.tmp.png"
**纯色模式**(基于`icon-white.svg`,viewBox为386×480):
```bashPNG (transparent background, explicit height, width auto-computed ≈824px)
PNG(透明背景,指定高度,宽度自动计算≈824px)
rsvg-convert -h 1024 "<input>.svg" -o "<output>.png"
rsvg-convert -h 1024 "<input>.svg" -o "<output>.png"
JPG (dark background)
JPG(深色背景)
rsvg-convert -h 1024 "<input>.svg" -o "<output>.tmp.png"
magick "<output>.tmp.png" -background "#14161f" -flatten "<output>.jpg"
rm "<output>.tmp.png"
Verify the exported file's dimensions match the expected aspect ratio.rsvg-convert -h 1024 "<input>.svg" -o "<output>.tmp.png"
magick "<output>.tmp.png" -background "#14161f" -flatten "<output>.jpg"
rm "<output>.tmp.png"
验证导出文件的尺寸是否符合预期的宽高比。ICO Export (--format ico
or --favicon
)
--format ico--faviconICO导出(--format ico
或--favicon
)
--format ico--favicon--favicon--format ico.icofavicon.ico- Generate the recolored SVG first
- Verify and
rsvg-convertare available (same checks as PNG/JPG)magick - Render intermediate PNGs at each favicon size using (height-constrained to preserve aspect ratio), then center each on a square transparent canvas with
rsvg-convertmagick -extent - Combine into a single with
.icomagick - Clean up intermediate PNGs
bash
undefined--favicon--format ico.icofavicon.ico- 先生成重新着色后的SVG
- 检查和
rsvg-convert是否可用(与PNG/JPG导出的检查方式相同)magick - 使用渲染每个网站图标尺寸的中间PNG(按高度约束以保留宽高比),然后使用
rsvg-convert将每个PNG居中放置在正方形透明画布上magick -extent - 使用合并为单个
magick文件.ico - 清理中间PNG文件
bash
undefinedRender PNGs preserving aspect ratio (height-constrained), then center on square canvas
渲染保留宽高比的PNG(按高度约束),然后居中放置在正方形画布上
for size in 16 32 48; do
rsvg-convert -h "$size" "<input>.svg" -o "<output>-${size}-raw.tmp.png"
magick "<output>-${size}-raw.tmp.png" -background transparent -gravity center -extent "${size}x${size}" "<output>-${size}.tmp.png"
rm "<output>-${size}-raw.tmp.png"
done
for size in 16 32 48; do
rsvg-convert -h "$size" "<input>.svg" -o "<output>-${size}-raw.tmp.png"
magick "<output>-${size}-raw.tmp.png" -background transparent -gravity center -extent "${size}x${size}" "<output>-${size}.tmp.png"
rm "<output>-${size}-raw.tmp.png"
done
Combine into multi-resolution ICO
合并为多分辨率ICO文件
magick "<output>-16.tmp.png" "<output>-32.tmp.png" "<output>-48.tmp.png" "<output>.ico"
magick "<output>-16.tmp.png" "<output>-32.tmp.png" "<output>-48.tmp.png" "<output>.ico"
Clean up
清理文件
rm "<output>-16.tmp.png" "<output>-32.tmp.png" "<output>-48.tmp.png"
The output filename follows the `sablier-icon-<color-name>.ico` pattern — or `favicon.ico` if the user explicitly requests that name.
The output filename follows the same `sablier-icon-<color-name>.<ext>` pattern for all other formats.rm "<output>-16.tmp.png" "<output>-32.tmp.png" "<output>-48.tmp.png"
输出文件名遵循`sablier-icon-<color-name>.ico`格式——如果用户明确要求,也可命名为`favicon.ico`。
所有其他格式的输出文件名均遵循`sablier-icon-<color-name>.<ext>`格式。Examples
示例
- →
primarywith brand orange gradient (identical tosablier-icon-primary.svg)icon.svg - →
secondarywith blue gradientsablier-icon-secondary.svg/#003dff#00b7ff - →
#e52e52with red gradient (piecewise HSL algorithm)sablier-icon-e52e52.svg - →
whitewith achromatic subtle lightness gradientsablier-icon-white.svg - →
#00d395 --flatwith flatsablier-icon-00d395.svgfill="#00d395" - →
red --format jpg+sablier-icon-red.svgsablier-icon-red.jpg - →
secondary --format png+sablier-icon-secondary.svg(blue gradient + raster export)sablier-icon-secondary.png - →
primary --format ico+sablier-icon-primary.svg(multi-resolution 16/32/48px)sablier-icon-primary.ico - → same as
primary --favicon--format ico
- →
primary(品牌橙色渐变,与sablier-icon-primary.svg一致)icon.svg - →
secondary(蓝色渐变sablier-icon-secondary.svg/#003dff)#00b7ff - →
#e52e52(红色渐变,使用分段HSL算法)sablier-icon-e52e52.svg - →
white(无彩色细微亮度渐变)sablier-icon-white.svg - →
#00d395 --flat(纯色sablier-icon-00d395.svg)fill="#00d395" - →
red --format jpg+sablier-icon-red.svgsablier-icon-red.jpg - →
secondary --format png+sablier-icon-secondary.svg(蓝色渐变+栅格导出)sablier-icon-secondary.png - →
primary --format ico+sablier-icon-primary.svg(多分辨率16/32/48px)sablier-icon-primary.ico - → 与
primary --favicon效果相同--format ico