更新技术美术明亮教具室版:字体、指路、教学与庆祝效果
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,16 @@
|
||||
import {readFileSync,writeFileSync} from 'node:fs';
|
||||
const tokens=JSON.parse(readFileSync(new URL('tokens.json',import.meta.url),'utf8'));
|
||||
function luminance(hex){
|
||||
if(!/^#[0-9a-f]{6}$/i.test(hex))throw new Error(`Expected opaque sRGB hex: ${hex}`);
|
||||
const c=[1,3,5].map(i=>parseInt(hex.slice(i,i+2),16)/255).map(v=>v<=0.04045?v/12.92:((v+0.055)/1.055)**2.4);
|
||||
return .2126*c[0]+.7152*c[1]+.0722*c[2];
|
||||
}
|
||||
const resolve=k=>tokens.color[k]??k;
|
||||
const rows=tokens.contrastPairs.map(p=>{
|
||||
const foreground=resolve(p.fg),background=resolve(p.bg),a=luminance(foreground),b=luminance(background);
|
||||
const ratio=(Math.max(a,b)+.05)/(Math.min(a,b)+.05);
|
||||
return {...p,foreground,background,ratio,pass:p.minimum===null?null:ratio>=p.minimum};
|
||||
});
|
||||
writeFileSync(new URL('contrast-audit.json',import.meta.url),JSON.stringify({method:'WCAG relative luminance, opaque sRGB; threshold checked without rounding; does not validate all composed/animated UI states',rows},null,2)+'\n');
|
||||
console.table(rows.map(r=>({pair:r.name,foreground:r.foreground,background:r.background,ratio:r.ratio.toFixed(3),minimum:r.minimum,result:r.pass===null?'diagnostic':r.pass?'pass':'FAIL'})));
|
||||
if(rows.some(r=>r.pass===false))process.exitCode=1;
|
||||
@@ -0,0 +1,225 @@
|
||||
{
|
||||
"method": "WCAG relative luminance, opaque sRGB; threshold checked without rounding; does not validate all composed/animated UI states",
|
||||
"rows": [
|
||||
{
|
||||
"name": "主文字/背景",
|
||||
"fg": "ink",
|
||||
"bg": "background",
|
||||
"minimum": 4.5,
|
||||
"foreground": "#292638",
|
||||
"background": "#F7F5F1",
|
||||
"ratio": 13.499592723055425,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "辅助文字/背景",
|
||||
"fg": "inkSecondary",
|
||||
"bg": "background",
|
||||
"minimum": 4.5,
|
||||
"foreground": "#66616F",
|
||||
"background": "#F7F5F1",
|
||||
"ratio": 5.50340046530515,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "三级文字/背景",
|
||||
"fg": "inkTertiary",
|
||||
"bg": "background",
|
||||
"minimum": 4.5,
|
||||
"foreground": "#716A78",
|
||||
"background": "#F7F5F1",
|
||||
"ratio": 4.7797069926956475,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "线索数字/未走格",
|
||||
"fg": "ink",
|
||||
"bg": "cellFace",
|
||||
"minimum": 4.5,
|
||||
"foreground": "#292638",
|
||||
"background": "#E5E3E1",
|
||||
"ratio": 11.484041400281836,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "路径数字/紫面",
|
||||
"fg": "onPrimary",
|
||||
"bg": "primary",
|
||||
"minimum": 4.5,
|
||||
"foreground": "#FFFFFF",
|
||||
"background": "#6558F5",
|
||||
"ratio": 4.920632349356288,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "路径数字/按压紫面",
|
||||
"fg": "onPrimary",
|
||||
"bg": "primaryPressed",
|
||||
"minimum": 4.5,
|
||||
"foreground": "#FFFFFF",
|
||||
"background": "#5245D6",
|
||||
"ratio": 6.601647105487607,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "错误数字/错误面",
|
||||
"fg": "onPrimary",
|
||||
"bg": "danger",
|
||||
"minimum": 4.5,
|
||||
"foreground": "#FFFFFF",
|
||||
"background": "#C74350",
|
||||
"ratio": 4.830782166769728,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "错误说明/淡红底",
|
||||
"fg": "dangerInk",
|
||||
"bg": "dangerSoft",
|
||||
"minimum": 4.5,
|
||||
"foreground": "#8B2632",
|
||||
"background": "#FBEAED",
|
||||
"ratio": 7.473414279853196,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "提示文字/淡琥珀底",
|
||||
"fg": "hintInk",
|
||||
"bg": "hintSoft",
|
||||
"minimum": 4.5,
|
||||
"foreground": "#664400",
|
||||
"background": "#FFF0D2",
|
||||
"ratio": 7.79606369057448,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "格边/格面",
|
||||
"fg": "cellBoundary",
|
||||
"bg": "cellFace",
|
||||
"minimum": 3,
|
||||
"foreground": "#817B88",
|
||||
"background": "#E5E3E1",
|
||||
"ratio": 3.2030630920005154,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "格边/背景",
|
||||
"fg": "cellBoundary",
|
||||
"bg": "background",
|
||||
"minimum": 3,
|
||||
"foreground": "#817B88",
|
||||
"background": "#F7F5F1",
|
||||
"ratio": 3.765229129807595,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "提示环/背景",
|
||||
"fg": "hint",
|
||||
"bg": "background",
|
||||
"minimum": 3,
|
||||
"foreground": "#966000",
|
||||
"background": "#F7F5F1",
|
||||
"ratio": 4.857982445311365,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "提示环/未走格",
|
||||
"fg": "hint",
|
||||
"bg": "cellFace",
|
||||
"minimum": 3,
|
||||
"foreground": "#966000",
|
||||
"background": "#E5E3E1",
|
||||
"ratio": 4.132663308317279,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "墙身/墙条纹",
|
||||
"fg": "wallInk",
|
||||
"bg": "wallStripe",
|
||||
"minimum": 3,
|
||||
"foreground": "#3B3547",
|
||||
"background": "#D7B35B",
|
||||
"ratio": 5.872010474102764,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "墙身/未走格",
|
||||
"fg": "wallInk",
|
||||
"bg": "cellFace",
|
||||
"minimum": 3,
|
||||
"foreground": "#3B3547",
|
||||
"background": "#E5E3E1",
|
||||
"ratio": 9.1851898632995,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "焦点/表面",
|
||||
"fg": "focus",
|
||||
"bg": "surface",
|
||||
"minimum": 3,
|
||||
"foreground": "#6558F5",
|
||||
"background": "#FFFEFC",
|
||||
"ratio": 4.881824820806739,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "选中项文字/淡紫底",
|
||||
"fg": "selectedInk",
|
||||
"bg": "primarySoft",
|
||||
"minimum": 4.5,
|
||||
"foreground": "#5245D6",
|
||||
"background": "#EDEAFF",
|
||||
"ratio": 5.600093119280275,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "辅助文字/二级面",
|
||||
"fg": "inkSecondary",
|
||||
"bg": "surfaceMuted",
|
||||
"minimum": 4.5,
|
||||
"foreground": "#66616F",
|
||||
"background": "#EEEBE6",
|
||||
"ratio": 5.039815678579112,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "已走线索环/路径面",
|
||||
"fg": "primarySoft",
|
||||
"bg": "primary",
|
||||
"minimum": 3,
|
||||
"foreground": "#EDEAFF",
|
||||
"background": "#6558F5",
|
||||
"ratio": 4.174109721683276,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "未走格面/背景(诊断,边界另保证)",
|
||||
"fg": "cellFace",
|
||||
"bg": "background",
|
||||
"minimum": null,
|
||||
"foreground": "#E5E3E1",
|
||||
"background": "#F7F5F1",
|
||||
"ratio": 1.1755088868561658,
|
||||
"pass": null
|
||||
},
|
||||
{
|
||||
"name": "旧错误色白字(诊断)",
|
||||
"fg": "#FFFFFF",
|
||||
"bg": "#E5484D",
|
||||
"minimum": null,
|
||||
"foreground": "#FFFFFF",
|
||||
"background": "#E5484D",
|
||||
"ratio": 3.913738950339162,
|
||||
"pass": null
|
||||
},
|
||||
{
|
||||
"name": "旧过关亮面白字(诊断)",
|
||||
"fg": "#FFFFFF",
|
||||
"bg": "#7D72FF",
|
||||
"minimum": null,
|
||||
"foreground": "#FFFFFF",
|
||||
"background": "#7D72FF",
|
||||
"ratio": 3.6694552685051627,
|
||||
"pass": null
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"meta": {"name":"NumberSwipe Soft Blocks", "version":"1.0-proposal", "date":"2026-10-21", "status":"Design proposal; not applied to runtime", "unit":"logical design unit; map per platform, not physical pixel"},
|
||||
"color": {
|
||||
"background":"#F7F5F1", "surface":"#FFFEFC", "surfaceRaised":"#FFFFFF", "surfaceMuted":"#EEEBE6",
|
||||
"divider":"#D5D0C9", "cellFace":"#E5E3E1", "cellDepth":"#C5C0CB", "cellBoundary":"#817B88",
|
||||
"ink":"#292638", "inkSecondary":"#66616F", "inkTertiary":"#716A78", "onPrimary":"#FFFFFF",
|
||||
"primary":"#6558F5", "primaryPressed":"#5245D6", "primaryDepth":"#4B3AC8", "primarySoft":"#EDEAFF", "selectedInk":"#5245D6", "primaryEdgeLight":"#A49BFF",
|
||||
"danger":"#C74350", "dangerDepth":"#9E2F3A", "dangerSoft":"#FBEAED", "dangerInk":"#8B2632",
|
||||
"hint":"#966000", "hintSoft":"#FFF0D2", "hintInk":"#664400",
|
||||
"wallInk":"#3B3547", "wallStripe":"#D7B35B", "focus":"#6558F5", "overlay":"#292638"
|
||||
},
|
||||
"font": {"numericPreferred":"Nunito", "cjkPreferred":"Noto Sans SC", "fallback":"ui-rounded, system-ui, -apple-system, Segoe UI, sans-serif", "numericWeight":800, "bodyWeight":500, "labelWeight":600, "headingWeight":700},
|
||||
"type": {
|
||||
"display":{"size":30,"line":38,"weight":800}, "pageTitle":{"size":24,"line":32,"weight":700}, "section":{"size":18,"line":26,"weight":700},
|
||||
"body":{"size":16,"line":24,"weight":500}, "button":{"size":16,"line":24,"weight":700}, "label":{"size":14,"line":20,"weight":600},
|
||||
"caption":{"size":13,"line":18,"weight":500}, "micro":{"size":12,"line":16,"weight":500}
|
||||
},
|
||||
"boardType":{"startRatio":0.60,"singleRatio":0.52,"doubleRatio":0.46,"parityRatio":0.44,"paritySubMin":12,"doubleMin":22,"singleMin":24,"numberMax":46},
|
||||
"spacing":[4,8,12,16,20,24,32,40,48],
|
||||
"radius":{"small":8,"control":16,"card":20,"sheet":24,"cellRatio":0.18,"cellMin":7,"cellMax":14},
|
||||
"layout":{"referenceWidth":375,"referenceHeight":812,"contentPadding":20,"tapMin":48,"topbarHeight":56,"actionHeight":56,"actionGap":8,"boardOuterMargin":12,"boardPitchMin":48,"boardPitchPreferred":56,"tileInsetRatio":0.05,"bridgeThicknessRatio":0.46},
|
||||
"material":{"lightDirection":"upper-left","cellDepth":2,"cellDepthMax":3,"pressedDepth":1,"boundaryWidth":1.25,"shadowBlurMax":6,"shadowOpacityMax":0.08,"gradientLuminanceDeltaMax":0.02},
|
||||
"motionMs":{"fast":120,"base":200,"slow":320,"hold":500,"hintVisible":2400,"entryStagger":12,"entryStaggerCap":120},
|
||||
"motion":{"easeOut":[0.22,1,0.36,1],"easeIn":[0.4,0,1,1],"easeInOut":[0.65,0,0.35,1],"stepScalePeak":1.02,"buttonScaleMin":0.98,"shakeAmplitudeMax":2,"rotationDegrees":120},
|
||||
"contrastPairs":[
|
||||
{"name":"主文字/背景","fg":"ink","bg":"background","minimum":4.5},
|
||||
{"name":"辅助文字/背景","fg":"inkSecondary","bg":"background","minimum":4.5},
|
||||
{"name":"三级文字/背景","fg":"inkTertiary","bg":"background","minimum":4.5},
|
||||
{"name":"线索数字/未走格","fg":"ink","bg":"cellFace","minimum":4.5},
|
||||
{"name":"路径数字/紫面","fg":"onPrimary","bg":"primary","minimum":4.5},
|
||||
{"name":"路径数字/按压紫面","fg":"onPrimary","bg":"primaryPressed","minimum":4.5},
|
||||
{"name":"错误数字/错误面","fg":"onPrimary","bg":"danger","minimum":4.5},
|
||||
{"name":"错误说明/淡红底","fg":"dangerInk","bg":"dangerSoft","minimum":4.5},
|
||||
{"name":"提示文字/淡琥珀底","fg":"hintInk","bg":"hintSoft","minimum":4.5},
|
||||
{"name":"格边/格面","fg":"cellBoundary","bg":"cellFace","minimum":3},
|
||||
{"name":"格边/背景","fg":"cellBoundary","bg":"background","minimum":3},
|
||||
{"name":"提示环/背景","fg":"hint","bg":"background","minimum":3},
|
||||
{"name":"提示环/未走格","fg":"hint","bg":"cellFace","minimum":3},
|
||||
{"name":"墙身/墙条纹","fg":"wallInk","bg":"wallStripe","minimum":3},
|
||||
{"name":"墙身/未走格","fg":"wallInk","bg":"cellFace","minimum":3},
|
||||
{"name":"焦点/表面","fg":"focus","bg":"surface","minimum":3},
|
||||
{"name":"选中项文字/淡紫底","fg":"selectedInk","bg":"primarySoft","minimum":4.5},
|
||||
{"name":"辅助文字/二级面","fg":"inkSecondary","bg":"surfaceMuted","minimum":4.5},
|
||||
{"name":"已走线索环/路径面","fg":"primarySoft","bg":"primary","minimum":3},
|
||||
{"name":"未走格面/背景(诊断,边界另保证)","fg":"cellFace","bg":"background","minimum":null},
|
||||
{"name":"旧错误色白字(诊断)","fg":"#FFFFFF","bg":"#E5484D","minimum":null},
|
||||
{"name":"旧过关亮面白字(诊断)","fg":"#FFFFFF","bg":"#7D72FF","minimum":null}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user