objc2_app_kit/generated/
NSColor.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-graphics")]
9#[cfg(target_vendor = "apple")]
10use objc2_core_graphics::*;
11#[cfg(feature = "objc2-core-image")]
12#[cfg(target_vendor = "apple")]
13use objc2_core_image::*;
14use objc2_foundation::*;
15
16use crate::*;
17
18/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumberwithpatterncolorleakfix?language=objc)
19#[cfg(feature = "NSApplication")]
20pub static NSAppKitVersionNumberWithPatternColorLeakFix: NSAppKitVersion = 641.0 as _;
21
22/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscolortype?language=objc)
23// NS_ENUM
24#[repr(transparent)]
25#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
26pub struct NSColorType(pub NSInteger);
27impl NSColorType {
28    #[doc(alias = "NSColorTypeComponentBased")]
29    pub const ComponentBased: Self = Self(0);
30    #[doc(alias = "NSColorTypePattern")]
31    pub const Pattern: Self = Self(1);
32    #[doc(alias = "NSColorTypeCatalog")]
33    pub const Catalog: Self = Self(2);
34}
35
36unsafe impl Encode for NSColorType {
37    const ENCODING: Encoding = NSInteger::ENCODING;
38}
39
40unsafe impl RefEncode for NSColorType {
41    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscolorsystemeffect?language=objc)
45// NS_ENUM
46#[repr(transparent)]
47#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
48pub struct NSColorSystemEffect(pub NSInteger);
49impl NSColorSystemEffect {
50    #[doc(alias = "NSColorSystemEffectNone")]
51    pub const None: Self = Self(0);
52    #[doc(alias = "NSColorSystemEffectPressed")]
53    pub const Pressed: Self = Self(1);
54    #[doc(alias = "NSColorSystemEffectDeepPressed")]
55    pub const DeepPressed: Self = Self(2);
56    #[doc(alias = "NSColorSystemEffectDisabled")]
57    pub const Disabled: Self = Self(3);
58    #[doc(alias = "NSColorSystemEffectRollover")]
59    pub const Rollover: Self = Self(4);
60}
61
62unsafe impl Encode for NSColorSystemEffect {
63    const ENCODING: Encoding = NSInteger::ENCODING;
64}
65
66unsafe impl RefEncode for NSColorSystemEffect {
67    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
68}
69
70extern_class!(
71    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscolor?language=objc)
72    #[unsafe(super(NSObject))]
73    #[derive(Debug, PartialEq, Eq, Hash)]
74    pub struct NSColor;
75);
76
77unsafe impl Send for NSColor {}
78
79unsafe impl Sync for NSColor {}
80
81unsafe impl NSCoding for NSColor {}
82
83unsafe impl NSCopying for NSColor {}
84
85unsafe impl CopyingHelper for NSColor {
86    type Result = Self;
87}
88
89unsafe impl NSObjectProtocol for NSColor {}
90
91#[cfg(feature = "NSPasteboard")]
92unsafe impl NSPasteboardReading for NSColor {}
93
94#[cfg(feature = "NSPasteboard")]
95unsafe impl NSPasteboardWriting for NSColor {}
96
97unsafe impl NSSecureCoding for NSColor {}
98
99impl NSColor {
100    extern_methods!(
101        #[unsafe(method(init))]
102        #[unsafe(method_family = init)]
103        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
104
105        #[unsafe(method(initWithCoder:))]
106        #[unsafe(method_family = init)]
107        pub unsafe fn initWithCoder(
108            this: Allocated<Self>,
109            coder: &NSCoder,
110        ) -> Option<Retained<Self>>;
111
112        #[cfg(all(feature = "NSColorSpace", feature = "objc2-core-foundation"))]
113        #[unsafe(method(colorWithColorSpace:components:count:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn colorWithColorSpace_components_count(
116            space: &NSColorSpace,
117            components: NonNull<CGFloat>,
118            number_of_components: NSInteger,
119        ) -> Retained<NSColor>;
120
121        #[cfg(feature = "objc2-core-foundation")]
122        #[unsafe(method(colorWithSRGBRed:green:blue:alpha:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn colorWithSRGBRed_green_blue_alpha(
125            red: CGFloat,
126            green: CGFloat,
127            blue: CGFloat,
128            alpha: CGFloat,
129        ) -> Retained<NSColor>;
130
131        #[cfg(feature = "objc2-core-foundation")]
132        #[unsafe(method(colorWithGenericGamma22White:alpha:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn colorWithGenericGamma22White_alpha(
135            white: CGFloat,
136            alpha: CGFloat,
137        ) -> Retained<NSColor>;
138
139        #[cfg(feature = "objc2-core-foundation")]
140        #[unsafe(method(colorWithDisplayP3Red:green:blue:alpha:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn colorWithDisplayP3Red_green_blue_alpha(
143            red: CGFloat,
144            green: CGFloat,
145            blue: CGFloat,
146            alpha: CGFloat,
147        ) -> Retained<NSColor>;
148
149        #[cfg(feature = "objc2-core-foundation")]
150        #[unsafe(method(colorWithWhite:alpha:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn colorWithWhite_alpha(white: CGFloat, alpha: CGFloat) -> Retained<NSColor>;
153
154        #[cfg(feature = "objc2-core-foundation")]
155        #[unsafe(method(colorWithRed:green:blue:alpha:))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn colorWithRed_green_blue_alpha(
158            red: CGFloat,
159            green: CGFloat,
160            blue: CGFloat,
161            alpha: CGFloat,
162        ) -> Retained<NSColor>;
163
164        #[cfg(feature = "objc2-core-foundation")]
165        #[unsafe(method(colorWithHue:saturation:brightness:alpha:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn colorWithHue_saturation_brightness_alpha(
168            hue: CGFloat,
169            saturation: CGFloat,
170            brightness: CGFloat,
171            alpha: CGFloat,
172        ) -> Retained<NSColor>;
173
174        #[cfg(all(feature = "NSColorSpace", feature = "objc2-core-foundation"))]
175        #[unsafe(method(colorWithColorSpace:hue:saturation:brightness:alpha:))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn colorWithColorSpace_hue_saturation_brightness_alpha(
178            space: &NSColorSpace,
179            hue: CGFloat,
180            saturation: CGFloat,
181            brightness: CGFloat,
182            alpha: CGFloat,
183        ) -> Retained<NSColor>;
184
185        #[cfg(feature = "NSColorList")]
186        #[unsafe(method(colorWithCatalogName:colorName:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn colorWithCatalogName_colorName(
189            list_name: &NSColorListName,
190            color_name: &NSColorName,
191        ) -> Option<Retained<NSColor>>;
192
193        #[cfg(feature = "NSColorList")]
194        #[unsafe(method(colorNamed:bundle:))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn colorNamed_bundle(
197            name: &NSColorName,
198            bundle: Option<&NSBundle>,
199        ) -> Option<Retained<NSColor>>;
200
201        #[cfg(feature = "NSColorList")]
202        #[unsafe(method(colorNamed:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn colorNamed(name: &NSColorName) -> Option<Retained<NSColor>>;
205
206        #[cfg(all(feature = "NSAppearance", feature = "NSColorList", feature = "block2"))]
207        #[unsafe(method(colorWithName:dynamicProvider:))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn colorWithName_dynamicProvider(
210            color_name: Option<&NSColorName>,
211            dynamic_provider: &block2::Block<dyn Fn(NonNull<NSAppearance>) -> NonNull<NSColor>>,
212        ) -> Retained<NSColor>;
213
214        #[cfg(feature = "objc2-core-foundation")]
215        #[unsafe(method(colorWithDeviceWhite:alpha:))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn colorWithDeviceWhite_alpha(
218            white: CGFloat,
219            alpha: CGFloat,
220        ) -> Retained<NSColor>;
221
222        #[cfg(feature = "objc2-core-foundation")]
223        #[unsafe(method(colorWithDeviceRed:green:blue:alpha:))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn colorWithDeviceRed_green_blue_alpha(
226            red: CGFloat,
227            green: CGFloat,
228            blue: CGFloat,
229            alpha: CGFloat,
230        ) -> Retained<NSColor>;
231
232        #[cfg(feature = "objc2-core-foundation")]
233        #[unsafe(method(colorWithDeviceHue:saturation:brightness:alpha:))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn colorWithDeviceHue_saturation_brightness_alpha(
236            hue: CGFloat,
237            saturation: CGFloat,
238            brightness: CGFloat,
239            alpha: CGFloat,
240        ) -> Retained<NSColor>;
241
242        #[cfg(feature = "objc2-core-foundation")]
243        #[unsafe(method(colorWithDeviceCyan:magenta:yellow:black:alpha:))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn colorWithDeviceCyan_magenta_yellow_black_alpha(
246            cyan: CGFloat,
247            magenta: CGFloat,
248            yellow: CGFloat,
249            black: CGFloat,
250            alpha: CGFloat,
251        ) -> Retained<NSColor>;
252
253        #[cfg(feature = "objc2-core-foundation")]
254        #[unsafe(method(colorWithCalibratedWhite:alpha:))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn colorWithCalibratedWhite_alpha(
257            white: CGFloat,
258            alpha: CGFloat,
259        ) -> Retained<NSColor>;
260
261        #[cfg(feature = "objc2-core-foundation")]
262        #[unsafe(method(colorWithCalibratedRed:green:blue:alpha:))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn colorWithCalibratedRed_green_blue_alpha(
265            red: CGFloat,
266            green: CGFloat,
267            blue: CGFloat,
268            alpha: CGFloat,
269        ) -> Retained<NSColor>;
270
271        #[cfg(feature = "objc2-core-foundation")]
272        #[unsafe(method(colorWithCalibratedHue:saturation:brightness:alpha:))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn colorWithCalibratedHue_saturation_brightness_alpha(
275            hue: CGFloat,
276            saturation: CGFloat,
277            brightness: CGFloat,
278            alpha: CGFloat,
279        ) -> Retained<NSColor>;
280
281        #[cfg(feature = "NSImage")]
282        #[unsafe(method(colorWithPatternImage:))]
283        #[unsafe(method_family = none)]
284        pub unsafe fn colorWithPatternImage(image: &NSImage) -> Retained<NSColor>;
285
286        #[unsafe(method(type))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn r#type(&self) -> NSColorType;
289
290        #[unsafe(method(colorUsingType:))]
291        #[unsafe(method_family = none)]
292        pub unsafe fn colorUsingType(&self, r#type: NSColorType) -> Option<Retained<NSColor>>;
293
294        #[cfg(feature = "NSColorSpace")]
295        #[unsafe(method(colorUsingColorSpace:))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn colorUsingColorSpace(
298            &self,
299            space: &NSColorSpace,
300        ) -> Option<Retained<NSColor>>;
301
302        #[unsafe(method(blackColor))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn blackColor() -> Retained<NSColor>;
305
306        #[unsafe(method(darkGrayColor))]
307        #[unsafe(method_family = none)]
308        pub unsafe fn darkGrayColor() -> Retained<NSColor>;
309
310        #[unsafe(method(lightGrayColor))]
311        #[unsafe(method_family = none)]
312        pub unsafe fn lightGrayColor() -> Retained<NSColor>;
313
314        #[unsafe(method(whiteColor))]
315        #[unsafe(method_family = none)]
316        pub unsafe fn whiteColor() -> Retained<NSColor>;
317
318        #[unsafe(method(grayColor))]
319        #[unsafe(method_family = none)]
320        pub unsafe fn grayColor() -> Retained<NSColor>;
321
322        #[unsafe(method(redColor))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn redColor() -> Retained<NSColor>;
325
326        #[unsafe(method(greenColor))]
327        #[unsafe(method_family = none)]
328        pub unsafe fn greenColor() -> Retained<NSColor>;
329
330        #[unsafe(method(blueColor))]
331        #[unsafe(method_family = none)]
332        pub unsafe fn blueColor() -> Retained<NSColor>;
333
334        #[unsafe(method(cyanColor))]
335        #[unsafe(method_family = none)]
336        pub unsafe fn cyanColor() -> Retained<NSColor>;
337
338        #[unsafe(method(yellowColor))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn yellowColor() -> Retained<NSColor>;
341
342        #[unsafe(method(magentaColor))]
343        #[unsafe(method_family = none)]
344        pub unsafe fn magentaColor() -> Retained<NSColor>;
345
346        #[unsafe(method(orangeColor))]
347        #[unsafe(method_family = none)]
348        pub unsafe fn orangeColor() -> Retained<NSColor>;
349
350        #[unsafe(method(purpleColor))]
351        #[unsafe(method_family = none)]
352        pub unsafe fn purpleColor() -> Retained<NSColor>;
353
354        #[unsafe(method(brownColor))]
355        #[unsafe(method_family = none)]
356        pub unsafe fn brownColor() -> Retained<NSColor>;
357
358        #[unsafe(method(clearColor))]
359        #[unsafe(method_family = none)]
360        pub unsafe fn clearColor() -> Retained<NSColor>;
361
362        #[unsafe(method(labelColor))]
363        #[unsafe(method_family = none)]
364        pub unsafe fn labelColor() -> Retained<NSColor>;
365
366        #[unsafe(method(secondaryLabelColor))]
367        #[unsafe(method_family = none)]
368        pub unsafe fn secondaryLabelColor() -> Retained<NSColor>;
369
370        #[unsafe(method(tertiaryLabelColor))]
371        #[unsafe(method_family = none)]
372        pub unsafe fn tertiaryLabelColor() -> Retained<NSColor>;
373
374        #[unsafe(method(quaternaryLabelColor))]
375        #[unsafe(method_family = none)]
376        pub unsafe fn quaternaryLabelColor() -> Retained<NSColor>;
377
378        #[unsafe(method(quinaryLabelColor))]
379        #[unsafe(method_family = none)]
380        pub unsafe fn quinaryLabelColor() -> Retained<NSColor>;
381
382        /// Used for large scale images or subtle decorative elements; not for general foreground content.
383        #[unsafe(method(linkColor))]
384        #[unsafe(method_family = none)]
385        pub unsafe fn linkColor() -> Retained<NSColor>;
386
387        #[unsafe(method(placeholderTextColor))]
388        #[unsafe(method_family = none)]
389        pub unsafe fn placeholderTextColor() -> Retained<NSColor>;
390
391        #[unsafe(method(windowFrameTextColor))]
392        #[unsafe(method_family = none)]
393        pub unsafe fn windowFrameTextColor() -> Retained<NSColor>;
394
395        #[unsafe(method(selectedMenuItemTextColor))]
396        #[unsafe(method_family = none)]
397        pub unsafe fn selectedMenuItemTextColor() -> Retained<NSColor>;
398
399        #[unsafe(method(alternateSelectedControlTextColor))]
400        #[unsafe(method_family = none)]
401        pub unsafe fn alternateSelectedControlTextColor() -> Retained<NSColor>;
402
403        #[unsafe(method(headerTextColor))]
404        #[unsafe(method_family = none)]
405        pub unsafe fn headerTextColor() -> Retained<NSColor>;
406
407        #[unsafe(method(separatorColor))]
408        #[unsafe(method_family = none)]
409        pub unsafe fn separatorColor() -> Retained<NSColor>;
410
411        #[unsafe(method(gridColor))]
412        #[unsafe(method_family = none)]
413        pub unsafe fn gridColor() -> Retained<NSColor>;
414
415        #[unsafe(method(windowBackgroundColor))]
416        #[unsafe(method_family = none)]
417        pub unsafe fn windowBackgroundColor() -> Retained<NSColor>;
418
419        #[unsafe(method(underPageBackgroundColor))]
420        #[unsafe(method_family = none)]
421        pub unsafe fn underPageBackgroundColor() -> Retained<NSColor>;
422
423        #[unsafe(method(controlBackgroundColor))]
424        #[unsafe(method_family = none)]
425        pub unsafe fn controlBackgroundColor() -> Retained<NSColor>;
426
427        #[unsafe(method(selectedContentBackgroundColor))]
428        #[unsafe(method_family = none)]
429        pub unsafe fn selectedContentBackgroundColor() -> Retained<NSColor>;
430
431        #[unsafe(method(unemphasizedSelectedContentBackgroundColor))]
432        #[unsafe(method_family = none)]
433        pub unsafe fn unemphasizedSelectedContentBackgroundColor() -> Retained<NSColor>;
434
435        #[unsafe(method(alternatingContentBackgroundColors))]
436        #[unsafe(method_family = none)]
437        pub unsafe fn alternatingContentBackgroundColors() -> Retained<NSArray<NSColor>>;
438
439        #[unsafe(method(findHighlightColor))]
440        #[unsafe(method_family = none)]
441        pub unsafe fn findHighlightColor() -> Retained<NSColor>;
442
443        #[unsafe(method(textColor))]
444        #[unsafe(method_family = none)]
445        pub unsafe fn textColor() -> Retained<NSColor>;
446
447        #[unsafe(method(textBackgroundColor))]
448        #[unsafe(method_family = none)]
449        pub unsafe fn textBackgroundColor() -> Retained<NSColor>;
450
451        #[unsafe(method(textInsertionPointColor))]
452        #[unsafe(method_family = none)]
453        pub unsafe fn textInsertionPointColor() -> Retained<NSColor>;
454
455        #[unsafe(method(selectedTextColor))]
456        #[unsafe(method_family = none)]
457        pub unsafe fn selectedTextColor() -> Retained<NSColor>;
458
459        #[unsafe(method(selectedTextBackgroundColor))]
460        #[unsafe(method_family = none)]
461        pub unsafe fn selectedTextBackgroundColor() -> Retained<NSColor>;
462
463        #[unsafe(method(unemphasizedSelectedTextBackgroundColor))]
464        #[unsafe(method_family = none)]
465        pub unsafe fn unemphasizedSelectedTextBackgroundColor() -> Retained<NSColor>;
466
467        #[unsafe(method(unemphasizedSelectedTextColor))]
468        #[unsafe(method_family = none)]
469        pub unsafe fn unemphasizedSelectedTextColor() -> Retained<NSColor>;
470
471        #[unsafe(method(controlColor))]
472        #[unsafe(method_family = none)]
473        pub unsafe fn controlColor() -> Retained<NSColor>;
474
475        #[unsafe(method(controlTextColor))]
476        #[unsafe(method_family = none)]
477        pub unsafe fn controlTextColor() -> Retained<NSColor>;
478
479        #[unsafe(method(selectedControlColor))]
480        #[unsafe(method_family = none)]
481        pub unsafe fn selectedControlColor() -> Retained<NSColor>;
482
483        #[unsafe(method(selectedControlTextColor))]
484        #[unsafe(method_family = none)]
485        pub unsafe fn selectedControlTextColor() -> Retained<NSColor>;
486
487        #[unsafe(method(disabledControlTextColor))]
488        #[unsafe(method_family = none)]
489        pub unsafe fn disabledControlTextColor() -> Retained<NSColor>;
490
491        #[unsafe(method(keyboardFocusIndicatorColor))]
492        #[unsafe(method_family = none)]
493        pub unsafe fn keyboardFocusIndicatorColor() -> Retained<NSColor>;
494
495        #[unsafe(method(scrubberTexturedBackgroundColor))]
496        #[unsafe(method_family = none)]
497        pub unsafe fn scrubberTexturedBackgroundColor() -> Retained<NSColor>;
498
499        #[unsafe(method(systemRedColor))]
500        #[unsafe(method_family = none)]
501        pub unsafe fn systemRedColor() -> Retained<NSColor>;
502
503        #[unsafe(method(systemGreenColor))]
504        #[unsafe(method_family = none)]
505        pub unsafe fn systemGreenColor() -> Retained<NSColor>;
506
507        #[unsafe(method(systemBlueColor))]
508        #[unsafe(method_family = none)]
509        pub unsafe fn systemBlueColor() -> Retained<NSColor>;
510
511        #[unsafe(method(systemOrangeColor))]
512        #[unsafe(method_family = none)]
513        pub unsafe fn systemOrangeColor() -> Retained<NSColor>;
514
515        #[unsafe(method(systemYellowColor))]
516        #[unsafe(method_family = none)]
517        pub unsafe fn systemYellowColor() -> Retained<NSColor>;
518
519        #[unsafe(method(systemBrownColor))]
520        #[unsafe(method_family = none)]
521        pub unsafe fn systemBrownColor() -> Retained<NSColor>;
522
523        #[unsafe(method(systemPinkColor))]
524        #[unsafe(method_family = none)]
525        pub unsafe fn systemPinkColor() -> Retained<NSColor>;
526
527        #[unsafe(method(systemPurpleColor))]
528        #[unsafe(method_family = none)]
529        pub unsafe fn systemPurpleColor() -> Retained<NSColor>;
530
531        #[unsafe(method(systemGrayColor))]
532        #[unsafe(method_family = none)]
533        pub unsafe fn systemGrayColor() -> Retained<NSColor>;
534
535        #[unsafe(method(systemTealColor))]
536        #[unsafe(method_family = none)]
537        pub unsafe fn systemTealColor() -> Retained<NSColor>;
538
539        #[unsafe(method(systemIndigoColor))]
540        #[unsafe(method_family = none)]
541        pub unsafe fn systemIndigoColor() -> Retained<NSColor>;
542
543        #[unsafe(method(systemMintColor))]
544        #[unsafe(method_family = none)]
545        pub unsafe fn systemMintColor() -> Retained<NSColor>;
546
547        #[unsafe(method(systemCyanColor))]
548        #[unsafe(method_family = none)]
549        pub unsafe fn systemCyanColor() -> Retained<NSColor>;
550
551        /// Fill colors for UI elements.
552        /// These are meant to be used over the background colors, since their alpha component is less than 1.
553        ///
554        /// systemFillColor is appropriate for filling thin shapes, such as the track of a slider.
555        #[unsafe(method(systemFillColor))]
556        #[unsafe(method_family = none)]
557        pub unsafe fn systemFillColor() -> Retained<NSColor>;
558
559        /// secondarySystemFillColor is appropriate for filling small-size shapes, such as the backing of a progress indicator.
560        #[unsafe(method(secondarySystemFillColor))]
561        #[unsafe(method_family = none)]
562        pub unsafe fn secondarySystemFillColor() -> Retained<NSColor>;
563
564        /// tertiarySystemFillColor is appropriate for filling medium-size shapes,  such as the backing of a switch.
565        #[unsafe(method(tertiarySystemFillColor))]
566        #[unsafe(method_family = none)]
567        pub unsafe fn tertiarySystemFillColor() -> Retained<NSColor>;
568
569        /// quaternarySystemFillColor is appropriate for filling large areas, such as a group box or tab pane.
570        #[unsafe(method(quaternarySystemFillColor))]
571        #[unsafe(method_family = none)]
572        pub unsafe fn quaternarySystemFillColor() -> Retained<NSColor>;
573
574        /// quinarySystemFillColor is appropriate for filling large areas that require subtle emphasis, such as content of a form..
575        #[unsafe(method(quinarySystemFillColor))]
576        #[unsafe(method_family = none)]
577        pub unsafe fn quinarySystemFillColor() -> Retained<NSColor>;
578
579        /// A dynamic color that reflects the user's current preferred accent color. This color automatically updates when the accent color preference changes. Do not make assumptions about the color space of this color, which may change across releases.
580        #[unsafe(method(controlAccentColor))]
581        #[unsafe(method_family = none)]
582        pub unsafe fn controlAccentColor() -> Retained<NSColor>;
583
584        #[cfg(feature = "NSCell")]
585        #[unsafe(method(currentControlTint))]
586        #[unsafe(method_family = none)]
587        pub unsafe fn currentControlTint() -> NSControlTint;
588
589        #[cfg(feature = "NSCell")]
590        #[deprecated = "NSControlTint does not describe the full range of available control accent colors. Use +[NSColor controlAccentColor] instead."]
591        #[unsafe(method(colorForControlTint:))]
592        #[unsafe(method_family = none)]
593        pub unsafe fn colorForControlTint(control_tint: NSControlTint) -> Retained<NSColor>;
594
595        #[unsafe(method(highlightColor))]
596        #[unsafe(method_family = none)]
597        pub unsafe fn highlightColor() -> Retained<NSColor>;
598
599        #[unsafe(method(shadowColor))]
600        #[unsafe(method_family = none)]
601        pub unsafe fn shadowColor() -> Retained<NSColor>;
602
603        #[cfg(feature = "objc2-core-foundation")]
604        #[unsafe(method(highlightWithLevel:))]
605        #[unsafe(method_family = none)]
606        pub unsafe fn highlightWithLevel(&self, val: CGFloat) -> Option<Retained<NSColor>>;
607
608        #[cfg(feature = "objc2-core-foundation")]
609        #[unsafe(method(shadowWithLevel:))]
610        #[unsafe(method_family = none)]
611        pub unsafe fn shadowWithLevel(&self, val: CGFloat) -> Option<Retained<NSColor>>;
612
613        /// Returns a color representing the base color with a system defined effect applied to it. This color is safe to create before draw time, as the resolution of the final color only happens when being `-set`, retrieving its `CGColor`, resolving with `-colorWithType:`, etc. The return color type is `.named`.
614        #[unsafe(method(colorWithSystemEffect:))]
615        #[unsafe(method_family = none)]
616        pub unsafe fn colorWithSystemEffect(
617            &self,
618            system_effect: NSColorSystemEffect,
619        ) -> Retained<NSColor>;
620
621        #[unsafe(method(set))]
622        #[unsafe(method_family = none)]
623        pub unsafe fn set(&self);
624
625        #[unsafe(method(setFill))]
626        #[unsafe(method_family = none)]
627        pub unsafe fn setFill(&self);
628
629        #[unsafe(method(setStroke))]
630        #[unsafe(method_family = none)]
631        pub unsafe fn setStroke(&self);
632
633        #[cfg(feature = "objc2-core-foundation")]
634        #[unsafe(method(blendedColorWithFraction:ofColor:))]
635        #[unsafe(method_family = none)]
636        pub unsafe fn blendedColorWithFraction_ofColor(
637            &self,
638            fraction: CGFloat,
639            color: &NSColor,
640        ) -> Option<Retained<NSColor>>;
641
642        #[cfg(feature = "objc2-core-foundation")]
643        #[unsafe(method(colorWithAlphaComponent:))]
644        #[unsafe(method_family = none)]
645        pub unsafe fn colorWithAlphaComponent(&self, alpha: CGFloat) -> Retained<NSColor>;
646
647        #[cfg(feature = "NSColorList")]
648        /// * Methods to get various components of colors. Not all of the methods apply to all colors; if called, they raise. **
649        #[unsafe(method(catalogNameComponent))]
650        #[unsafe(method_family = none)]
651        pub unsafe fn catalogNameComponent(&self) -> Retained<NSColorListName>;
652
653        #[cfg(feature = "NSColorList")]
654        #[unsafe(method(colorNameComponent))]
655        #[unsafe(method_family = none)]
656        pub unsafe fn colorNameComponent(&self) -> Retained<NSColorName>;
657
658        #[unsafe(method(localizedCatalogNameComponent))]
659        #[unsafe(method_family = none)]
660        pub unsafe fn localizedCatalogNameComponent(&self) -> Retained<NSString>;
661
662        #[unsafe(method(localizedColorNameComponent))]
663        #[unsafe(method_family = none)]
664        pub unsafe fn localizedColorNameComponent(&self) -> Retained<NSString>;
665
666        #[cfg(feature = "objc2-core-foundation")]
667        #[unsafe(method(redComponent))]
668        #[unsafe(method_family = none)]
669        pub unsafe fn redComponent(&self) -> CGFloat;
670
671        #[cfg(feature = "objc2-core-foundation")]
672        #[unsafe(method(greenComponent))]
673        #[unsafe(method_family = none)]
674        pub unsafe fn greenComponent(&self) -> CGFloat;
675
676        #[cfg(feature = "objc2-core-foundation")]
677        #[unsafe(method(blueComponent))]
678        #[unsafe(method_family = none)]
679        pub unsafe fn blueComponent(&self) -> CGFloat;
680
681        #[cfg(feature = "objc2-core-foundation")]
682        #[unsafe(method(getRed:green:blue:alpha:))]
683        #[unsafe(method_family = none)]
684        pub unsafe fn getRed_green_blue_alpha(
685            &self,
686            red: *mut CGFloat,
687            green: *mut CGFloat,
688            blue: *mut CGFloat,
689            alpha: *mut CGFloat,
690        );
691
692        #[cfg(feature = "objc2-core-foundation")]
693        #[unsafe(method(hueComponent))]
694        #[unsafe(method_family = none)]
695        pub unsafe fn hueComponent(&self) -> CGFloat;
696
697        #[cfg(feature = "objc2-core-foundation")]
698        #[unsafe(method(saturationComponent))]
699        #[unsafe(method_family = none)]
700        pub unsafe fn saturationComponent(&self) -> CGFloat;
701
702        #[cfg(feature = "objc2-core-foundation")]
703        #[unsafe(method(brightnessComponent))]
704        #[unsafe(method_family = none)]
705        pub unsafe fn brightnessComponent(&self) -> CGFloat;
706
707        #[cfg(feature = "objc2-core-foundation")]
708        #[unsafe(method(getHue:saturation:brightness:alpha:))]
709        #[unsafe(method_family = none)]
710        pub unsafe fn getHue_saturation_brightness_alpha(
711            &self,
712            hue: *mut CGFloat,
713            saturation: *mut CGFloat,
714            brightness: *mut CGFloat,
715            alpha: *mut CGFloat,
716        );
717
718        #[cfg(feature = "objc2-core-foundation")]
719        #[unsafe(method(whiteComponent))]
720        #[unsafe(method_family = none)]
721        pub unsafe fn whiteComponent(&self) -> CGFloat;
722
723        #[cfg(feature = "objc2-core-foundation")]
724        #[unsafe(method(getWhite:alpha:))]
725        #[unsafe(method_family = none)]
726        pub unsafe fn getWhite_alpha(&self, white: *mut CGFloat, alpha: *mut CGFloat);
727
728        #[cfg(feature = "objc2-core-foundation")]
729        #[unsafe(method(cyanComponent))]
730        #[unsafe(method_family = none)]
731        pub unsafe fn cyanComponent(&self) -> CGFloat;
732
733        #[cfg(feature = "objc2-core-foundation")]
734        #[unsafe(method(magentaComponent))]
735        #[unsafe(method_family = none)]
736        pub unsafe fn magentaComponent(&self) -> CGFloat;
737
738        #[cfg(feature = "objc2-core-foundation")]
739        #[unsafe(method(yellowComponent))]
740        #[unsafe(method_family = none)]
741        pub unsafe fn yellowComponent(&self) -> CGFloat;
742
743        #[cfg(feature = "objc2-core-foundation")]
744        #[unsafe(method(blackComponent))]
745        #[unsafe(method_family = none)]
746        pub unsafe fn blackComponent(&self) -> CGFloat;
747
748        #[cfg(feature = "objc2-core-foundation")]
749        #[unsafe(method(getCyan:magenta:yellow:black:alpha:))]
750        #[unsafe(method_family = none)]
751        pub unsafe fn getCyan_magenta_yellow_black_alpha(
752            &self,
753            cyan: *mut CGFloat,
754            magenta: *mut CGFloat,
755            yellow: *mut CGFloat,
756            black: *mut CGFloat,
757            alpha: *mut CGFloat,
758        );
759
760        #[cfg(feature = "NSColorSpace")]
761        #[unsafe(method(colorSpace))]
762        #[unsafe(method_family = none)]
763        pub unsafe fn colorSpace(&self) -> Retained<NSColorSpace>;
764
765        #[unsafe(method(numberOfComponents))]
766        #[unsafe(method_family = none)]
767        pub unsafe fn numberOfComponents(&self) -> NSInteger;
768
769        #[cfg(feature = "objc2-core-foundation")]
770        #[unsafe(method(getComponents:))]
771        #[unsafe(method_family = none)]
772        pub unsafe fn getComponents(&self, components: NonNull<CGFloat>);
773
774        #[cfg(feature = "NSImage")]
775        #[unsafe(method(patternImage))]
776        #[unsafe(method_family = none)]
777        pub unsafe fn patternImage(&self) -> Retained<NSImage>;
778
779        #[cfg(feature = "objc2-core-foundation")]
780        #[unsafe(method(alphaComponent))]
781        #[unsafe(method_family = none)]
782        pub unsafe fn alphaComponent(&self) -> CGFloat;
783
784        #[cfg(feature = "NSPasteboard")]
785        #[unsafe(method(colorFromPasteboard:))]
786        #[unsafe(method_family = none)]
787        pub unsafe fn colorFromPasteboard(paste_board: &NSPasteboard) -> Option<Retained<NSColor>>;
788
789        #[cfg(feature = "NSPasteboard")]
790        #[unsafe(method(writeToPasteboard:))]
791        #[unsafe(method_family = none)]
792        pub unsafe fn writeToPasteboard(&self, paste_board: &NSPasteboard);
793
794        #[unsafe(method(drawSwatchInRect:))]
795        #[unsafe(method_family = none)]
796        pub unsafe fn drawSwatchInRect(&self, rect: NSRect);
797
798        #[cfg(feature = "objc2-core-graphics")]
799        #[cfg(target_vendor = "apple")]
800        #[unsafe(method(colorWithCGColor:))]
801        #[unsafe(method_family = none)]
802        pub unsafe fn colorWithCGColor(cg_color: &CGColor) -> Option<Retained<NSColor>>;
803
804        #[cfg(feature = "objc2-core-graphics")]
805        #[cfg(target_vendor = "apple")]
806        #[unsafe(method(CGColor))]
807        #[unsafe(method_family = none)]
808        pub unsafe fn CGColor(&self) -> Retained<CGColor>;
809
810        #[deprecated = "Use `showsAlpha` in `NSColorPanel` and `supportsAlpha` in `NSColorWell` to control alpha behavior for individual controls."]
811        #[unsafe(method(ignoresAlpha))]
812        #[unsafe(method_family = none)]
813        pub unsafe fn ignoresAlpha(mtm: MainThreadMarker) -> bool;
814
815        /// Setter for [`ignoresAlpha`][Self::ignoresAlpha].
816        #[deprecated = "Use `showsAlpha` in `NSColorPanel` and `supportsAlpha` in `NSColorWell` to control alpha behavior for individual controls."]
817        #[unsafe(method(setIgnoresAlpha:))]
818        #[unsafe(method_family = none)]
819        pub unsafe fn setIgnoresAlpha(ignores_alpha: bool, mtm: MainThreadMarker);
820    );
821}
822
823/// Methods declared on superclass `NSObject`.
824impl NSColor {
825    extern_methods!(
826        #[unsafe(method(new))]
827        #[unsafe(method_family = new)]
828        pub unsafe fn new() -> Retained<Self>;
829    );
830}
831
832/// NSDeprecated.
833impl NSColor {
834    extern_methods!(
835        /// Historically used as the inner border highlight color for beveled buttons. No longer used.
836        #[deprecated = "Use a color that matches the semantics being used, such as `separatorColor`"]
837        #[unsafe(method(controlHighlightColor))]
838        #[unsafe(method_family = none)]
839        pub unsafe fn controlHighlightColor() -> Retained<NSColor>;
840
841        /// Historically used as the outer border highlight color for beveled buttons. No longer used.
842        #[deprecated = "Use a color that matches the semantics being used, such as `separatorColor`"]
843        #[unsafe(method(controlLightHighlightColor))]
844        #[unsafe(method_family = none)]
845        pub unsafe fn controlLightHighlightColor() -> Retained<NSColor>;
846
847        /// Historically used as the inner border shadow color for beveled buttons. No longer used.
848        #[deprecated = "Use a color that matches the semantics being used, such as `separatorColor`"]
849        #[unsafe(method(controlShadowColor))]
850        #[unsafe(method_family = none)]
851        pub unsafe fn controlShadowColor() -> Retained<NSColor>;
852
853        /// Historically used as the outer border shadow color for beveled buttons. No longer used.
854        #[deprecated = "Use a color that matches the semantics being used, such as `separatorColor`"]
855        #[unsafe(method(controlDarkShadowColor))]
856        #[unsafe(method_family = none)]
857        pub unsafe fn controlDarkShadowColor() -> Retained<NSColor>;
858
859        /// Historically used as the color of scroll bars. No longer used.
860        #[deprecated = "Use NSScroller instead"]
861        #[unsafe(method(scrollBarColor))]
862        #[unsafe(method_family = none)]
863        pub unsafe fn scrollBarColor() -> Retained<NSColor>;
864
865        /// Historically used as the color of scroll bar knobs. No longer used.
866        #[deprecated = "Use NSScroller instead"]
867        #[unsafe(method(knobColor))]
868        #[unsafe(method_family = none)]
869        pub unsafe fn knobColor() -> Retained<NSColor>;
870
871        /// Historically used as the color of scroll bar knobs being dragged. No longer used.
872        #[deprecated = "Use NSScroller instead"]
873        #[unsafe(method(selectedKnobColor))]
874        #[unsafe(method_family = none)]
875        pub unsafe fn selectedKnobColor() -> Retained<NSColor>;
876
877        /// Historically used as the color of the window chrome, which is no longer able to be represented by a color. No longer used.
878        #[deprecated = "Use NSVisualEffectMaterialTitlebar"]
879        #[unsafe(method(windowFrameColor))]
880        #[unsafe(method_family = none)]
881        pub unsafe fn windowFrameColor() -> Retained<NSColor>;
882
883        /// Historically used as the color of selected menu items, which is no longer a color but a tinted blur effect. No longer used.
884        #[deprecated = "Use NSVisualEffectMaterialSelection"]
885        #[unsafe(method(selectedMenuItemColor))]
886        #[unsafe(method_family = none)]
887        pub unsafe fn selectedMenuItemColor() -> Retained<NSColor>;
888
889        /// Historically used as the color of table headers, which is no longer a color but a tinted blur effect.
890        #[deprecated = "Use NSVisualEffectMaterialHeaderView"]
891        #[unsafe(method(headerColor))]
892        #[unsafe(method_family = none)]
893        pub unsafe fn headerColor() -> Retained<NSColor>;
894
895        /// The background color of selected content or text that is unemphasized. Older alias for +unemphasizedSelectedContentBackgroundColor and +unemphasizedSelectedTextBackgroundColor
896        #[deprecated]
897        #[unsafe(method(secondarySelectedControlColor))]
898        #[unsafe(method_family = none)]
899        pub unsafe fn secondarySelectedControlColor() -> Retained<NSColor>;
900
901        /// The background color of selected and emphasized (focused) content: table views rows, collection views, etc. Older alias for +selectedContentBackgroundColor
902        #[deprecated]
903        #[unsafe(method(alternateSelectedControlColor))]
904        #[unsafe(method_family = none)]
905        pub unsafe fn alternateSelectedControlColor() -> Retained<NSColor>;
906
907        /// The background colors for alternating content items: such as table view rows, collection view items. Older alias for +alternatingContentBackgroundColors
908        #[deprecated]
909        #[unsafe(method(controlAlternatingRowBackgroundColors))]
910        #[unsafe(method_family = none)]
911        pub unsafe fn controlAlternatingRowBackgroundColors() -> Retained<NSArray<NSColor>>;
912
913        #[cfg(feature = "NSGraphics")]
914        #[deprecated = "Use -type and NSColorType instead"]
915        #[unsafe(method(colorSpaceName))]
916        #[unsafe(method_family = none)]
917        pub unsafe fn colorSpaceName(&self) -> Retained<NSColorSpaceName>;
918
919        #[cfg(feature = "NSGraphics")]
920        #[deprecated = "Use -colorUsingType: or -colorUsingColorSpace: instead"]
921        #[unsafe(method(colorUsingColorSpaceName:device:))]
922        #[unsafe(method_family = none)]
923        pub unsafe fn colorUsingColorSpaceName_device(
924            &self,
925            name: Option<&NSColorSpaceName>,
926            device_description: Option<&NSDictionary<NSDeviceDescriptionKey, AnyObject>>,
927        ) -> Option<Retained<NSColor>>;
928
929        #[cfg(feature = "NSGraphics")]
930        #[deprecated = "Use -colorUsingType: or -colorUsingColorSpace: instead"]
931        #[unsafe(method(colorUsingColorSpaceName:))]
932        #[unsafe(method_family = none)]
933        pub unsafe fn colorUsingColorSpaceName(
934            &self,
935            name: &NSColorSpaceName,
936        ) -> Option<Retained<NSColor>>;
937    );
938}
939
940/// NSQuartzCoreAdditions.
941impl NSColor {
942    extern_methods!(
943        #[cfg(feature = "objc2-core-image")]
944        #[cfg(target_vendor = "apple")]
945        #[unsafe(method(colorWithCIColor:))]
946        #[unsafe(method_family = none)]
947        pub unsafe fn colorWithCIColor(color: &CIColor) -> Retained<NSColor>;
948    );
949}
950
951mod private_CIColorNSAppKitAdditions {
952    pub trait Sealed {}
953}
954
955/// Category "NSAppKitAdditions" on [`CIColor`].
956#[doc(alias = "NSAppKitAdditions")]
957pub unsafe trait CIColorNSAppKitAdditions:
958    ClassType + Sized + private_CIColorNSAppKitAdditions::Sealed
959{
960    extern_methods!(
961        #[unsafe(method(initWithColor:))]
962        #[unsafe(method_family = init)]
963        unsafe fn initWithColor(this: Allocated<Self>, color: &NSColor) -> Option<Retained<Self>>;
964    );
965}
966
967#[cfg(feature = "objc2-core-image")]
968#[cfg(target_vendor = "apple")]
969impl private_CIColorNSAppKitAdditions::Sealed for CIColor {}
970#[cfg(feature = "objc2-core-image")]
971#[cfg(target_vendor = "apple")]
972unsafe impl CIColorNSAppKitAdditions for CIColor {}
973
974extern "C" {
975    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssystemcolorsdidchangenotification?language=objc)
976    pub static NSSystemColorsDidChangeNotification: &'static NSNotificationName;
977}