Cocoa Internals/Theme: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Cocoa Internals/Theme
| Old | New | Line | |
|---|---|---|---|
| 1 | + | There are several types of "Themes" in macOS. | |
| 2 | + | ||
| 3 | + | ## System Wide Themes | |
| 4 | + | ||
| 5 | + | ### Tint | |
| 6 | + | ||
| 7 | + | The tint is a small change of highlighting colors. Historically it has been only 2 colors available: | |
| 8 | + | ||
| 9 | + | - Blue | |
| 10 | + | - Graphite | |
| 11 | + | ||
| 12 | + | As of today the functionality is still available in macOS, yet deprecated, as it has been suppressed by "Accent Color" | |
| 13 | + | ||
| 14 | + | ### Accent aka Highlight Color | |
| 15 | + | ||
| 16 | + | Introduced in macOS 10.13 - the system-wide highlight color change | |
| 17 | + | ||
| 18 | + | ### Aqua Theme vs Dark Mode | |
| 19 | + | ||
| 20 | + | The initial functionality is available in 10.13. The system preferences are allowing to change the main bar to the dark mode. However APIs are available to change window and/or view | |
| 21 | + | ||
| 22 | + | The full potential has been released in 10.14 Mojave. | |
| 23 | + | ||
| 24 | + | ## Themed Controls Drawing API | |
| 25 | + | ||
| 26 | + | The Cocoa doesn't have an explicit API to draw part of controls. (Carbon did provide HITheme interface. It still seems to be available for 64-bit ? really??, yet goes undocumented). | |
| 27 | + | ||
| 28 | + | In order to draw a part of a control on a view, a "hidden" control could be created and then drawn to the target context. The similar approach is used for Printing controls to a printer. | |
| 29 | + | ||
| 30 | + | The same might work with NSCells, yet Apple deprecates NSCells. | |
| 31 | + | ||
| 32 | + | ### Toolbar Buttons | |
| 33 | + | ||
| 34 | + | Toolbars buttons are used to draw "FLAT" buttons style. "FLAT" buttons are expected to be TRANSPARENT to the hosting control. They CAN draw background, if pressed. In order to achieve that, NSButtonCell is used, with the following attributes: | |
| 35 | + | ||
| 36 | + | - buttonType = NSToggleButton (using NSOnOffButton type is causing to draw the background) | |
| 37 | + | - bezelStyle = NSSmallSquareBezelStyle | |
| 38 | + | ||
| 39 | + | ## See Also | |
| 40 | + | ||
| 41 | + | - <https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DrawColor/Tasks/SystemTintAware.html> | |
| 42 | + | ||
| 43 | + | --- | |
| 44 | + | *From the Free Pascal wiki, page "Cocoa Internals/Theme", as it stood on 2020-06-05 after a change by Skalogryz, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 45 | + | Category: Cocoa | |
| 46 | + | Category: macOS |
