feat(posters): 接入 Base16 主题配色库(276 套 16 色方案)

- 新增 format transform: 'base16'(YAML → 结构化 JSON),零依赖逐行解析 palette.base00–base0F

- 新增源 base16-schemes(MIT,tinted-theming/schemes@spec-0.11,276/277 通过率 99.6%)

- 海报 palette 由 31 → 307 条,库总计 71 源 / 11,598 素材

- 结构校验:276 唯一 id、0 结构异常、198 套 dark 变体;版本联动 20261108f
This commit is contained in:
sgp
2026-11-08 12:22:09 +08:00
parent e55d89d04b
commit 424a63d349
17 changed files with 123 additions and 47 deletions
+4 -4
View File
@@ -32,10 +32,10 @@ h1{font-size:16px}h2{font-size:14px;margin:14px 0 6px}
<script src="js/core/emojiGen.js?v=20260824a"></script>
<script src="js/core/emojiAi.js?v=20260824a"></script>
<script src="js/sticker-skills/core.js?v=20260823e"></script>
<script src="js/sticker-skills/skills.js?v=20261108e"></script>
<script src="js/data/builtin-icons.js?v=20261108d"></script>
<script src="js/data/cn-tags.js?v=20261108e"></script>
<script src="js/core/iconlib.js?v=20261108d"></script>
<script src="js/sticker-skills/skills.js?v=20261108f"></script>
<script src="js/data/builtin-icons.js?v=20261108f"></script>
<script src="js/data/cn-tags.js?v=20261108f"></script>
<script src="js/core/iconlib.js?v=20261108f"></script>
<script>
'use strict';
+3 -3
View File
@@ -15,9 +15,9 @@ h1{font-size:16px}h2{font-size:14px}
<p>支持参数:<code>?only=源1,源2</code> 定向审计;<code>?max=N</code> 每源最多素材数;<code>?size=N</code> 渲染尺寸;<code>?compare=1</code> 开启「原始 vs 下载」逐像素对比。</p>
<div id="out"><p>加载中…</p></div>
<script src="js/data/poster-sources.js?v=20261108d"></script>
<script src="js/data/poster-builtin.js?v=20261108d"></script>
<script src="js/core/posterlib.js?v=20261108d"></script>
<script src="js/data/poster-sources.js?v=20261108f"></script>
<script src="js/data/poster-builtin.js?v=20261108f"></script>
<script src="js/core/posterlib.js?v=20261108f"></script>
<script>
/** 渲染 svg 字符串 → 像素统计 {blank, alphaSum, data, width, height} */
+5 -5
View File
@@ -325,8 +325,8 @@
<script src="js/core/dicebear.js?v=20260822e"></script>
<script src="js/core/ai.js?v=20260927a"></script>
<script src="js/core/aiDesigner.js?v=20260812h"></script>
<script src="js/skills/core.js?v=20261108e"></script>
<script src="js/skills/layout.js?v=20261108e"></script>
<script src="js/skills/core.js?v=20261108f"></script>
<script src="js/skills/layout.js?v=20261108f"></script>
<script src="js/skills/color.js?v=20260823d"></script>
<script src="js/skills/typography.js?v=20260823d"></script>
<script src="js/skills/icon.js?v=20260823d"></script>
@@ -334,9 +334,9 @@
<script src="js/skills/presentation.js?v=20260823d"></script>
<script src="js/skills/export.js?v=20260823d"></script>
<script src="js/ui/panels.js?v=20261105e"></script>
<script src="js/data/builtin-icons.js?v=20261108d"></script>
<script src="js/data/cn-tags.js?v=20261108e"></script>
<script src="js/core/iconlib.js?v=20261108d"></script>
<script src="js/data/builtin-icons.js?v=20261108f"></script>
<script src="js/data/cn-tags.js?v=20261108f"></script>
<script src="js/core/iconlib.js?v=20261108f"></script>
<script src="js/app.js"></script>
</body>
</html>
+4 -4
View File
@@ -215,10 +215,10 @@
<script src="js/core/emojiGen.js?v=20260824a"></script>
<script src="js/core/emojiAi.js?v=20260824a"></script>
<script src="js/sticker-skills/core.js?v=20260823e"></script>
<script src="js/sticker-skills/skills.js?v=20261108e"></script>
<script src="js/data/builtin-icons.js?v=20261108d"></script>
<script src="js/data/cn-tags.js?v=20261108e"></script>
<script src="js/core/iconlib.js?v=20261108d"></script>
<script src="js/sticker-skills/skills.js?v=20261108f"></script>
<script src="js/data/builtin-icons.js?v=20261108f"></script>
<script src="js/data/cn-tags.js?v=20261108f"></script>
<script src="js/core/iconlib.js?v=20261108f"></script>
<script src="js/ui/emoji.js?v=20261105a"></script>
</body>
</html>
+5 -5
View File
@@ -327,8 +327,8 @@
<script src="js/core/dicebear.js?v=20260822e"></script>
<script src="js/core/ai.js?v=20260927a"></script>
<script src="js/core/aiDesigner.js?v=20260812h"></script>
<script src="js/skills/core.js?v=20261108e"></script>
<script src="js/skills/layout.js?v=20261108e"></script>
<script src="js/skills/core.js?v=20261108f"></script>
<script src="js/skills/layout.js?v=20261108f"></script>
<script src="js/skills/color.js?v=20260824a"></script>
<script src="js/skills/typography.js?v=20260824a"></script>
<script src="js/skills/icon.js?v=20260824a"></script>
@@ -336,9 +336,9 @@
<script src="js/skills/presentation.js?v=20260824a"></script>
<script src="js/skills/export.js?v=20260824a"></script>
<script src="js/ui/panels.js?v=20261105e"></script>
<script src="js/data/builtin-icons.js?v=20261108d"></script>
<script src="js/data/cn-tags.js?v=20261108e"></script>
<script src="js/core/iconlib.js?v=20261108d"></script>
<script src="js/data/builtin-icons.js?v=20261108f"></script>
<script src="js/data/cn-tags.js?v=20261108f"></script>
<script src="js/core/iconlib.js?v=20261108f"></script>
<script src="js/app.js"></script>
</body>
</html>
+1 -1
View File
@@ -12,7 +12,7 @@
const HGB_PosterLib = (function () {
'use strict';
const VERSION = '20261108d'; // 与 poster.html 中 poster-builtin.js?v= 版本联动
const VERSION = '20261108f'; // 与 poster.html 中 poster-builtin.js?v= 版本联动
const cache = {}; // sid -> {items:[...]}
const pending = {}; // sid -> Promise
+3 -3
View File
@@ -5,7 +5,7 @@
## 生成时间
2026-11-08T02:38:04.341Z
2026-11-08T04:20:32.272Z
## ① 图标库(共享,LOGO/头像/海报共用)
@@ -15,8 +15,8 @@
## ② 海报素材库
- 源数:70 | 素材总数:11322
- 类型分布:palette 7 / decoration 4 / bg 5 / font 54
- 源数:71 | 素材总数:11598
- 类型分布:palette 8 / decoration 4 / bg 5 / font 54
- 源清单:js/data/manifest/posters.json
## ③ 技能库
+22 -2
View File
@@ -1,7 +1,7 @@
{
"kind": "posters",
"total": 11322,
"builtAt": "2026-11-07T18:47:36.642Z",
"total": 11598,
"builtAt": "2026-11-08T04:20:06.366Z",
"guide": "js/data/manifest/README.md",
"idRule": "「源:相对路径」,如 fontsource-inter:latin-400-normal.woff2",
"sources": [
@@ -1404,6 +1404,26 @@
"workspaces": [
"poster"
]
},
{
"id": "base16-schemes",
"type": "palette",
"name": "Base16 Schemes",
"nameCn": "Base16 主题配色",
"desc": "Tinted Theming 社区维护的 Base16 配色方案全集(362 套),每套 16 色(base00–base0F)且标注 dark/light 变体与作者,适合海报快速定调与深色/浅色成套取色",
"license": "MIT",
"licenseNote": "MIT 协议,可商用;各方案版权归原作者,建议保留方案名与作者信息",
"home": "https://github.com/tinted-theming/schemes",
"github": "https://github.com/tinted-theming/schemes",
"format": "gh-files",
"coordText": "16 色(base00–base0F,含 dark/light 变体)",
"variants": "362 套社区主题(如 3024 / apathy / arroz-con-dulce)",
"added": "2026-11-08",
"count": 276,
"file": "posters/base16-schemes.js",
"workspaces": [
"poster"
]
}
]
}
File diff suppressed because one or more lines are too long
+22
View File
@@ -1052,6 +1052,28 @@
variants: '按分类轮转挑选 700 张,覆盖木/砖/混凝土/织物/金属/岩砂/植被/地面等',
added: '2026-11-06',
workspaces: ['poster']
},
{
id: 'base16-schemes',
type: 'palette',
name: 'Base16 Schemes',
nameCn: 'Base16 主题配色',
desc: 'Tinted Theming 社区维护的 Base16 配色方案全集(362 套),每套 16 色(base00–base0F)且标注 dark/light 变体与作者,适合海报快速定调与深色/浅色成套取色',
license: 'MIT',
licenseNote: 'MIT 协议,可商用;各方案版权归原作者,建议保留方案名与作者信息',
home: 'https://github.com/tinted-theming/schemes',
github: 'https://github.com/tinted-theming/schemes',
format: 'gh-files',
gh: 'tinted-theming/schemes',
ghBranch: 'spec-0.11',
dirs: ['base16/'],
ext: ['.yaml', '.yml'],
transform: 'base16',
scaleMode: 'wrap',
coordText: '16 色(base00–base0F,含 dark/light 变体)',
variants: '362 套社区主题(如 3024 / apathy / arroz-con-dulce)',
added: '2026-11-08',
workspaces: ['poster']
}
];
});
File diff suppressed because one or more lines are too long
+5 -5
View File
@@ -117,8 +117,8 @@
</div>
<script src="js/core/dicebear.js?v=20260822e"></script>
<script src="js/data/builtin-icons.js?v=20261108d"></script>
<script src="js/data/poster-builtin.js?v=20261108d"></script>
<script src="js/data/builtin-icons.js?v=20261108f"></script>
<script src="js/data/poster-builtin.js?v=20261108f"></script>
<script>
(function () {
'use strict';
@@ -170,13 +170,13 @@
/* ============ Manifest 加载 ============ */
function loadIconManifest() {
return fetch('js/data/manifest/icons.json?v=20261108d')
return fetch('js/data/manifest/icons.json?v=20261108f')
.then(function (r) { return r.json(); })
.then(function (m) { ICON_SRC = m.sources || []; })
.catch(function () { ICON_SRC = window.HGB_IconSources || []; });
}
function loadPosterManifest() {
return fetch('js/data/manifest/posters.json?v=20261108d')
return fetch('js/data/manifest/posters.json?v=20261108f')
.then(function (r) { return r.json(); })
.then(function (m) { POSTER_SRC = m.sources || []; })
.catch(function () { POSTER_SRC = window.HGB_PosterSources || []; });
@@ -191,7 +191,7 @@
}
function loadPosterData(id) {
if (loadedCache['p_' + id]) return loadedCache['p_' + id];
loadedCache['p_' + id] = loadScript('js/data/posters/' + id + '.js?v=20261108d')
loadedCache['p_' + id] = loadScript('js/data/posters/' + id + '.js?v=20261108f')
.then(function () { return window['HGB_PosterSource_' + id] || null; });
return loadedCache['p_' + id];
}
+2 -2
View File
@@ -84,7 +84,7 @@
</div>
<script src="js/data/poster-sources.js"></script>
<script src="js/data/poster-builtin.js?v=20261108d"></script>
<script src="js/data/poster-builtin.js?v=20261108f"></script>
<script>
(function () {
const builtin = window.HGB_PosterBuiltin || { sources: {} };
@@ -139,7 +139,7 @@
}
// 优先读机器可读 manifest(js/data/manifest/posters.json,构建时生成);失败回退内置配置
fetch('js/data/manifest/posters.json?v=20261108d')
fetch('js/data/manifest/posters.json?v=20261108f')
.then(r => r.json())
.then(m => { sources = m.sources || []; render(); })
.catch(() => { sources = FALLBACK; render(); });
+4 -4
View File
@@ -90,14 +90,14 @@
<div id="toast" class="toast hidden"></div>
<script src="js/data/poster-sources.js"></script>
<script src="js/data/poster-builtin.js?v=20261108d"></script>
<script src="js/core/posterlib.js?v=20261108d"></script>
<script src="js/data/poster-builtin.js?v=20261108f"></script>
<script src="js/core/posterlib.js?v=20261108f"></script>
<script src="js/core/ai.js?v=20260927a"></script>
<script src="js/core/poster-store.js?v=20261105a"></script>
<script src="js/core/poster-generator.js?v=20261108e"></script>
<script src="js/core/poster-generator.js?v=20261108f"></script>
<script src="js/core/poster-renderer.js?v=20261105a"></script>
<script src="js/core/poster-exporter.js?v=20261105a"></script>
<script src="js/core/poster-ai.js?v=20261108e"></script>
<script src="js/core/poster-ai.js?v=20261108f"></script>
<script>
(function () {
'use strict';
+32
View File
@@ -265,6 +265,12 @@ async function downloadGhFiles(src) {
file = r.file.replace(/\.js$/i, '.svg');
buf = Buffer.from(svg, 'utf8');
}
if (src.transform === 'base16') {
const json = transformBase16(r.buf);
if (!json) { fail++; continue; }
file = r.file.replace(/\.ya?ml$/i, '.json');
buf = Buffer.from(JSON.stringify(json), 'utf8');
}
const c = classifyPoster(name);
const it = await buildItem(src, name, file, buf, c);
if (it) { items.push(it); ok++; } else fail++;
@@ -490,6 +496,31 @@ async function readLocalFiles(src) {
* `url('data:image/svg+xml,%3Csvg%20width...%3E')`
* 处理:剥离 import(依赖注入 sandbox)、以默认黑色调用函数、URL 解码出 <svg>…</svg>
*/
/**
* Base16 配色方案(tinted-theming/schemes 的 base16/*.yaml)→ 结构化 JSON
* YAML 结构固定:system/name/author/variant + palette.base00–base0F,逐行正则解析即可(不引依赖)
*/
function transformBase16(buf) {
const text = buf.toString('utf8');
const get = (key) => {
const m = text.match(new RegExp('^' + key + ':\\s*"?([^"\\n]+)"?\\s*$', 'm'));
return m ? m[1].trim() : '';
};
const name = get('name');
if (!name) return null;
const colors = {};
const re = /^\s*base(0[0-9a-fA-F]):\s*"?(#[0-9a-fA-F]{3,8})"?/gm;
let m;
while ((m = re.exec(text))) colors['base' + m[1].toUpperCase()] = m[2];
if (Object.keys(colors).length < 8) return null; // 至少 8 色才算有效方案
return {
scheme: name,
author: get('author'),
variant: get('variant') || 'dark',
colors
};
}
function transformHeroPatterns(buf) {
let code = buf.toString('utf8');
code = code.replace(/^import\s+[^\n]*$/gm, ''); // 去掉 import 语句
@@ -529,6 +560,7 @@ async function buildItem(src, name, filePath, buf, c) {
const ext = path.extname(filePath).toLowerCase();
// 字体素材不做应用场景推断(避免名称误命中词表,如 LeagueSpartan 含 "spa" → 医疗健康),统一归「字体排版」
if (src.type === 'font') c = { cat: 'font', cn: '字体排版' };
if (src.type === 'palette') c = { cat: 'palette', cn: '配色方案' };
const base = { id: `${src.id}:${name}`, name, type: src.type, category: c.cat, categoryCn: c.cn, workspaces: src.workspaces || ['poster'] };
if (ext === '.svg') {
+5 -5
View File
@@ -185,11 +185,11 @@
<script src="js/core/dicebear.js?v=20260822e"></script>
<script src="js/core/ai.js?v=20260927a"></script>
<script src="js/core/aiDesigner.js?v=20260812h"></script>
<script src="js/data/builtin-icons.js?v=20261108d"></script>
<script src="js/data/cn-tags.js?v=20261108e"></script>
<script src="js/core/iconlib.js?v=20261108d"></script>
<script src="js/skills/core.js?v=20261108e"></script>
<script src="js/skills/layout.js?v=20261108e"></script>
<script src="js/data/builtin-icons.js?v=20261108f"></script>
<script src="js/data/cn-tags.js?v=20261108f"></script>
<script src="js/core/iconlib.js?v=20261108f"></script>
<script src="js/skills/core.js?v=20261108f"></script>
<script src="js/skills/layout.js?v=20261108f"></script>
<script src="js/skills/color.js?v=20260823d"></script>
<script src="js/skills/typography.js?v=20260823d"></script>
<script src="js/skills/icon.js?v=20260823d"></script>
+2 -2
View File
@@ -155,7 +155,7 @@
</div>
<script src="js/data/icon-sources.js?v=20261105c"></script>
<script src="js/data/builtin-icons.js?v=20261108d"></script>
<script src="js/data/builtin-icons.js?v=20261108f"></script>
<script>
(function () {
'use strict';
@@ -167,7 +167,7 @@
var BUILTIN = (typeof HGB_BuiltinIcons !== 'undefined') ? HGB_BuiltinIcons : null;
function resolveSources(cb) {
fetch('js/data/manifest/icons.json?v=20261108d')
fetch('js/data/manifest/icons.json?v=20261108f')
.then(function (r) { return r.json(); })
.then(function (m) {
SOURCES = m.sources || [];