1use crate::common::*;
4use crate::AppKit::*;
5use crate::CoreData::*;
6use crate::Foundation::*;
7
8extern_static!(NSAppKitVersionNumberWithPatternColorLeakFix: NSAppKitVersion = 641.0);
9
10ns_enum!(
11 #[underlying(NSInteger)]
12 pub enum NSColorType {
13 NSColorTypeComponentBased = 0,
14 NSColorTypePattern = 1,
15 NSColorTypeCatalog = 2,
16 }
17);
18
19ns_enum!(
20 #[underlying(NSInteger)]
21 pub enum NSColorSystemEffect {
22 NSColorSystemEffectNone = 0,
23 NSColorSystemEffectPressed = 1,
24 NSColorSystemEffectDeepPressed = 2,
25 NSColorSystemEffectDisabled = 3,
26 NSColorSystemEffectRollover = 4,
27 }
28);
29
30extern_class!(
31 #[derive(Debug, PartialEq, Eq, Hash)]
32 #[cfg(feature = "AppKit_NSColor")]
33 pub struct NSColor;
34
35 #[cfg(feature = "AppKit_NSColor")]
36 unsafe impl ClassType for NSColor {
37 type Super = NSObject;
38 type Mutability = Immutable;
39 }
40);
41
42#[cfg(feature = "AppKit_NSColor")]
43unsafe impl Send for NSColor {}
44
45#[cfg(feature = "AppKit_NSColor")]
46unsafe impl Sync for NSColor {}
47
48#[cfg(feature = "AppKit_NSColor")]
49unsafe impl NSCoding for NSColor {}
50
51#[cfg(feature = "AppKit_NSColor")]
52unsafe impl NSCopying for NSColor {}
53
54#[cfg(feature = "AppKit_NSColor")]
55unsafe impl NSObjectProtocol for NSColor {}
56
57#[cfg(feature = "AppKit_NSColor")]
58unsafe impl NSPasteboardReading for NSColor {}
59
60#[cfg(feature = "AppKit_NSColor")]
61unsafe impl NSPasteboardWriting for NSColor {}
62
63#[cfg(feature = "AppKit_NSColor")]
64unsafe impl NSSecureCoding for NSColor {}
65
66extern_methods!(
67 #[cfg(feature = "AppKit_NSColor")]
68 unsafe impl NSColor {
69 #[method_id(@__retain_semantics Init init)]
70 pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
71
72 #[cfg(feature = "Foundation_NSCoder")]
73 #[method_id(@__retain_semantics Init initWithCoder:)]
74 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Option<Id<Self>>;
75
76 #[cfg(feature = "AppKit_NSColorSpace")]
77 #[method_id(@__retain_semantics Other colorWithColorSpace:components:count:)]
78 pub unsafe fn colorWithColorSpace_components_count(
79 space: &NSColorSpace,
80 components: NonNull<CGFloat>,
81 number_of_components: NSInteger,
82 ) -> Id<NSColor>;
83
84 #[method_id(@__retain_semantics Other colorWithSRGBRed:green:blue:alpha:)]
85 pub unsafe fn colorWithSRGBRed_green_blue_alpha(
86 red: CGFloat,
87 green: CGFloat,
88 blue: CGFloat,
89 alpha: CGFloat,
90 ) -> Id<NSColor>;
91
92 #[method_id(@__retain_semantics Other colorWithGenericGamma22White:alpha:)]
93 pub unsafe fn colorWithGenericGamma22White_alpha(
94 white: CGFloat,
95 alpha: CGFloat,
96 ) -> Id<NSColor>;
97
98 #[method_id(@__retain_semantics Other colorWithDisplayP3Red:green:blue:alpha:)]
99 pub unsafe fn colorWithDisplayP3Red_green_blue_alpha(
100 red: CGFloat,
101 green: CGFloat,
102 blue: CGFloat,
103 alpha: CGFloat,
104 ) -> Id<NSColor>;
105
106 #[method_id(@__retain_semantics Other colorWithWhite:alpha:)]
107 pub unsafe fn colorWithWhite_alpha(white: CGFloat, alpha: CGFloat) -> Id<NSColor>;
108
109 #[method_id(@__retain_semantics Other colorWithRed:green:blue:alpha:)]
110 pub unsafe fn colorWithRed_green_blue_alpha(
111 red: CGFloat,
112 green: CGFloat,
113 blue: CGFloat,
114 alpha: CGFloat,
115 ) -> Id<NSColor>;
116
117 #[method_id(@__retain_semantics Other colorWithHue:saturation:brightness:alpha:)]
118 pub unsafe fn colorWithHue_saturation_brightness_alpha(
119 hue: CGFloat,
120 saturation: CGFloat,
121 brightness: CGFloat,
122 alpha: CGFloat,
123 ) -> Id<NSColor>;
124
125 #[cfg(feature = "AppKit_NSColorSpace")]
126 #[method_id(@__retain_semantics Other colorWithColorSpace:hue:saturation:brightness:alpha:)]
127 pub unsafe fn colorWithColorSpace_hue_saturation_brightness_alpha(
128 space: &NSColorSpace,
129 hue: CGFloat,
130 saturation: CGFloat,
131 brightness: CGFloat,
132 alpha: CGFloat,
133 ) -> Id<NSColor>;
134
135 #[method_id(@__retain_semantics Other colorWithCatalogName:colorName:)]
136 pub unsafe fn colorWithCatalogName_colorName(
137 list_name: &NSColorListName,
138 color_name: &NSColorName,
139 ) -> Option<Id<NSColor>>;
140
141 #[cfg(feature = "Foundation_NSBundle")]
142 #[method_id(@__retain_semantics Other colorNamed:bundle:)]
143 pub unsafe fn colorNamed_bundle(
144 name: &NSColorName,
145 bundle: Option<&NSBundle>,
146 ) -> Option<Id<NSColor>>;
147
148 #[method_id(@__retain_semantics Other colorNamed:)]
149 pub unsafe fn colorNamed(name: &NSColorName) -> Option<Id<NSColor>>;
150
151 #[cfg(feature = "AppKit_NSAppearance")]
152 #[method_id(@__retain_semantics Other colorWithName:dynamicProvider:)]
153 pub unsafe fn colorWithName_dynamicProvider(
154 color_name: Option<&NSColorName>,
155 dynamic_provider: &Block<(NonNull<NSAppearance>,), NonNull<NSColor>>,
156 ) -> Id<NSColor>;
157
158 #[method_id(@__retain_semantics Other colorWithDeviceWhite:alpha:)]
159 pub unsafe fn colorWithDeviceWhite_alpha(white: CGFloat, alpha: CGFloat) -> Id<NSColor>;
160
161 #[method_id(@__retain_semantics Other colorWithDeviceRed:green:blue:alpha:)]
162 pub unsafe fn colorWithDeviceRed_green_blue_alpha(
163 red: CGFloat,
164 green: CGFloat,
165 blue: CGFloat,
166 alpha: CGFloat,
167 ) -> Id<NSColor>;
168
169 #[method_id(@__retain_semantics Other colorWithDeviceHue:saturation:brightness:alpha:)]
170 pub unsafe fn colorWithDeviceHue_saturation_brightness_alpha(
171 hue: CGFloat,
172 saturation: CGFloat,
173 brightness: CGFloat,
174 alpha: CGFloat,
175 ) -> Id<NSColor>;
176
177 #[method_id(@__retain_semantics Other colorWithDeviceCyan:magenta:yellow:black:alpha:)]
178 pub unsafe fn colorWithDeviceCyan_magenta_yellow_black_alpha(
179 cyan: CGFloat,
180 magenta: CGFloat,
181 yellow: CGFloat,
182 black: CGFloat,
183 alpha: CGFloat,
184 ) -> Id<NSColor>;
185
186 #[method_id(@__retain_semantics Other colorWithCalibratedWhite:alpha:)]
187 pub unsafe fn colorWithCalibratedWhite_alpha(white: CGFloat, alpha: CGFloat)
188 -> Id<NSColor>;
189
190 #[method_id(@__retain_semantics Other colorWithCalibratedRed:green:blue:alpha:)]
191 pub unsafe fn colorWithCalibratedRed_green_blue_alpha(
192 red: CGFloat,
193 green: CGFloat,
194 blue: CGFloat,
195 alpha: CGFloat,
196 ) -> Id<NSColor>;
197
198 #[method_id(@__retain_semantics Other colorWithCalibratedHue:saturation:brightness:alpha:)]
199 pub unsafe fn colorWithCalibratedHue_saturation_brightness_alpha(
200 hue: CGFloat,
201 saturation: CGFloat,
202 brightness: CGFloat,
203 alpha: CGFloat,
204 ) -> Id<NSColor>;
205
206 #[cfg(feature = "AppKit_NSImage")]
207 #[method_id(@__retain_semantics Other colorWithPatternImage:)]
208 pub unsafe fn colorWithPatternImage(image: &NSImage) -> Id<NSColor>;
209
210 #[method(type)]
211 pub unsafe fn r#type(&self) -> NSColorType;
212
213 #[method_id(@__retain_semantics Other colorUsingType:)]
214 pub unsafe fn colorUsingType(&self, r#type: NSColorType) -> Option<Id<NSColor>>;
215
216 #[cfg(feature = "AppKit_NSColorSpace")]
217 #[method_id(@__retain_semantics Other colorUsingColorSpace:)]
218 pub unsafe fn colorUsingColorSpace(&self, space: &NSColorSpace) -> Option<Id<NSColor>>;
219
220 #[method_id(@__retain_semantics Other blackColor)]
221 pub unsafe fn blackColor() -> Id<NSColor>;
222
223 #[method_id(@__retain_semantics Other darkGrayColor)]
224 pub unsafe fn darkGrayColor() -> Id<NSColor>;
225
226 #[method_id(@__retain_semantics Other lightGrayColor)]
227 pub unsafe fn lightGrayColor() -> Id<NSColor>;
228
229 #[method_id(@__retain_semantics Other whiteColor)]
230 pub unsafe fn whiteColor() -> Id<NSColor>;
231
232 #[method_id(@__retain_semantics Other grayColor)]
233 pub unsafe fn grayColor() -> Id<NSColor>;
234
235 #[method_id(@__retain_semantics Other redColor)]
236 pub unsafe fn redColor() -> Id<NSColor>;
237
238 #[method_id(@__retain_semantics Other greenColor)]
239 pub unsafe fn greenColor() -> Id<NSColor>;
240
241 #[method_id(@__retain_semantics Other blueColor)]
242 pub unsafe fn blueColor() -> Id<NSColor>;
243
244 #[method_id(@__retain_semantics Other cyanColor)]
245 pub unsafe fn cyanColor() -> Id<NSColor>;
246
247 #[method_id(@__retain_semantics Other yellowColor)]
248 pub unsafe fn yellowColor() -> Id<NSColor>;
249
250 #[method_id(@__retain_semantics Other magentaColor)]
251 pub unsafe fn magentaColor() -> Id<NSColor>;
252
253 #[method_id(@__retain_semantics Other orangeColor)]
254 pub unsafe fn orangeColor() -> Id<NSColor>;
255
256 #[method_id(@__retain_semantics Other purpleColor)]
257 pub unsafe fn purpleColor() -> Id<NSColor>;
258
259 #[method_id(@__retain_semantics Other brownColor)]
260 pub unsafe fn brownColor() -> Id<NSColor>;
261
262 #[method_id(@__retain_semantics Other clearColor)]
263 pub unsafe fn clearColor() -> Id<NSColor>;
264
265 #[method_id(@__retain_semantics Other labelColor)]
266 pub unsafe fn labelColor() -> Id<NSColor>;
267
268 #[method_id(@__retain_semantics Other secondaryLabelColor)]
269 pub unsafe fn secondaryLabelColor() -> Id<NSColor>;
270
271 #[method_id(@__retain_semantics Other tertiaryLabelColor)]
272 pub unsafe fn tertiaryLabelColor() -> Id<NSColor>;
273
274 #[method_id(@__retain_semantics Other quaternaryLabelColor)]
275 pub unsafe fn quaternaryLabelColor() -> Id<NSColor>;
276
277 #[method_id(@__retain_semantics Other quinaryLabelColor)]
278 pub unsafe fn quinaryLabelColor() -> Id<NSColor>;
279
280 #[method_id(@__retain_semantics Other linkColor)]
281 pub unsafe fn linkColor() -> Id<NSColor>;
282
283 #[method_id(@__retain_semantics Other placeholderTextColor)]
284 pub unsafe fn placeholderTextColor() -> Id<NSColor>;
285
286 #[method_id(@__retain_semantics Other windowFrameTextColor)]
287 pub unsafe fn windowFrameTextColor() -> Id<NSColor>;
288
289 #[method_id(@__retain_semantics Other selectedMenuItemTextColor)]
290 pub unsafe fn selectedMenuItemTextColor() -> Id<NSColor>;
291
292 #[method_id(@__retain_semantics Other alternateSelectedControlTextColor)]
293 pub unsafe fn alternateSelectedControlTextColor() -> Id<NSColor>;
294
295 #[method_id(@__retain_semantics Other headerTextColor)]
296 pub unsafe fn headerTextColor() -> Id<NSColor>;
297
298 #[method_id(@__retain_semantics Other separatorColor)]
299 pub unsafe fn separatorColor() -> Id<NSColor>;
300
301 #[method_id(@__retain_semantics Other gridColor)]
302 pub unsafe fn gridColor() -> Id<NSColor>;
303
304 #[method_id(@__retain_semantics Other windowBackgroundColor)]
305 pub unsafe fn windowBackgroundColor() -> Id<NSColor>;
306
307 #[method_id(@__retain_semantics Other underPageBackgroundColor)]
308 pub unsafe fn underPageBackgroundColor() -> Id<NSColor>;
309
310 #[method_id(@__retain_semantics Other controlBackgroundColor)]
311 pub unsafe fn controlBackgroundColor() -> Id<NSColor>;
312
313 #[method_id(@__retain_semantics Other selectedContentBackgroundColor)]
314 pub unsafe fn selectedContentBackgroundColor() -> Id<NSColor>;
315
316 #[method_id(@__retain_semantics Other unemphasizedSelectedContentBackgroundColor)]
317 pub unsafe fn unemphasizedSelectedContentBackgroundColor() -> Id<NSColor>;
318
319 #[cfg(feature = "Foundation_NSArray")]
320 #[method_id(@__retain_semantics Other alternatingContentBackgroundColors)]
321 pub unsafe fn alternatingContentBackgroundColors() -> Id<NSArray<NSColor>>;
322
323 #[method_id(@__retain_semantics Other findHighlightColor)]
324 pub unsafe fn findHighlightColor() -> Id<NSColor>;
325
326 #[method_id(@__retain_semantics Other textColor)]
327 pub unsafe fn textColor() -> Id<NSColor>;
328
329 #[method_id(@__retain_semantics Other textBackgroundColor)]
330 pub unsafe fn textBackgroundColor() -> Id<NSColor>;
331
332 #[method_id(@__retain_semantics Other textInsertionPointColor)]
333 pub unsafe fn textInsertionPointColor() -> Id<NSColor>;
334
335 #[method_id(@__retain_semantics Other selectedTextColor)]
336 pub unsafe fn selectedTextColor() -> Id<NSColor>;
337
338 #[method_id(@__retain_semantics Other selectedTextBackgroundColor)]
339 pub unsafe fn selectedTextBackgroundColor() -> Id<NSColor>;
340
341 #[method_id(@__retain_semantics Other unemphasizedSelectedTextBackgroundColor)]
342 pub unsafe fn unemphasizedSelectedTextBackgroundColor() -> Id<NSColor>;
343
344 #[method_id(@__retain_semantics Other unemphasizedSelectedTextColor)]
345 pub unsafe fn unemphasizedSelectedTextColor() -> Id<NSColor>;
346
347 #[method_id(@__retain_semantics Other controlColor)]
348 pub unsafe fn controlColor() -> Id<NSColor>;
349
350 #[method_id(@__retain_semantics Other controlTextColor)]
351 pub unsafe fn controlTextColor() -> Id<NSColor>;
352
353 #[method_id(@__retain_semantics Other selectedControlColor)]
354 pub unsafe fn selectedControlColor() -> Id<NSColor>;
355
356 #[method_id(@__retain_semantics Other selectedControlTextColor)]
357 pub unsafe fn selectedControlTextColor() -> Id<NSColor>;
358
359 #[method_id(@__retain_semantics Other disabledControlTextColor)]
360 pub unsafe fn disabledControlTextColor() -> Id<NSColor>;
361
362 #[method_id(@__retain_semantics Other keyboardFocusIndicatorColor)]
363 pub unsafe fn keyboardFocusIndicatorColor() -> Id<NSColor>;
364
365 #[method_id(@__retain_semantics Other scrubberTexturedBackgroundColor)]
366 pub unsafe fn scrubberTexturedBackgroundColor() -> Id<NSColor>;
367
368 #[method_id(@__retain_semantics Other systemRedColor)]
369 pub unsafe fn systemRedColor() -> Id<NSColor>;
370
371 #[method_id(@__retain_semantics Other systemGreenColor)]
372 pub unsafe fn systemGreenColor() -> Id<NSColor>;
373
374 #[method_id(@__retain_semantics Other systemBlueColor)]
375 pub unsafe fn systemBlueColor() -> Id<NSColor>;
376
377 #[method_id(@__retain_semantics Other systemOrangeColor)]
378 pub unsafe fn systemOrangeColor() -> Id<NSColor>;
379
380 #[method_id(@__retain_semantics Other systemYellowColor)]
381 pub unsafe fn systemYellowColor() -> Id<NSColor>;
382
383 #[method_id(@__retain_semantics Other systemBrownColor)]
384 pub unsafe fn systemBrownColor() -> Id<NSColor>;
385
386 #[method_id(@__retain_semantics Other systemPinkColor)]
387 pub unsafe fn systemPinkColor() -> Id<NSColor>;
388
389 #[method_id(@__retain_semantics Other systemPurpleColor)]
390 pub unsafe fn systemPurpleColor() -> Id<NSColor>;
391
392 #[method_id(@__retain_semantics Other systemGrayColor)]
393 pub unsafe fn systemGrayColor() -> Id<NSColor>;
394
395 #[method_id(@__retain_semantics Other systemTealColor)]
396 pub unsafe fn systemTealColor() -> Id<NSColor>;
397
398 #[method_id(@__retain_semantics Other systemIndigoColor)]
399 pub unsafe fn systemIndigoColor() -> Id<NSColor>;
400
401 #[method_id(@__retain_semantics Other systemMintColor)]
402 pub unsafe fn systemMintColor() -> Id<NSColor>;
403
404 #[method_id(@__retain_semantics Other systemCyanColor)]
405 pub unsafe fn systemCyanColor() -> Id<NSColor>;
406
407 #[method_id(@__retain_semantics Other systemFillColor)]
408 pub unsafe fn systemFillColor() -> Id<NSColor>;
409
410 #[method_id(@__retain_semantics Other secondarySystemFillColor)]
411 pub unsafe fn secondarySystemFillColor() -> Id<NSColor>;
412
413 #[method_id(@__retain_semantics Other tertiarySystemFillColor)]
414 pub unsafe fn tertiarySystemFillColor() -> Id<NSColor>;
415
416 #[method_id(@__retain_semantics Other quaternarySystemFillColor)]
417 pub unsafe fn quaternarySystemFillColor() -> Id<NSColor>;
418
419 #[method_id(@__retain_semantics Other quinarySystemFillColor)]
420 pub unsafe fn quinarySystemFillColor() -> Id<NSColor>;
421
422 #[method_id(@__retain_semantics Other controlAccentColor)]
423 pub unsafe fn controlAccentColor() -> Id<NSColor>;
424
425 #[method(currentControlTint)]
426 pub unsafe fn currentControlTint() -> NSControlTint;
427
428 #[deprecated = "NSControlTint does not describe the full range of available control accent colors. Use +[NSColor controlAccentColor] instead."]
429 #[method_id(@__retain_semantics Other colorForControlTint:)]
430 pub unsafe fn colorForControlTint(control_tint: NSControlTint) -> Id<NSColor>;
431
432 #[method_id(@__retain_semantics Other highlightColor)]
433 pub unsafe fn highlightColor() -> Id<NSColor>;
434
435 #[method_id(@__retain_semantics Other shadowColor)]
436 pub unsafe fn shadowColor() -> Id<NSColor>;
437
438 #[method_id(@__retain_semantics Other highlightWithLevel:)]
439 pub unsafe fn highlightWithLevel(&self, val: CGFloat) -> Option<Id<NSColor>>;
440
441 #[method_id(@__retain_semantics Other shadowWithLevel:)]
442 pub unsafe fn shadowWithLevel(&self, val: CGFloat) -> Option<Id<NSColor>>;
443
444 #[method_id(@__retain_semantics Other colorWithSystemEffect:)]
445 pub unsafe fn colorWithSystemEffect(
446 &self,
447 system_effect: NSColorSystemEffect,
448 ) -> Id<NSColor>;
449
450 #[method(set)]
451 pub unsafe fn set(&self);
452
453 #[method(setFill)]
454 pub unsafe fn setFill(&self);
455
456 #[method(setStroke)]
457 pub unsafe fn setStroke(&self);
458
459 #[method_id(@__retain_semantics Other blendedColorWithFraction:ofColor:)]
460 pub unsafe fn blendedColorWithFraction_ofColor(
461 &self,
462 fraction: CGFloat,
463 color: &NSColor,
464 ) -> Option<Id<NSColor>>;
465
466 #[method_id(@__retain_semantics Other colorWithAlphaComponent:)]
467 pub unsafe fn colorWithAlphaComponent(&self, alpha: CGFloat) -> Id<NSColor>;
468
469 #[method_id(@__retain_semantics Other catalogNameComponent)]
470 pub unsafe fn catalogNameComponent(&self) -> Id<NSColorListName>;
471
472 #[method_id(@__retain_semantics Other colorNameComponent)]
473 pub unsafe fn colorNameComponent(&self) -> Id<NSColorName>;
474
475 #[cfg(feature = "Foundation_NSString")]
476 #[method_id(@__retain_semantics Other localizedCatalogNameComponent)]
477 pub unsafe fn localizedCatalogNameComponent(&self) -> Id<NSString>;
478
479 #[cfg(feature = "Foundation_NSString")]
480 #[method_id(@__retain_semantics Other localizedColorNameComponent)]
481 pub unsafe fn localizedColorNameComponent(&self) -> Id<NSString>;
482
483 #[method(redComponent)]
484 pub unsafe fn redComponent(&self) -> CGFloat;
485
486 #[method(greenComponent)]
487 pub unsafe fn greenComponent(&self) -> CGFloat;
488
489 #[method(blueComponent)]
490 pub unsafe fn blueComponent(&self) -> CGFloat;
491
492 #[method(getRed:green:blue:alpha:)]
493 pub unsafe fn getRed_green_blue_alpha(
494 &self,
495 red: *mut CGFloat,
496 green: *mut CGFloat,
497 blue: *mut CGFloat,
498 alpha: *mut CGFloat,
499 );
500
501 #[method(hueComponent)]
502 pub unsafe fn hueComponent(&self) -> CGFloat;
503
504 #[method(saturationComponent)]
505 pub unsafe fn saturationComponent(&self) -> CGFloat;
506
507 #[method(brightnessComponent)]
508 pub unsafe fn brightnessComponent(&self) -> CGFloat;
509
510 #[method(getHue:saturation:brightness:alpha:)]
511 pub unsafe fn getHue_saturation_brightness_alpha(
512 &self,
513 hue: *mut CGFloat,
514 saturation: *mut CGFloat,
515 brightness: *mut CGFloat,
516 alpha: *mut CGFloat,
517 );
518
519 #[method(whiteComponent)]
520 pub unsafe fn whiteComponent(&self) -> CGFloat;
521
522 #[method(getWhite:alpha:)]
523 pub unsafe fn getWhite_alpha(&self, white: *mut CGFloat, alpha: *mut CGFloat);
524
525 #[method(cyanComponent)]
526 pub unsafe fn cyanComponent(&self) -> CGFloat;
527
528 #[method(magentaComponent)]
529 pub unsafe fn magentaComponent(&self) -> CGFloat;
530
531 #[method(yellowComponent)]
532 pub unsafe fn yellowComponent(&self) -> CGFloat;
533
534 #[method(blackComponent)]
535 pub unsafe fn blackComponent(&self) -> CGFloat;
536
537 #[method(getCyan:magenta:yellow:black:alpha:)]
538 pub unsafe fn getCyan_magenta_yellow_black_alpha(
539 &self,
540 cyan: *mut CGFloat,
541 magenta: *mut CGFloat,
542 yellow: *mut CGFloat,
543 black: *mut CGFloat,
544 alpha: *mut CGFloat,
545 );
546
547 #[cfg(feature = "AppKit_NSColorSpace")]
548 #[method_id(@__retain_semantics Other colorSpace)]
549 pub unsafe fn colorSpace(&self) -> Id<NSColorSpace>;
550
551 #[method(numberOfComponents)]
552 pub unsafe fn numberOfComponents(&self) -> NSInteger;
553
554 #[method(getComponents:)]
555 pub unsafe fn getComponents(&self, components: NonNull<CGFloat>);
556
557 #[cfg(feature = "AppKit_NSImage")]
558 #[method_id(@__retain_semantics Other patternImage)]
559 pub unsafe fn patternImage(&self) -> Id<NSImage>;
560
561 #[method(alphaComponent)]
562 pub unsafe fn alphaComponent(&self) -> CGFloat;
563
564 #[cfg(feature = "AppKit_NSPasteboard")]
565 #[method_id(@__retain_semantics Other colorFromPasteboard:)]
566 pub unsafe fn colorFromPasteboard(paste_board: &NSPasteboard) -> Option<Id<NSColor>>;
567
568 #[cfg(feature = "AppKit_NSPasteboard")]
569 #[method(writeToPasteboard:)]
570 pub unsafe fn writeToPasteboard(&self, paste_board: &NSPasteboard);
571
572 #[method(drawSwatchInRect:)]
573 pub unsafe fn drawSwatchInRect(&self, rect: NSRect);
574
575 #[deprecated = "Use `showsAlpha` in `NSColorPanel` and `supportsAlpha` in `NSColorWell` to control alpha behavior for individual controls."]
576 #[method(ignoresAlpha)]
577 pub unsafe fn ignoresAlpha(mtm: MainThreadMarker) -> bool;
578
579 #[deprecated = "Use `showsAlpha` in `NSColorPanel` and `supportsAlpha` in `NSColorWell` to control alpha behavior for individual controls."]
580 #[method(setIgnoresAlpha:)]
581 pub unsafe fn setIgnoresAlpha(ignores_alpha: bool, mtm: MainThreadMarker);
582 }
583);
584
585extern_methods!(
586 #[cfg(feature = "AppKit_NSColor")]
588 unsafe impl NSColor {
589 #[method_id(@__retain_semantics New new)]
590 pub unsafe fn new() -> Id<Self>;
591 }
592);
593
594extern_methods!(
595 #[cfg(feature = "AppKit_NSColor")]
597 unsafe impl NSColor {
598 #[deprecated = "Use a color that matches the semantics being used, such as `separatorColor`"]
599 #[method_id(@__retain_semantics Other controlHighlightColor)]
600 pub unsafe fn controlHighlightColor() -> Id<NSColor>;
601
602 #[deprecated = "Use a color that matches the semantics being used, such as `separatorColor`"]
603 #[method_id(@__retain_semantics Other controlLightHighlightColor)]
604 pub unsafe fn controlLightHighlightColor() -> Id<NSColor>;
605
606 #[deprecated = "Use a color that matches the semantics being used, such as `separatorColor`"]
607 #[method_id(@__retain_semantics Other controlShadowColor)]
608 pub unsafe fn controlShadowColor() -> Id<NSColor>;
609
610 #[deprecated = "Use a color that matches the semantics being used, such as `separatorColor`"]
611 #[method_id(@__retain_semantics Other controlDarkShadowColor)]
612 pub unsafe fn controlDarkShadowColor() -> Id<NSColor>;
613
614 #[deprecated = "Use NSScroller instead"]
615 #[method_id(@__retain_semantics Other scrollBarColor)]
616 pub unsafe fn scrollBarColor() -> Id<NSColor>;
617
618 #[deprecated = "Use NSScroller instead"]
619 #[method_id(@__retain_semantics Other knobColor)]
620 pub unsafe fn knobColor() -> Id<NSColor>;
621
622 #[deprecated = "Use NSScroller instead"]
623 #[method_id(@__retain_semantics Other selectedKnobColor)]
624 pub unsafe fn selectedKnobColor() -> Id<NSColor>;
625
626 #[deprecated = "Use NSVisualEffectMaterialTitlebar"]
627 #[method_id(@__retain_semantics Other windowFrameColor)]
628 pub unsafe fn windowFrameColor() -> Id<NSColor>;
629
630 #[deprecated = "Use NSVisualEffectMaterialSelection"]
631 #[method_id(@__retain_semantics Other selectedMenuItemColor)]
632 pub unsafe fn selectedMenuItemColor() -> Id<NSColor>;
633
634 #[deprecated = "Use NSVisualEffectMaterialHeaderView"]
635 #[method_id(@__retain_semantics Other headerColor)]
636 pub unsafe fn headerColor() -> Id<NSColor>;
637
638 #[deprecated]
639 #[method_id(@__retain_semantics Other secondarySelectedControlColor)]
640 pub unsafe fn secondarySelectedControlColor() -> Id<NSColor>;
641
642 #[deprecated]
643 #[method_id(@__retain_semantics Other alternateSelectedControlColor)]
644 pub unsafe fn alternateSelectedControlColor() -> Id<NSColor>;
645
646 #[cfg(feature = "Foundation_NSArray")]
647 #[deprecated]
648 #[method_id(@__retain_semantics Other controlAlternatingRowBackgroundColors)]
649 pub unsafe fn controlAlternatingRowBackgroundColors() -> Id<NSArray<NSColor>>;
650
651 #[deprecated = "Use -type and NSColorType instead"]
652 #[method_id(@__retain_semantics Other colorSpaceName)]
653 pub unsafe fn colorSpaceName(&self) -> Id<NSColorSpaceName>;
654
655 #[cfg(feature = "Foundation_NSDictionary")]
656 #[deprecated = "Use -colorUsingType: or -colorUsingColorSpace: instead"]
657 #[method_id(@__retain_semantics Other colorUsingColorSpaceName:device:)]
658 pub unsafe fn colorUsingColorSpaceName_device(
659 &self,
660 name: Option<&NSColorSpaceName>,
661 device_description: Option<&NSDictionary<NSDeviceDescriptionKey, AnyObject>>,
662 ) -> Option<Id<NSColor>>;
663
664 #[deprecated = "Use -colorUsingType: or -colorUsingColorSpace: instead"]
665 #[method_id(@__retain_semantics Other colorUsingColorSpaceName:)]
666 pub unsafe fn colorUsingColorSpaceName(
667 &self,
668 name: &NSColorSpaceName,
669 ) -> Option<Id<NSColor>>;
670 }
671);
672
673extern_methods!(
674 #[cfg(feature = "AppKit_NSColor")]
676 unsafe impl NSColor {}
677);
678
679extern_methods!(
680 #[cfg(feature = "Foundation_NSCoder")]
682 unsafe impl NSCoder {
683 #[cfg(feature = "AppKit_NSColor")]
684 #[deprecated]
685 #[method_id(@__retain_semantics Other decodeNXColor)]
686 pub unsafe fn decodeNXColor(&self) -> Option<Id<NSColor>>;
687 }
688);
689
690extern_static!(NSSystemColorsDidChangeNotification: &'static NSNotificationName);