This commit is contained in:
2025-11-18 20:53:47 +08:00
parent 254e65906a
commit 3dcc4932c3
109 changed files with 1432 additions and 84 deletions

View File

@@ -26,6 +26,10 @@ extern NSString * const KBDarwinSkinChanged; // cross-process
@property (nonatomic, strong) UIColor *accentColor; // function view accents
/// 可选:键盘背景图片的 PNG/JPEG 数据(若存在,优先显示图片)
@property (nonatomic, strong, nullable) NSData *backgroundImageData;
/// 可选:需要隐藏文字的按键标识集合(例如 @"letter_q" @"space" 等)
@property (nonatomic, strong, nullable) NSArray<NSString *> *hiddenKeyTextIdentifiers;
/// 可选:按键图标映射(按键标识 -> 图标名或路径),具体加载策略由上层决定
@property (nonatomic, strong, nullable) NSDictionary<NSString *, NSString *> *keyIconMap;
@end
/// Shared skin manager (Keychain Sharing based)
@@ -50,6 +54,23 @@ extern NSString * const KBDarwinSkinChanged; // cross-process
/// 当前背景图片(若存在)
- (nullable UIImage *)currentBackgroundImage;
/// 当前主题下,指定按键标识的文字是否应被隐藏(例如图标里已包含字母)
- (BOOL)shouldHideKeyTextForIdentifier:(nullable NSString *)identifier;
/// 当前主题下,指定按键标识对应的图标名(可作为 imageName 或文件相对路径),若未配置则为 nil
- (nullable NSString *)iconNameForKeyIdentifier:(nullable NSString *)identifier;
/// 当前主题下,返回指定按键的图标图片。
/// 若 keyIconMap 中的 value 不包含 "/",则按本地 Assets 名称加载;
/// 若包含 "/",则视为相对 App Group 根目录的文件路径,从文件系统加载。
- (nullable UIImage *)iconImageForKeyIdentifier:(nullable NSString *)identifier;
/// 带大小写变体的按键图标获取接口。
/// @param identifier 逻辑按键标识(如 @"letter_q" @"space"
/// @param caseVariant 0=无变体/非字母1=小写2=大写(与 KBKeyCaseVariant 对应)
- (nullable UIImage *)iconImageForKeyIdentifier:(nullable NSString *)identifier
caseVariant:(NSInteger)caseVariant;
/// Parse a hex color string like "#RRGGBB"/"#RRGGBBAA"
+ (UIColor *)colorFromHexString:(NSString *)hex defaultColor:(UIColor *)fallback;