feat(theme): 主题支持按页面分别配装饰,生成器改用真实页面画布
原来的生成器只能配「背景 + 人物 + 道具」三件套,预览还是自己画的仿制页面 —— 跟真实页面不像,也没法给不同页面配不同内容。 机制层: - internal/context.pageScope() 按路径归类,输出 <html data-page-scope>: box / question / admin / profile / vote(首页与 /explore 不加载主题,不列) - /user/questions 单独归为 admin:题目列表信息密,和设置表单的装饰诉求不同 - base.css 装饰槽位 6 -> 10,背景 8 层 -> 12 层;主题按作用域覆盖时同样写满 10 个 - 新增 TestDecoSlotCount:逐文件逐声明检查 10 个值。少写一个不报错, 只会让图层与 size/position 错位(整页重复同一张图 / 人物跑到左上角),注释守不住 生成器: - 画板改成 iframe 加载 outputs/preview-*.html(真实模板渲染),配 serve.py 起本地服务 解决 file:// 下父页面读不到 iframe DOM 的问题 - 八个页面作用域(去掉不生效的首页/探索),每个可独立配背景与最多 10 层装饰 - 图层类型:图片 / 径向光斑 / 线性光;9 宫格锚点 + 像素偏移,可在画板上直接拖 - 位置统一写 calc(0%|50%|100% ± Npx):百分比是相对 (容器-图片), 不用 left/bottom 关键字混搭,避免三值语法非法导致整条声明作废 - 配色只填 6 个基础色,其余 4 个必需令牌按方向派生(surface-2 往 text 靠, 浅色变深、深色变亮,方向自动正确) 配套: - zz_preview_test.go 增加单题页 / 题目列表 / 投票页预览,作为生成器画板 - docs/theme-page-scope.md 记录作用域取值、选择器特异性与 10 槽位约束 - StaticVersion 20261020e(base.css 变了) 验证:生成器导出的 CSS 通过 TestThemeCSSComplete + TestDecoSlotCount; 真实箱主页计算样式为 12 层对齐;临时主题验证「question 覆盖为 none」生效、 未覆盖时回退全局。
This commit is contained in:
@@ -47,12 +47,15 @@ html[data-theme-style="shiroko"] {
|
||||
url("/static/images/themes/shiroko/props/bike.webp?v=20261020d"),
|
||||
linear-gradient(112deg, rgba(255, 250, 236, 0.50) 0%, rgba(255, 250, 236, 0.22) 20%, rgba(255, 250, 236, 0) 44%),
|
||||
radial-gradient(ellipse 560px 170px at 28% 94%, rgba(255, 248, 228, 0.80) 0%, rgba(255, 248, 228, 0) 72%),
|
||||
linear-gradient(0deg, rgba(110, 128, 156, 0.10) 0%, rgba(110, 128, 156, 0) 24%);
|
||||
--tb-deco-size: auto 400px, 96px 13px, auto 259px, 100% 100%, 100% 100%, 100% 100%;
|
||||
linear-gradient(0deg, rgba(110, 128, 156, 0.10) 0%, rgba(110, 128, 156, 0) 24%),
|
||||
none, none, none, none;
|
||||
--tb-deco-size: auto 400px, 96px 13px, auto 259px, 100% 100%, 100% 100%, 100% 100%,
|
||||
auto, auto, auto, auto;
|
||||
--tb-deco-position: left max(10px, calc(50% - 524px)) bottom 36px,
|
||||
left max(22px, calc(50% - 512px)) bottom 29px,
|
||||
left calc(50% - 612px) bottom 20px,
|
||||
left top, left top, left top;
|
||||
left top, left top, left top,
|
||||
left top, left top, left top, left top;
|
||||
}
|
||||
|
||||
html[data-theme="dark"][data-theme-style="shiroko"] {
|
||||
@@ -77,9 +80,10 @@ html[data-theme="dark"][data-theme-style="shiroko"] {
|
||||
--tb-page-image: linear-gradient(180deg, #161d26 0%, #141a22 60%, #11161d 100%);
|
||||
--tb-page-pattern: url("/static/images/themes/shiroko/pattern-dark.svg?v=20261020d");
|
||||
--tb-page-pattern-size: 340px 340px;
|
||||
--tb-deco: none, none, none, none, none, none;
|
||||
--tb-deco-size: auto, auto, auto, auto, auto, auto;
|
||||
--tb-deco-position: left top, left top, left top, left top, left top, left top;
|
||||
--tb-deco: none, none, none, none, none, none, none, none, none, none;
|
||||
--tb-deco-size: auto, auto, auto, auto, auto, auto, auto, auto, auto, auto;
|
||||
--tb-deco-position: left top, left top, left top, left top, left top, left top, left top,
|
||||
left top, left top, left top;
|
||||
}
|
||||
|
||||
/* 窄屏:卡片占满宽度,两侧没有视觉空间 —— 换成竖版场景,人物退场 */
|
||||
@@ -87,9 +91,10 @@ html[data-theme="dark"][data-theme-style="shiroko"] {
|
||||
html[data-theme-style="shiroko"] {
|
||||
--tb-page-image: url("/static/images/themes/shiroko/scene-mobile.webp?v=20261020d");
|
||||
--tb-surface: rgba(255, 255, 255, 0.92);
|
||||
--tb-deco: none, none, none, none, none, none;
|
||||
--tb-deco-size: auto, auto, auto, auto, auto, auto;
|
||||
--tb-deco-position: left top, left top, left top, left top, left top, left top;
|
||||
--tb-deco: none, none, none, none, none, none, none, none, none, none;
|
||||
--tb-deco-size: auto, auto, auto, auto, auto, auto, auto, auto, auto, auto;
|
||||
--tb-deco-position: left top, left top, left top, left top, left top, left top, left top,
|
||||
left top, left top, left top;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user