sumsub-theme-msdk
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSumsub — Mobile SDK theming (iOS & Android)
Sumsub — 移动SDK主题定制(iOS & Android)
Scan the host app's design system, derive a full palette, and write a theme the SDK picks
up at launch — iOS: a subclass assigned as
; Android: a factory built with the
DSL and attached via — so the
KYC screens match the app instead of looking bolted on. Every SDK theme property is either
mapped from the app or explicitly derived; nothing is left at the SDK default by accident.
SumsubTheme: SNSThemesdk.theme = SumsubTheme()sumsubTheme(context)SNSTheme { … }SNSMobileSDK.Builder(...).withTheme(...)This is the trunk (always-on). Detect the platform, then walk that track's four
stages in order: Scan → Map → Generate → Report.
扫描宿主应用的设计系统,生成完整调色板,并编写SDK启动时会加载的主题——iOS端:创建子类,赋值为;Android端:使用DSL构建工厂,通过关联主题——这样KYC界面就能与应用风格匹配,而非显得格格不入。SDK的每个主题属性要么与应用映射,要么明确推导得出,不会意外保留SDK默认值。
SumsubTheme: SNSThemesdk.theme = SumsubTheme()SNSTheme { … }sumsubTheme(context)SNSMobileSDK.Builder(...).withTheme(...)这是核心功能(始终启用)。先检测平台,然后按顺序执行对应平台的四个阶段:扫描→映射→生成→报告。
Asking vs doing — keep approvals meaningful
请求与执行——让审批更有意义
- Read-only is free — scan / grep / read the project's colors, fonts and build settings without asking.
- Batch mutations into one approval, not one per item ("I'll write here + insert this
SumsubTheme.swiftline [diff] — apply?").sdk.theme = … - Ask explicitly only for: the target file path, genuinely ambiguous brand / legibility / font choices, and editing existing app code (the single theme-attachment line — the skill adds it itself, never punts it to the user).
- 只读操作无需审批——无需询问即可扫描/查找/读取项目的颜色、字体和构建设置。
- 批量变更只需一次审批,而非逐项审批(比如“我将在此处编写并插入这行
SumsubTheme.swift代码[差异对比]——是否应用?”)。sdk.theme = … - 仅在以下情况明确询问用户:目标文件路径、存在歧义的品牌/可读性/字体选择,以及编辑现有应用代码(仅需添加关联主题的单行代码——该功能会自行添加,不会推给用户操作)。
Detect the platform (do this before opening any stage file)
检测平台(在打开任何阶段文件前执行)
Decide whether this is an iOS or Android project — the token sources, the theme
API, and the generated language all differ. Read-only.
bash
undefined判断项目属于iOS还是Android——设计令牌来源、主题API和生成的语言均不同。此操作为只读。
bash
undefinediOS markers
iOS标识
find . -maxdepth 3 ( -name '.xcodeproj' -o -name '.xcworkspace' -o -name 'Podfile' -o -name 'Package.swift' ) 2>/dev/null
find . -maxdepth 3 ( -name '.xcodeproj' -o -name '.xcworkspace' -o -name 'Podfile' -o -name 'Package.swift' ) 2>/dev/null
Android markers
Android标识
find . -maxdepth 3 ( -name 'build.gradle' -o -name 'build.gradle.kts' -o -name 'settings.gradle*' -o -name 'AndroidManifest.xml' ) 2>/dev/null
- **iOS only** → iOS track. **Android only** → Android track.
- **Both present** → report both and **ask which platform to theme.** One platform per run.
(React Native / Flutter wrappers are out of scope — this skill themes the native SDKs.)
- **Neither** → ask the user to point at the app's source root.find . -maxdepth 3 ( -name 'build.gradle' -o -name 'build.gradle.kts' -o -name 'settings.gradle*' -o -name 'AndroidManifest.xml' ) 2>/dev/null
- **仅存在iOS标识**→执行iOS流程。**仅存在Android标识**→执行Android流程。
- **两者都存在**→告知用户并询问**要为哪个平台定制主题**。每次仅处理一个平台。(React Native/Flutter封装不在此功能范围内——此功能仅针对原生SDK定制主题。)
- **两者都不存在**→请用户指明应用的源码根目录。How to navigate this skill
如何使用此功能
A strictly linear flow per track — walk the four stages in order; each is self-contained
and ends with a Next pointer.
每个平台都有严格的线性流程——按顺序执行四个阶段;每个阶段都是独立的,结束时会有“下一步”指引。
iOS track
iOS流程
- — scan the host app's design system (read-only).
ios/stages/1-scan.md - — map tokens onto the SDK theme (after resolving open decisions).
ios/stages/2-map.md - — write
ios/stages/3-generate.md(after the path is confirmed).SumsubTheme.swift - — present the coverage report.
ios/stages/4-report.md
- — 扫描宿主应用的设计系统(只读)。
ios/stages/1-scan.md - — 将设计令牌映射到SDK主题(解决未决问题后执行)。
ios/stages/2-map.md - — 编写
ios/stages/3-generate.md(确认路径后执行)。SumsubTheme.swift - — 展示覆盖范围报告。
ios/stages/4-report.md
Android track
Android流程
- — scan the host app's design system (read-only).
android/stages/1-scan.md - — map tokens onto the SDK theme (after resolving open decisions).
android/stages/2-map.md - — write
android/stages/3-generate.md(after the path is confirmed).SumsubTheme.kt - — present the coverage report.
android/stages/4-report.md
When the stages are walked, return here for Guardrails and Handoff.
- — 扫描宿主应用的设计系统(只读)。
android/stages/1-scan.md - — 将设计令牌映射到SDK主题(解决未决问题后执行)。
android/stages/2-map.md - — 编写
android/stages/3-generate.md(确认路径后执行)。SumsubTheme.kt - — 展示覆盖范围报告。
android/stages/4-report.md
完成所有阶段后,回到此处查看约束规则和交付总结。
Guardrails — what this skill must never do
约束规则——此功能绝对不能执行的操作
- Never write the file without confirming the path with the user.
- Never leave a property at SDK default without noting it in the report.
- Never hard-code arbitrary values — colors come from the app palette or the documented alpha-derivation.
- Always show the hex (or asset / resource name) when reporting or asking; add a plain-word description in parentheses, never instead of the hex.
- Never silently guess a genuinely ambiguous choice — offer plain-word options + a recommendation; but don't over-ask where a safe default exists.
- Never theme the host app itself — only the Sumsub SDK screens.
- Never change SDK integration logic (install / init / present / launch). The skill's one edit to existing code is attaching the theme at the launch site — it makes that edit itself, with approval.
- (iOS) Never emit unsafe color/font code — no flat literals for dual-appearance apps (use named assets or
UIColor); noUIColor { traits in … }without aUIFont(name:size:)fallback; no decorative/app colors in the success/warning/critical slots.?? .systemFont(…) - (iOS) Never override for verification-flow icons — Sumsub-specific, not derivable from the host.
images.* - (Android) Never emit single-appearance colors for a dual-appearance app — resolve both variants and use the two-argument ; no
SNSThemeColor(light, dark)result without aResourcesCompat.getFontfallback.?: Typeface.… - (Android) Never override the SDK's resources (colors / strings / drawables in the host's
sns_*) — theme through the Theme API only; resource overrides fight the theme and break on SDK updates.res/ - (Android) Attach the theme on the builder — before
.withTheme(...); never try to restyle after.build().launch()
- 未经用户确认路径,绝对不能写入文件。
- 绝对不能保留SDK默认属性而不在报告中注明。
- 绝对不能硬编码任意值——颜色必须来自应用调色板或文档规定的透明度推导方式。
- 报告或询问时必须显示十六进制值(或资源名称);可在括号中添加文字说明,但不能替代十六进制值。
- 绝对不能默默猜测存在歧义的选择——提供清晰的选项及建议;但在有安全默认值的情况下不要过度询问。
- 绝对不能定制宿主应用本身的主题——仅定制Sumsub SDK界面。
- 绝对不能修改SDK集成逻辑(安装/初始化/展示/启动)。此功能对现有代码的唯一修改是在启动位置关联主题——该修改会自行完成,并需获得用户审批。
- (iOS) 绝对不能生成不安全的颜色/字体代码——双外观应用不能使用扁平的字面量(请使用命名资源或
UIColor);UIColor { traits in … }必须带有UIFont(name:size:)回退;成功/警告/严重状态不能使用装饰性/应用颜色。?? .systemFont(…) - (iOS) 绝对不能覆盖验证流程图标的属性——这些是Sumsub专属属性,无法从宿主应用推导。
images.* - (Android) 绝对不能为双外观应用生成单外观颜色——需解析两种变体并使用双参数;
SNSThemeColor(light, dark)结果必须带有ResourcesCompat.getFont回退。?: Typeface.… - (Android) 绝对不能覆盖SDK的资源(宿主应用
sns_*目录下的颜色/字符串/可绘制资源)——仅通过Theme API定制主题;资源覆盖会与主题冲突,并在SDK更新时失效。res/ - (Android) 必须在构建器上关联主题——在前调用
.build();绝对不能在.withTheme(...)后尝试重新样式化。launch()
Handoff
交付总结
After the file is generated and wired, summarise:
- File created — /
SumsubTheme.swiftand where it lives (iOS: confirm it's a target member; Android: any location under a source set compiles).SumsubTheme.kt - Coverage — the Stage 4 report (mapped / derived / left at default), plus any contrast fix or choice the user made.
- Wiring done — the exact launch site (file:line) where the theme is attached (iOS: or
sdk.theme = SumsubTheme(); Android:SumsubTheme.make()on the builder). If no integration code was found (SDK not wired up yet), say so and point to.withTheme(sumsubTheme(activity))— the theme is ready to attach once it is.sumsub-integrate-msdk
生成并关联主题文件后,总结以下内容:
- 已创建文件——/
SumsubTheme.swift及其存放位置(iOS:确认它是目标成员;Android:源码集下的任何位置均可编译)。SumsubTheme.kt - 覆盖范围——第4阶段的报告(已映射/已推导/保留默认值),加上用户做出的任何对比度调整或选择。
- 已完成关联——主题关联的确切启动位置(文件:行号)(iOS:或
sdk.theme = SumsubTheme();Android:构建器上的SumsubTheme.make())。如果未找到集成代码(SDK尚未关联),请告知用户并指向.withTheme(sumsubTheme(activity))——主题已准备好,待SDK集成完成后即可关联。sumsub-integrate-msdk