{"id":117863,"date":"2020-09-09T16:30:21","date_gmt":"2020-09-09T16:30:21","guid":{"rendered":"https:\/\/developer.apple.com\/news\/?id=5i6jlf4d"},"modified":"2020-09-09T16:30:21","modified_gmt":"2020-09-09T16:30:21","slug":"design-and-implement-macos-document-icons","status":"publish","type":"post","link":"https:\/\/sickgaming.net\/blog\/2020\/09\/09\/design-and-implement-macos-document-icons\/","title":{"rendered":"Design and implement macOS document icons"},"content":{"rendered":"<div class=\"inline-article-image\"><img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/09\/design-and-implement-macos-document-icons.jpg\" data-hires=\"false\"><\/div>\n<p>A good document icon aids in the identification of your file on the Desktop, in a Finder window, or in an open dialog, especially when previews aren\u2019t available. These icons may be displayed on screen as small as 16pt or large enough to showcase every glorious design detail. <\/p>\n<p>Depending on the file type and personal preference, document icons can also display document previews. If someone has chosen not to show document extensions in System Preferences, these icons can additionally provide additional context in deciphering their file type and native program.<\/p>\n<p>With macOS Big Sur, you can customize and control how your app\u2019s document icons display across the system. We\u2019ll show you how to design a great icon, integrate it into your Xcode project, and assign document types and type identifiers.<\/p>\n<h3>Design a document icon for your app<\/h3>\n<p>By default, if you don\u2019t specify a document icon for a file type in your app, macOS will automatically create one for you by compositing your app\u2019s icon together with the correct extension name. This is a common pattern for imported document types or non-proprietary file formats that your application can open such as MP3, JPG or PNG. <\/p>\n<div class=\"inline-article-image\"><img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/09\/design-and-implement-macos-document-icons-1.jpg\" data-hires=\"false\"><\/p>\n<p class=\"typography-caption\">Both the Music and Preview apps use system-generated document icons for document types like JPG and MP3.<\/p>\n<\/div>\n<p>You can additionally create a custom document icon if your app supports multiple file types and you\u2019d like to visually distinguish between them. For example, a drawing application may open a jpg file, a project file, a library of drawing components, a plugin or a color swatch. <\/p>\n<p>When creating a custom icon, we recommend keeping its design simple. Try to depict what your icon represents as closely as possible and with as few details as possible. Additionally, think of other document types that your document may commonly be next to, and use distinct shapes and colors that are identifiable even at smaller sizes. <\/p>\n<p>If you plan to create multiple custom icons for different file types, it\u2019s important to make each design distinct and understandable to help people know what to expect when they open them.<\/p>\n<p><strong>The elements of a custom document icon<\/strong><br \/>\nBeginning with macOS Big Sur, you can generate a new custom document icon with a set of images and a text string.<\/p>\n<div class=\"inline-article-image\"><img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/09\/design-and-implement-macos-document-icons-2.jpg\" data-hires=\"false\"><\/div>\n<p>To create a new custom document icon, you can provide a background fill, center image, or text string. Each of these three elements is optional, allowing you to use just one element or any combination of the three to customize your icon. From there, macOS will automatically layer, position, and mask these elements, then composite them into a page icon with a right corner fold.<\/p>\n<hr>\n<p><em>You can download Sketch and Photoshop templates on Apple Design Resources to assist in the generation of the image assets in all their required sizes.<\/em> <\/p>\n<p><a href=\"https:\/\/developer.apple.com\/design\/resources\/\" class=\"icon icon-after icon-chevronright\">Apple Design Resources<\/a><\/p>\n<hr>\n<p><strong>Fill in the background<\/strong><br \/>\nThe background image allows you to customize the background of your icon. The art should fill the entire drawing area, as shown below, and the system will automatically mask it to the document shape in all sizes.<\/p>\n<div class=\"inline-article-image\"><img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/09\/design-and-implement-macos-document-icons-3.jpg\" data-hires=\"false\"><\/div>\n<p>Background images can not only be used to change the background of your document, but you can also use them to create custom designs that fill the entire page.<\/p>\n<p>The background image should be drawn in the following sizes:<\/p>\n<ul>\n<li>512&#215;512<\/li>\n<li>512&#215;512@2x<\/li>\n<li>256&#215;256<\/li>\n<li>256&#215;256@2x<\/li>\n<li>128&#215;128<\/li>\n<li>128&#215;128@2x<\/li>\n<li>32&#215;32<\/li>\n<li>32&#215;32@2x<\/li>\n<li>16&#215;16<\/li>\n<li>16&#215;16@2x<\/li>\n<\/ul>\n<div class=\"inline-article-image\"><img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/09\/design-and-implement-macos-document-icons-4.jpg\" data-hires=\"false\"><\/p>\n<p class=\"typography-caption\">The Xcode Project icon and the Rich Text Format icons use nothing but the background fill element to create a custom look and feel.<\/p>\n<\/div>\n<p><strong>Add a center image<\/strong><br \/>\nThe center image is always half the size of the document canvas. For example, the center image displays at 16pt on a 32pt icon size.<\/p>\n<p>The bulk of the artwork for the center image should be drawn at ~80% of the canvas size. For example, on the 256&#215;256 version, the drawing should be inside a 205&#215;205 area, as shown in the image below. Curves and points can extend into the margin to adjust for optical alignment.<\/p>\n<p>The shape of the artwork should be simple to make it easily identifiable in smaller sizes. The rendering, however, can be as simple or as rich as you\u2019d like.<\/p>\n<p>The center image can be specified in the following sizes:<\/p>\n<ul>\n<li>256&#215;256<\/li>\n<li>256&#215;256@2x<\/li>\n<li>128&#215;128<\/li>\n<li>128&#215;128@2x<\/li>\n<li>32&#215;32<\/li>\n<li>32&#215;32@2x<\/li>\n<li>16&#215;16<\/li>\n<li>16&#215;16@2x<\/li>\n<\/ul>\n<p><strong>Add some textual context<\/strong><br \/>\nThe icon\u2019s text string will often be your document\u2019s extension, but can also be something more descriptive. For example, &#8220;SCENE&#8221; is more descriptive \u2014 and easier for someone to understand \u2014 than &#8220;scn.&#8221;<\/p>\n<div class=\"inline-article-image\"><img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/09\/design-and-implement-macos-document-icons-5.jpg\" data-hires=\"false\"><\/p>\n<p class=\"typography-caption\">The Swift and Metal document icons both use text strings to clearly identify their document types.<\/p>\n<\/div>\n<p>The system will capitalize and scale the text to fit inside the icon, so it\u2019s important to keep the length of your string as short of possible to prevent it from getting too small. The text will also automatically change its color to remain legible against flat colored backgrounds.<\/p>\n<h3>Build document icons in your app<\/h3>\n<p>To create your document icon types, you\u2019ll need to integrate these elements into your Xcode project.<\/p>\n<p><strong>Bring images into the asset catalog<\/strong><br \/>\nFirst, add your background fill image and\/or center image into the Asset Catalog as Generic Icons.<\/p>\n<ol>\n<li>In Xcode, click the <strong>+ button<\/strong> within your Asset Catalog.<\/li>\n<li>Choose <strong>macOS &gt; macOS Generic Icon.<\/strong><\/li>\n<li>Drag your assets into their respective size slots. <\/li>\n<\/ol>\n<p>If your assets are named using the format <em>icon_[size]x[size][@resolution].png<\/em> (e.g. <em>icon_32x32@2x.png<\/em> or <em>icon_32x32.png<\/em>), they can all be dragged at once and will automatically be assigned to their appropriate size slots.<\/p>\n<div class=\"inline-article-image\"><img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/09\/design-and-implement-macos-document-icons-6.jpg\" data-hires=\"false\"><\/div>\n<p><strong>Configure the Document Type Identifier<\/strong><br \/>\nClick the Imported\/Exported Type Identifier disclosure triangle to add a new Document Type Identifier or open an existing one.<\/p>\n<div class=\"inline-article-image\"><img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/09\/design-and-implement-macos-document-icons-7.jpg\" data-hires=\"false\"><\/div>\n<ul>\n<li><strong>Icon Image<\/strong> (optional): Select a Center Image from your app\u2019s Asset Catalog.<\/li>\n<li><strong>Icon Fill<\/strong> (optional): Select a Background Fill Image from your app\u2019s Asset Catalog<\/li>\n<li><strong>Icon Text <\/strong>(optional): Input the text you want displayed on the bottom of the document icon. This can be the same as the extension or something more descriptive. For example, the <em>scn<\/em> extension can use <em>scene<\/em> as its text.<\/li>\n<li><strong>Legacy Icon<\/strong> (optional): This is either an .icns file or a Generic Icon in your Asset Catalog which will be used if you deploy your application to macOS 10.15 and below or in macOS 11 if Icon Image, Icon Fill and Icon Text are left blank. If a Legacy Icon was specified in the Document Type section, it will override this.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/developer.apple.com\/library\/archive\/documentation\/FileManagement\/Conceptual\/understanding_utis\/understand_utis_declare\/understand_utis_declare.html\" class=\"icon icon-after icon-chevronright\">Declaring New Uniform Type Identifiers<\/a><\/p>\n<p><strong>Configure your document icons<\/strong><\/p>\n<p>Here\u2019s how to indicate whether you want to display a legacy document icon, a custom icon, a programmatic option.<\/p>\n<ol>\n<li>In Xcode\u2019s Project navigator, <strong>select<\/strong> the project file.<\/li>\n<li>Select your <strong>app&#8217;s target<\/strong> from the target list.<\/li>\n<li>Choose the <strong>Info<\/strong> tab.<\/li>\n<\/ol>\n<p>Click the Document Type disclosure triangle to add a new Document Type or open an existing one.<\/p>\n<div class=\"inline-article-image\"><img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/09\/design-and-implement-macos-document-icons-8.jpg\" data-hires=\"false\"><\/div>\n<p>You\u2019ll have two options here for iconography:<\/p>\n<ul>\n<li><strong>Legacy Icon<\/strong> (optional): This is either an .icns file or a Generic Icon in your Asset Catalog. macOS uses legacy icons if you deploy your app to macOS 10.15 or earlier, or if you don\u2019t provide any custom elements for your icon. If you\u2019ve specified a Legacy Icon in the Document Type Identifier, the one in the Document Type will override it.<\/li>\n<li><strong>Use system generated icons<\/strong>: Check this box if you\u2019ve defined an Icon Fill, Image or Text in the Document Type Identifier for use in macOS 11 and above, or you want the system to use your App\u2019s icon and extension name as your icon. If you leave this box unchecked, macOS will use your Legacy Icon for that document type even when running macOS 11 and above.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/developer.apple.com\/documentation\/appkit\/documents_data_and_pasteboard\/developing_a_document-based_app\" class=\"icon icon-after icon-chevronright\">Developing a Document-Based App<\/a><\/p>\n<p><strong>Validate your app document icons<\/strong><\/p>\n<p>You can test your new document icons in your app by building and running your app. Here\u2019s what you need to do.<\/p>\n<ol>\n<li><strong>Remove<\/strong> all other versions of your app from your test system and empty the Trash.<\/li>\n<li><strong>Open<\/strong> your app project in Xcode<\/li>\n<li><strong>Build and run<\/strong> your app<\/li>\n<li><strong>Gather<\/strong> test assets by creating a new folder and adding one of each document type. <\/li>\n<li><strong>Open<\/strong> the test asset folder in Finder.<\/li>\n<li>In Finder, go to <strong>View &gt; Show View Options<\/strong> to open the \u201cView Options\u201d window for your test asset folder.<\/li>\n<li>Make sure that \u201cShow icon preview\u201d is unchecked. <\/li>\n<\/ol>\n<h3>Bring some life into your documents<\/h3>\n<p>Document icons in macOS Big Sur are an excellent way to further refine your app\u2019s design on Mac and help people identify the correct file at a glance. For more support on creating these icons, be sure to check out the Apple Design Resources and developer documentation.<\/p>\n<h3>Resources<\/h3>\n<p><a href=\"https:\/\/developer.apple.com\/design\/resources\/\" class=\"icon icon-after icon-chevronright\">Apple Design Resources<\/a><\/p>\n<p><a href=\"https:\/\/developer.apple.com\/documentation\/appkit\/documents_data_and_pasteboard\/developing_a_document-based_app\" class=\"icon icon-after icon-chevronright\">Developing a Document-Based App<\/a><\/p>\n<p><a href=\"https:\/\/developer.apple.com\/library\/archive\/documentation\/FileManagement\/Conceptual\/understanding_utis\/understand_utis_conc\/understand_utis_conc.html\" class=\"icon icon-after icon-chevronright\">Uniform Type Identifier Concepts<\/a><\/p>\n<p><a href=\"https:\/\/developer.apple.com\/library\/archive\/documentation\/FileManagement\/Conceptual\/understanding_utis\/understand_utis_declare\/understand_utis_declare.html\" class=\"icon icon-after icon-chevronright\">Declaring New Uniform Type Identifiers<\/a><\/p>\n<p><a href=\"https:\/\/developer.apple.com\/library\/archive\/documentation\/FileManagement\/Conceptual\/understanding_utis\/understand_utis.tasks\/understand_utis_tasks.html#\/\/apple_ref\/doc\/uid\/TP40001319-CH203-BABHCIAC\" class=\"icon icon-after icon-chevronright\">Adopting Uniform Type Identifiers<\/a><\/p>\n<p><a href=\"https:\/\/developer.apple.com\/library\/archive\/documentation\/FileManagement\/Conceptual\/understanding_utis\/understand_utis_intro\/understand_utis_intro.html\" class=\"icon icon-after icon-chevronright\">Introduction to Uniform Type Identifiers<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A good document icon aids in the identification of your file on the Desktop, in a Finder window, or in an open dialog, especially when previews aren\u2019t available. These icons may be displayed on screen as small as 16pt or large enough to showcase every glorious design detail. Depending on the file type and personal [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":117864,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[],"class_list":["post-117863","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apple-developer-news"],"_links":{"self":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/117863","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/comments?post=117863"}],"version-history":[{"count":0,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/117863\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media\/117864"}],"wp:attachment":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media?parent=117863"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/categories?post=117863"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/tags?post=117863"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}