fix: unify graphite surfaces and preserve the approved pink cyan primary action

这个提交包含在:
mac 于 2026-11-04 12:41:28 +08:00 提交
1 父节点 8e00968bf0
当前提交 998a983884
4 个文件已更改
+12 -28

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

+3 -18
查看文件
@@ -158,26 +158,12 @@ static NSArray *DYAccessibleSubviews(NSView *view, BOOL visibleOnly) {
- (void)scrollWheel:(NSEvent*)event{if(!self.hasVerticalScroller){[self.nextResponder scrollWheel:event];return;}[super scrollWheel:event];}
@end
static NSColor *DYModuleColor(NSString *key,BOOL end,CGFloat scale=1) {
NSArray *keys=@[@"primary",@"spider",@"base",@"skin",@"look",@"hsl",@"curve",@"grading",@"primaries",@"levels",@"blackwhite",@"balance",@"mixer",@"film"];
NSUInteger i=[keys indexOfObject:key?:@""];if(i==NSNotFound)i=0;
static const CGFloat colors[][2][3]={
{{.96,.18,.68},{.49,.17,1}},{{.03,.84,1},{.12,.32,1}},{{1,.35,.30},{1,.13,.67}},{{1,.70,.15},{1,.30,.39}},
{{.66,.32,1},{1,.20,.69}},{{.12,.94,.48},{.01,.72,.77}},{{.04,.82,1},{.25,.35,1}},{{1,.22,.76},{.65,.20,1}},
{{.30,.51,1},{.66,.26,1}},{{.23,.94,.56},{.01,.71,.68}},{{.70,.45,1},{.31,.31,1}},{{1,.37,.40},{1,.69,.20}},
{{.08,.73,1},{.16,.95,.74}},{{1,.64,.16},{1,.22,.56}}
};
const CGFloat *c=colors[i][end?1:0];
return [NSColor colorWithSRGBRed:c[0]*scale+(scale<1?.012:0) green:c[1]*scale+(scale<1?.006:0) blue:c[2]*scale+(scale<1?.025:0) alpha:1];
}
static NSColor *DYModuleAccent(NSString *key){return DYModuleColor(key,NO);}
@interface DYCard : DYFlippedView @end
@implementation DYCard
- (void)drawRect:(NSRect)rect {
NSBezierPath *path=[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds,.5,.5) xRadius:11 yRadius:11];
if(DYThemeIndex()==6){NSGradient *g=[[[NSGradient alloc]initWithStartingColor:DYModuleColor(self.identifier,NO,.23) endingColor:DYModuleColor(self.identifier,YES,.18)]autorelease];[g drawInBezierPath:path angle:20];[[DYModuleAccent(self.identifier)colorWithAlphaComponent:.55]setStroke];}else{DYDrawThemeSurface(path,YES);[DYThemeColor(@"border")setStroke];}
DYDrawThemeSurface(path,YES);[DYThemeColor(@"border")setStroke];
path.lineWidth=1; [path stroke];
if(DYThemeIndex()==6){[NSGraphicsContext saveGraphicsState];[path addClip];NSColor *accent=DYModuleAccent(self.identifier);NSGradient *edge=[[[NSGradient alloc]initWithStartingColor:[accent colorWithAlphaComponent:.85] endingColor:[DYThemeColor(@"accent")colorWithAlphaComponent:.12]]autorelease];[edge drawInRect:NSMakeRect(10,0,self.bounds.size.width-20,2) angle:0];[NSGraphicsContext restoreGraphicsState];}
[[NSColor colorWithWhite:.52 alpha:1]setFill];[[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(32,19,5,5)]fill];
}
@end
@@ -188,12 +174,11 @@ static NSColor *DYModuleAccent(NSString *key){return DYModuleColor(key,NO);}
@implementation DYHeader
- (void)drawRect:(NSRect)dirtyRect {
NSRect r=NSInsetRect(self.bounds,.5,2);
NSGradient *g=[[[NSGradient alloc]initWithStartingColor:DYThemeIndex()==6?DYModuleColor(self.identifier,NO,.34):DYThemePalette()[@"headerTop"] endingColor:DYThemeIndex()==6?DYModuleColor(self.identifier,YES,.27):DYThemePalette()[@"headerBottom"]]autorelease];
NSGradient *g=[[[NSGradient alloc]initWithStartingColor:DYThemePalette()[@"headerTop"] endingColor:DYThemePalette()[@"headerBottom"]]autorelease];
[g drawInBezierPath:[NSBezierPath bezierPathWithRoundedRect:r xRadius:8 yRadius:8] angle:90];
NSDictionary *attributes=DYThemeTextAttributes(self.font,DYInk());
[(self.state==NSControlStateValueOn?@"▾":@"▸") drawInRect:NSMakeRect(8,7,12,16) withAttributes:attributes];
[self.title drawInRect:NSMakeRect(23,7,MAX(0,r.size.width-31),16) withAttributes:attributes];
if(DYThemeIndex()==6){[DYModuleAccent(self.identifier)setFill];[[NSBezierPath bezierPathWithRoundedRect:NSMakeRect(2,8,2,14) xRadius:1 yRadius:1]fill];}
}
- (void)mouseDown:(NSEvent *)event {
if(event.clickCount==2) [NSApp sendAction:self.doubleClickAction to:self.target from:self];
@@ -584,7 +569,7 @@ static NSImage *DYWheelImage(void) {
- (void)openWebsite:(id)sender {[[NSWorkspace sharedWorkspace]openURL:[NSURL URLWithString:@"https://dayu.media"]];}
- (void)redrawTree:(NSView *)view { [view setNeedsDisplay:YES];for(NSView *child in view.subviews)[self redrawTree:child]; }
- (void)themeChanged:(NSNotification *)notification {
for(NSDictionary *card in _cards){NSColor *accent=DYThemeIndex()==6?DYModuleAccent(card[@"section"][@"key"]):DYAccent();for(NSString *key in @[@"enabled",@"maskButton",@"repeatButton",@"removeButton"])[card[key]setContentTintColor:accent];}
for(NSDictionary *card in _cards){NSColor *accent=DYThemeIndex()==6?DYThemeColor(@"secondary"):DYAccent();for(NSString *key in @[@"enabled",@"maskButton",@"repeatButton",@"removeButton"])[card[key]setContentTintColor:accent];}
self.layer.backgroundColor=[DYThemePalette()[@"background"] CGColor];
for(NSButton *b in _themeButtons)b.state=b.tag==DYThemeIndex()?NSControlStateValueOn:NSControlStateValueOff;
_websiteLink.attributedTitle=[[[NSAttributedString alloc]initWithString:_websiteLink.title attributes:DYThemeTextAttributes(_websiteLink.font,DYAccent())]autorelease];
+4 -5
查看文件
@@ -32,7 +32,7 @@ static const double paletteRGB[7][17][3]={
{{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}},
{{.065,.060,.050},{.012,.012,.012},{.12,.105,.075},{.045,.042,.035},{.105,.092,.065},{.15,.125,.075},{.17,.14,.085},{.075,.065,.045},{.23,.20,.14},{.10,.09,.065},{.98,.82,.42},{.72,.51,.18},{1,.90,.65},{.88,.74,.43},{1,.86,.48},{.96,.82,.49},{.79,.70,.48}},
{{.15,.04,.24},{.075,.018,.14},{.20,.055,.29},{.13,.025,.23},{.14,.045,.25},{.18,.07,.30},{.23,.07,.34},{.09,.065,.25},{.27,.17,.39},{.13,.07,.23},{.90,.20,.83},{.02,.79,.94},{.93,.97,1},{.55,.80,.90},{.95,.97,1},{.86,.91,.96},{.72,.78,.85}}
{{.11,.10,.13},{.045,.040,.055},{.16,.14,.20},{.083,.073,.103},{.115,.104,.139},{.15,.135,.18},{.16,.145,.19},{.105,.10,.13},{.24,.22,.28},{.14,.125,.17},{.90,.20,.83},{.02,.79,.94},{.93,.97,1},{.75,.72,.82},{.95,.97,1},{.86,.86,.91},{.67,.64,.73}}
};
NSColor *DYThemeSwatch(NSInteger index){static const double values[7][3]={{.30,.33,.38},{.28,.72,1},{.58,.52,1},{.30,.86,.52},{1,.61,.28},{.96,.77,.36},{.65,.38,1}};index=MAX(0,MIN(6,index));return rgb(values[index][0],values[index][1],values[index][2]);}
void DYSetThemeIndex(NSInteger index){if(index<0||index>6)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];}
@@ -42,8 +42,8 @@ NSDictionary<NSString *,NSColor *> *DYThemePalette(void){
for(NSInteger index=0;index<7;index++){
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):index==6?rgb(.08,.79,.94):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"]}];d[@"backgroundEnd"]=index==5?rgb(.085,.078,.060):d[@"background"];d[@"cardEnd"]=index==5?rgb(.085,.075,.052):d[@"card"];if(index==6){d[@"backgroundEnd"]=rgb(.01,.16,.20);d[@"cardEnd"]=rgb(.035,.12,.25);d[@"border"]=[rgb(.47,.37,.88)colorWithAlphaComponent:.55];} [all addObject:[[d copy]autorelease]];
NSColor *accent=index==0?rgb(.72,.77,.84):index==1?rgb(.22,.67,1):index==6?rgb(.78,.75,.87):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"]}];d[@"backgroundEnd"]=index==5?rgb(.085,.078,.060):d[@"background"];d[@"cardEnd"]=index==5?rgb(.085,.075,.052):d[@"card"];if(index==6){d[@"backgroundEnd"]=rgb(.065,.060,.080);d[@"cardEnd"]=rgb(.093,.090,.110);d[@"border"]=[rgb(.36,.33,.43)colorWithAlphaComponent:.40];} [all addObject:[[d copy]autorelease]];
}palettes=[all copy];
});return palettes[DYThemeIndex()];
}
@@ -64,8 +64,7 @@ NSDictionary *DYThemeTextAttributes(NSFont *font,NSColor *color) {
}
void DYDrawThemeSurface(NSBezierPath *path,BOOL card) {
NSDictionary *palette=DYThemePalette();NSString *role=card?@"card":@"background";
if(DYThemeIndex()==6&&!card){NSGradient *g=[[[NSGradient alloc]initWithColors:@[palette[role],rgb(.035,.035,.21),palette[@"backgroundEnd"]]]autorelease];[g drawInBezierPath:path angle:25];}
else if(DYThemeIndex()>=5){NSGradient *gradient=[[[NSGradient alloc]initWithStartingColor:palette[role] endingColor:palette[card?@"cardEnd":@"backgroundEnd"]]autorelease];[gradient drawInBezierPath:path angle:35];}
if(DYThemeIndex()>=5){NSGradient *gradient=[[[NSGradient alloc]initWithStartingColor:palette[role] endingColor:palette[card?@"cardEnd":@"backgroundEnd"]]autorelease];[gradient drawInBezierPath:path angle:35];}
else {[palette[role]setFill];[path fill];}
}
@implementation DYThemeLabel
+3 -3
查看文件
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.8.3</string>
<string>1.8.4</string>
<key>CFBundleVersion</key>
<string>62</string>
<string>63</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>PlugInKit</key>
@@ -71,7 +71,7 @@
<key>uuid</key>
<string>1C17B73B-F229-4C09-A434-EAF6DFF5F22A</string>
<key>version</key>
<string>1.8.3</string>
<string>1.8.4</string>
</dict>
<dict>
<key>className</key>
+2 -2
查看文件
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.8.3</string>
<string>1.8.4</string>
<key>CFBundleVersion</key>
<string>62</string>
<string>63</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>