feat: restore five themes and native LUT thumbnail library with source-frame previews

这个提交包含在:
mac 于 2026-10-31 03:39:46 +08:00 提交
1 父节点 c5441fab87
当前提交 61ea1c64a0
17 个文件已更改
+4944 -95

没有与搜索条件相匹配的文件

+15 -8
查看文件
@@ -3,7 +3,7 @@
NSString *const DYThemeDidChange=@"DYThemeDidChange";
static NSString *const preferenceDomain=@"com.dayu.color.preferences";
static NSString *const distributedChange=@"com.dayu.color.theme.changed";
static NSColor *rgb(double r,double g,double b){return [NSColor colorWithSRGBRed:r green:g blue:b alpha:1];}
static NSColor *rgb(double r,double g,double b){return [NSColor colorWithCalibratedRed:r green:g blue:b alpha:1];}
@interface DYThemeStore : NSObject
@property(nonatomic,retain) NSUserDefaults *defaults;
@end
@@ -24,13 +24,20 @@ static NSColor *rgb(double r,double g,double b){return [NSColor colorWithSRGBRed
@end
static DYThemeStore *store(void){static DYThemeStore *s;static dispatch_once_t once;dispatch_once(&once,^{s=[DYThemeStore new];});return s;}
NSArray<NSString *> *DYThemeNames(void){return @[@"深空灰",@"冰川蓝",@"薰衣草紫",@"翡翠绿",@"琥珀橙"];}
NSInteger DYThemeIndex(void){return MAX(0,MIN(4,[store().defaults integerForKey:@"themeIndex"]));}
NSColor *DYThemeSwatch(NSInteger index){switch(index){case 0:return rgb(.36,.40,.45);case 2:return rgb(.67,.58,.97);case 3:return rgb(.29,.83,.57);case 4:return rgb(1,.66,.32);default:return rgb(.27,.73,.97);}}
void DYSetThemeIndex(NSInteger index){index=MAX(0,MIN(4,index));[store().defaults setInteger:index forKey:@"themeIndex"];[store().defaults synchronize];[[NSNotificationCenter defaultCenter]postNotificationName:DYThemeDidChange object:nil];[[NSDistributedNotificationCenter defaultCenter]postNotificationName:distributedChange object:preferenceDomain userInfo:nil deliverImmediately:YES];}
NSInteger DYThemeIndex(void){NSInteger i=[store().defaults integerForKey:@"themeIndex"];return i>=0&&i<5?i:1;}
static const double paletteRGB[5][17][3]={
{{0.11,0.12,0.14},{0.075,0.08,0.095},{0.17,0.18,0.21},{0.12,0.13,0.15},{0.27,0.29,0.33},{0.2,0.22,0.25},{0.36,0.39,0.44},{0.25,0.28,0.32},{0.21,0.23,0.26},{0.15,0.17,0.2},{0.78,0.83,0.9},{0.55,0.61,0.7},{1.0,1.0,1.0},{0.78,0.82,0.88},{0.96,0.97,0.98},{0.86,0.89,0.92},{0.67,0.72,0.77}},
{{0.031,0.086,0.148},{0.025,0.075,0.13},{0.07,0.155,0.235},{0.045,0.12,0.19},{0.115,0.22,0.33},{0.07,0.15,0.24},{0.15,0.33,0.5},{0.08,0.24,0.36},{0.23,0.32,0.41},{0.18,0.26,0.35},{0.38,0.76,1.0},{0.23,0.64,0.97},{0.96,0.98,1.0},{0.62,0.7,0.76},{0.88,0.96,1.0},{0.82,0.9,0.96},{0.58,0.7,0.78}},
{{0.11,0.09,0.17},{0.07,0.06,0.12},{0.18,0.14,0.28},{0.13,0.1,0.21},{0.27,0.22,0.42},{0.2,0.16,0.31},{0.43,0.34,0.68},{0.31,0.23,0.52},{0.22,0.18,0.31},{0.15,0.12,0.23},{0.78,0.71,1.0},{0.5,0.42,0.93},{0.95,0.9,1.0},{0.63,0.5,0.95},{0.98,0.95,1.0},{0.9,0.86,0.97},{0.7,0.66,0.82}},
{{0.08,0.17,0.1},{0.05,0.12,0.07},{0.12,0.27,0.15},{0.09,0.2,0.11},{0.16,0.35,0.2},{0.12,0.27,0.15},{0.21,0.57,0.31},{0.14,0.4,0.21},{0.14,0.27,0.16},{0.1,0.2,0.11},{0.54,0.96,0.64},{0.22,0.75,0.35},{0.91,1.0,0.93},{0.28,0.8,0.42},{0.95,1.0,0.96},{0.86,0.96,0.88},{0.66,0.8,0.68}},
{{0.23,0.15,0.08},{0.16,0.1,0.05},{0.35,0.22,0.11},{0.26,0.16,0.08},{0.45,0.28,0.14},{0.36,0.22,0.1},{0.72,0.44,0.18},{0.56,0.32,0.12},{0.29,0.18,0.09},{0.2,0.12,0.06},{0.98,0.67,0.31},{0.86,0.47,0.17},{1.0,0.86,0.57},{0.93,0.59,0.22},{1.0,0.96,0.9},{0.97,0.9,0.82},{0.8,0.7,0.58}}
};
NSColor *DYThemeSwatch(NSInteger index){static const double values[5][3]={{.30,.33,.38},{.28,.72,1},{.58,.52,1},{.30,.86,.52},{1,.61,.28}};index=MAX(0,MIN(4,index));return rgb(values[index][0],values[index][1],values[index][2]);}
void DYSetThemeIndex(NSInteger index){if(index<0||index>4)return;[store().defaults setInteger:index forKey:@"themeIndex"];[store().defaults synchronize];[[NSNotificationCenter defaultCenter]postNotificationName:DYThemeDidChange object:nil];[[NSDistributedNotificationCenter defaultCenter]postNotificationName:distributedChange object:preferenceDomain userInfo:nil deliverImmediately:YES];}
NSDictionary<NSString *,NSColor *> *DYThemePalette(void){
NSInteger index=DYThemeIndex();NSColor *accent=DYThemeSwatch(index);
double background[5][3]={{.085,.09,.10},{.018,.074,.12},{.065,.042,.13},{.022,.10,.073},{.14,.073,.028}};
double card[5][3]={{.14,.15,.17},{.045,.135,.20},{.12,.084,.21},{.044,.17,.12},{.21,.126,.063}};
return @{@"background":rgb(background[index][0],background[index][1],background[index][2]),@"card":rgb(card[index][0],card[index][1],card[index][2]),@"border":[accent colorWithAlphaComponent:.42],@"text":rgb(.86,.93,.97),@"secondary":rgb(.61,.71,.78),@"accent":accent,@"field":[rgb(card[index][0],card[index][1],card[index][2]) blendedColorWithFraction:.14 ofColor:accent]};
NSInteger index=DYThemeIndex();const double (*p)[3]=paletteRGB[index];
NSMutableDictionary *d=[NSMutableDictionary dictionary];for(int i=0;i<17;i++)d[[NSString stringWithFormat:@"slot%d",i]]=rgb(p[i][0],p[i][1],p[i][2]);
NSColor *accent=index==0?rgb(.72,.77,.84):index==1?rgb(.22,.67,1):DYThemeSwatch(index);
[d addEntriesFromDictionary:@{@"background":d[@"slot1"],@"card":d[@"slot3"],@"border":[accent colorWithAlphaComponent:.38],@"text":d[@"slot14"],@"secondary":d[@"slot16"],@"accent":accent,@"field":d[@"slot4"],@"headerTop":d[@"slot6"],@"headerBottom":d[@"slot7"],@"track":d[@"slot8"],@"activeTop":d[@"slot10"],@"activeBottom":d[@"slot11"],@"knob":d[@"slot12"]}];return d;
}
NSColor *DYThemeColor(NSString *role){return [NSColor colorWithName:[@"Dayu." stringByAppendingString:role] dynamicProvider:^NSColor *(NSAppearance *appearance){return DYThemePalette()[role]?:[NSColor whiteColor];}];}