Files
it-tools-pro/src/tools/image-tools/text-tpls.ts
T
personal82555 704fabb9cb feat(image-tools): 文字模板扩至47套,新增小红书/抖音/B站/公众号/视频号/封面图7大分类
- text-tpls.ts:TextTpl 加 cat 分类字段,新增6平台×5套=30套品牌风模板
  (小红书#FF2442/抖音#25F4EE#FE2C55/B站#00AEEC#FB7299/公众号深蓝红金/
  视频号#07C160/封面图高冲击),原17套归「通用」;导出 TPL_CATS + filterTpls()
- 上传前模板墙 + 编辑器侧栏模板区各加分类标签条(全部/通用/小红书/抖音/
  B站/公众号/视频号/封面图),一次只看一个平台;chip title 带 [分类] 前缀
- zh/en/描述文案同步 47套·7类
- 实测:墙47套8标签;分类计数17/5/5/5/5/5/5;点小红书模板→选图→
  自动插入2行白字粉描边;侧栏切抖音→5套;截图验收无溢出错位
2026-10-22 10:33:55 +08:00

111 lines
10 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 文字花字模板(成套文案):画布内与上传前模板墙共用
// cat 分类:通用(经典17套)+ 小红书 / 抖音 / B站 / 公众号 / 视频号 / 封面图
export interface TextTpl {
id: string; name: string; color: string;
cat: string; // 平台分类
parts: string[]; // 主标题 → 副标题 → 小字,逐行成组插入
grad?: [string, string]; bold?: boolean;
stroke?: string; strokeW?: number; shadow?: string; badge?: string;
}
/** 分类标签('全部' 由 UI 拼在最前) */
export const TPL_CATS = ['通用', '小红书', '抖音', 'B站', '公众号', '视频号', '封面图'];
export const TEXT_TPLS: TextTpl[] = [
// ---------- 通用(经典 17 套) ----------
{ id: 'wp', cat: '通用', name: '白字黑描边·搞怪', color: '#ffffff', stroke: '#1a1a1a', strokeW: 0.10, bold: true, parts: ['最强拉轰!', '《躲汉子》'] },
{ id: 'yp', cat: '通用', name: '黄字紫描边·热榜', color: '#ffe14d', stroke: '#7b2cbf', strokeW: 0.10, bold: true, parts: ['B站史上', '点击最高的10首MV'] },
{ id: 'wpu', cat: '通用', name: '白字紫描边·科普', color: '#ffffff', stroke: '#8e44ad', strokeW: 0.09, bold: true, parts: ['熬夜', '如何科学修仙'] },
{ id: 'yc', cat: '通用', name: '黄字青描边·美食', color: '#ffeb3b', stroke: '#00e5ff', strokeW: 0.11, bold: true, parts: ['辣到没朋友!川菜', '辣子鸡 · 水煮肉片'] },
{ id: 'rb', cat: '通用', name: '红底白字·冠军', color: '#ffffff', badge: '#e53935', bold: true, parts: ['收视冠军?'] },
{ id: 'bb', cat: '通用', name: '蓝底白字·力作', color: '#ffffff', badge: '#1e88e5', bold: true, parts: ['翻身力作?'] },
{ id: 'kb', cat: '通用', name: '黑底黄字·高光', color: '#ffd600', badge: '#212121', bold: true, parts: ['秀翻全场!', 'ALL KILL!'] },
{ id: 'gd', cat: '通用', name: '鎏金渐变·打卡', color: '#ffcc00', grad: ['#fff3b0', '#ff9500'], stroke: '#7a4a00', strokeW: 0.07, bold: true, parts: ['香浓拿铁', '网红打卡'] },
{ id: 'fg', cat: '通用', name: '烈焰渐变·社会', color: '#ff4d4f', grad: ['#ff5252', '#ff8f00'], stroke: '#7a1f00', strokeW: 0.08, bold: true, parts: ['男子医院体验', '竟查出有孕在身'] },
{ id: 'ws', cat: '通用', name: '白字投影·Vlog', color: '#ffffff', shadow: 'rgba(0,0,0,0.75)', bold: true, parts: ['Vlog', '我的旅行日记'] },
{ id: 'cb', cat: '通用', name: '青字黑描边·热梗', color: '#18ffff', stroke: '#00364d', strokeW: 0.10, bold: true, parts: ['年轻人', '耗子尾汁'] },
{ id: 'pb', cat: '通用', name: '粉底白字·生活', color: '#ffffff', badge: '#ec407a', bold: true, parts: ['我的', '上海日租生活'] },
{ id: 'ol', cat: '通用', name: '空心描边·搞笑', color: 'rgba(255,255,255,0.06)', stroke: '#2962ff', strokeW: 0.10, bold: true, parts: ['你根本', '不会上厕所'] },
{ id: 'gb', cat: '通用', name: '荧光绿描边·攻略', color: '#76ff03', stroke: '#1b3d00', strokeW: 0.09, bold: true, parts: ['角色养成攻略', '躺平吧 赶紧的'] },
{ id: 'wp2', cat: '通用', name: '白字蓝边·职场', color: '#ffffff', stroke: '#0d47a1', strokeW: 0.10, bold: true, parts: ['合法打工人', 'SLAVE の一天 DAILY'] },
{ id: 'gd2', cat: '通用', name: '金渐变·B站', color: '#ffe082', grad: ['#fffde7', '#ffb300'], stroke: '#5d4037', strokeW: 0.07, bold: true, parts: ['B站', '崛起的十二年'] },
{ id: 'rb2', cat: '通用', name: '红底白字·毕业', color: '#ffffff', badge: '#c62828', bold: true, parts: ['毕业后找工作', '如此简单!'] },
// ---------- 小红书(品牌红 #FF2442,种草/探店/避雷风) ----------
{ id: 'xhs1', cat: '小红书', name: '小红红底·种草', color: '#ffffff', badge: '#FF2442', bold: true, parts: ['今日份宝藏', '这款APP真的绝了'] },
{ id: 'xhs2', cat: '小红书', name: '白字粉描边·探店', color: '#ffffff', stroke: '#FF6B8B', strokeW: 0.10, bold: true, parts: ['魔都探店', '藏在弄堂里的咖啡馆'] },
{ id: 'xhs3', cat: '小红书', name: '粉底白字·好物', color: '#ffffff', badge: '#FF85A2', bold: true, parts: ['平价好物', '均价30的快乐'] },
{ id: 'xhs4', cat: '小红书', name: '黄字红描边·避坑', color: '#FFE14D', stroke: '#FF2442', strokeW: 0.11, bold: true, parts: ['避雷!', '这5款千万别买'] },
{ id: 'xhs5', cat: '小红书', name: '玫红底白字·vlog', color: '#ffffff', badge: '#FF3B5C', bold: true, parts: ['周末vlog', '把日子过成诗'] },
// ---------- 抖音(黑底+霓虹青 #25F4EE / 玫红 #FE2C55,爆款悬念风) ----------
{ id: 'dy1', cat: '抖音', name: '抖音黑底青字·爆款', color: '#25F4EE', badge: '#161823', bold: true, parts: ['一招教你', '播放量翻10倍'] },
{ id: 'dy2', cat: '抖音', name: '白字玫红描边·悬念', color: '#ffffff', stroke: '#FE2C55', strokeW: 0.11, bold: true, parts: ['千万别划走', '结局没想到…'] },
{ id: 'dy3', cat: '抖音', name: '霓虹青黑描边·教程', color: '#25F4EE', stroke: '#000000', strokeW: 0.11, bold: true, parts: ['3秒学会', '手机拍大片'] },
{ id: 'dy4', cat: '抖音', name: '玫红底白字·挑战', color: '#ffffff', badge: '#FE2C55', bold: true, parts: ['挑战全网', '最火BGM卡点'] },
{ id: 'dy5', cat: '抖音', name: '青玫渐变·音乐', color: '#ffffff', grad: ['#25F4EE', '#FE2C55'], stroke: '#101014', strokeW: 0.08, bold: true, parts: ['循环100遍', '这歌也太上头'] },
// ---------- B站(B站蓝 #00AEEC / 粉 #FB7299,三连/硬核风) ----------
{ id: 'bili1', cat: 'B站', name: 'B站蓝底白字·三连', color: '#ffffff', badge: '#00AEEC', bold: true, parts: ['一键三连!', '这期真的爆肝'] },
{ id: 'bili2', cat: 'B站', name: '白字B站蓝描边·硬核', color: '#ffffff', stroke: '#00AEEC', strokeW: 0.10, bold: true, parts: ['硬核拆解', '全网最全攻略'] },
{ id: 'bili3', cat: 'B站', name: 'B站粉底白字·番剧', color: '#ffffff', badge: '#FB7299', bold: true, parts: ['新番速报', '本季必追TOP5'] },
{ id: 'bili4', cat: 'B站', name: '黄字B站蓝描边·高能', color: '#FFEB3B', stroke: '#00AEEC', strokeW: 0.11, bold: true, parts: ['前方高能', '第3次神转折'] },
{ id: 'bili5', cat: 'B站', name: '白字投影·UP主', color: '#ffffff', shadow: 'rgba(0,60,90,0.85)', bold: true, parts: ['UP主精选', '百大UP合集'] },
// ---------- 公众号(深蓝/红金,深度长文风) ----------
{ id: 'gzh1', cat: '公众号', name: '深蓝底白字·深度', color: '#ffffff', badge: '#1E3A5F', bold: true, parts: ['深度长文', '普通人逆袭的3条路'] },
{ id: 'gzh2', cat: '公众号', name: '白字深蓝描边·干货', color: '#ffffff', stroke: '#2B6CB0', strokeW: 0.10, bold: true, parts: ['干货|', '一篇讲透提示词'] },
{ id: 'gzh3', cat: '公众号', name: '红底白字·头条', color: '#ffffff', badge: '#C53030', bold: true, parts: ['头条', '这个行业要变天'] },
{ id: 'gzh4', cat: '公众号', name: '黑字黄底·金句', color: '#1a1a1a', badge: '#F6E05E', bold: true, parts: ['句句戳心', '别再无效努力'] },
{ id: 'gzh5', cat: '公众号', name: '白字深投影·观点', color: '#ffffff', shadow: 'rgba(20,40,80,0.9)', bold: true, parts: ['观点', '高手都在做减法'] },
// ---------- 视频号(微信绿 #07C160,直播/私域风) ----------
{ id: 'sph1', cat: '视频号', name: '微信绿底白字·直播', color: '#ffffff', badge: '#07C160', bold: true, parts: ['直播预告', '今晚8点不见不散'] },
{ id: 'sph2', cat: '视频号', name: '白字绿描边·热转', color: '#ffffff', stroke: '#07C160', strokeW: 0.10, bold: true, parts: ['热转|', '这条视频火了'] },
{ id: 'sph3', cat: '视频号', name: '绿渐变·私域', color: '#ffffff', grad: ['#8CE99A', '#07C160'], stroke: '#04421f', strokeW: 0.08, bold: true, parts: ['私域干货', '3步做出爆款封面'] },
{ id: 'sph4', cat: '视频号', name: '白底绿字·教程', color: '#07C160', badge: '#ffffff', bold: true, parts: ['手把手教', '视频号涨粉秘籍'] },
{ id: 'sph5', cat: '视频号', name: '深底青字·带货', color: '#69F0AE', badge: '#0B1F17', bold: true, parts: ['爆单节奏', '这样挂车转化翻倍'] },
// ---------- 封面图(大标题冲击力,点击率优先) ----------
{ id: 'cov1', cat: '封面图', name: '金渐变·封面主标', color: '#FFE58F', grad: ['#FFF7CC', '#FFB300'], stroke: '#7A4A00', strokeW: 0.08, bold: true, parts: ['封面主标题', '点击率翻倍的秘密'] },
{ id: 'cov2', cat: '封面图', name: '撞色红块·数字', color: '#ffffff', badge: '#FF4D4F', bold: true, parts: ['10个神器', '第7个我真的吹爆'] },
{ id: 'cov3', cat: '封面图', name: '白字粗黑边·大标题', color: '#ffffff', stroke: '#000000', strokeW: 0.13, bold: true, parts: ['超全合集', '2026必装软件'] },
{ id: 'cov4', cat: '封面图', name: '蓝紫渐变·科技感', color: '#ffffff', grad: ['#4F46E5', '#9333EA'], stroke: '#1a1040', strokeW: 0.08, bold: true, parts: ['AI革命', '这5款工具先冲'] },
{ id: 'cov5', cat: '封面图', name: '黑底白字·极简', color: '#ffffff', badge: '#111111', bold: true, parts: ['极简封面', '留白高级感'] },
];
/** 按分类筛选(cat='' 表示全部) */
export function filterTpls(cat: string): TextTpl[] {
return !cat || cat === '全部' ? TEXT_TPLS : TEXT_TPLS.filter(t => t.cat === cat);
}
// 模板 chip 的 CSS 预览样式
export function tplStyle(t: TextTpl): Record<string, string> {
const s: Record<string, string> = { fontWeight: '700' };
if (t.badge) {
s.background = t.badge;
s.color = t.color;
s.padding = '4px 7px';
s.borderRadius = '5px';
}
else if (t.grad) {
s.backgroundImage = `linear-gradient(90deg, ${t.grad[0]}, ${t.grad[1]})`;
s.backgroundClip = 'text';
s.WebkitBackgroundClip = 'text';
s.color = 'transparent';
if (t.stroke) {
s.WebkitTextStroke = `1px ${t.stroke}`;
}
}
else {
s.color = t.color;
if (t.stroke) {
s.WebkitTextStroke = `${Math.max(1, Math.round((t.strokeW ?? 0.08) * 16))}px ${t.stroke}`;
}
}
if (t.shadow) {
s.textShadow = `2px 2px 3px ${t.shadow}`;
}
return s;
}