Skip to content

Commit

Permalink
Merge pull request #2 from othyn/automate-via-folderify
Browse files Browse the repository at this point in the history
Automate icon generation via folderify & make
  • Loading branch information
othyn authored May 19, 2022
2 parents daa4a38 + 573f52b commit 97d7efc
Show file tree
Hide file tree
Showing 185 changed files with 203 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Temp Files
mask.iconset
mask.icns
Binary file removed 10.13 - High Sierra/high_sierra_github.icns
Binary file not shown.
Binary file removed 10.13 - High Sierra/high_sierra_github.psd
Binary file not shown.
Binary file removed 10.13 - High Sierra/high_sierra_github_preview.png
Binary file not shown.
Binary file removed 10.14 - Mojave/mojave_github.icns
Binary file not shown.
Binary file removed 10.14 - Mojave/mojave_github.psd
Binary file not shown.
Binary file removed 10.14 - Mojave/mojave_github_preview.png
Binary file not shown.
Binary file removed 10.15 - Catalina/catalina_github.icns
Binary file not shown.
Binary file removed 10.15 - Catalina/catalina_github.psd
Binary file not shown.
Binary file removed 10.15 - Catalina/catalina_github_preview.png
Binary file not shown.
105 changes: 91 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,98 @@
# GitHub Folder Icon for macOS
# 🍏📁 macOS GitHub Folder Icon

Made so that it fits nicely alongside all the others inside your home directory... or wherever.

![preview image](preview.png)
What you get:

- ... 📈 A version available all the way from Mac OS X 10.5 (Leopard) through to macOS 12 (Monterey), see the [`icons`](./icons) folder
- ... 🌗 Light and Dark mode variants (where applicable, macOS 11 or later)
- ... 📁 Both `icns` and `iconset` versions of all icons
- ... 🖼️ All icon sizes from `16x16` through to `512x512@2x`

<p align="middle">
<img src="art/preview_old.png" width="25%" alt="the oldest Mac OS X icon" />
&nbsp;
<img src="art/arrow.png" width="10%" alt="an arrow pointing right" />
&nbsp;
<img src="art/preview_new.png" width="25%" alt="the newest macOS icon" />
</p>

## 👇 Downloading & using the icon(s)

The easiest way will be for you to download the icon you want from the the [`icons`](./icons) directory. Simply find which macOS version you would like the icon for, and if applicable the light or dark mode variant, and download the `icns` file within that directory using GitHub's Download button once within a file's context:

<p align="middle">
<img src="art/download.png" width="75%" alt="GitHub's download button" />
</p>

To apply the icon, right click on the directory that you wish to update the icon of and click 'Get Info', a new dialogue window should appear. You now need to click-and-drag the downloaded `icns` file into the small icon in the top left of the window next to the directory name:

<p align="middle">
<img src="art/get_info.png" width="30%" alt="macOS 'Get Info' dialogue window" />
</p>

Ta-da! 🎉

## 🧰 Installing dependencies

I used to manually find and extract the folder icon upon every release, but someone recently introduced me to... [Folderify](https://github.com/lgarron/folderify)! Which has made maintaining this repo a breeze.

Make sure [`brew`](https://brew.sh/) is installed (don't want to automate installing this on your system) and then go ahead and run the `make` command to get things setup:

```sh
make install
```

## 🏗️ Generating icons

This is as simple as ensuring that you've already run `make install` and then running:

```sh
make icons
```

### 🎨️ Manually generating just the icons

To generate just the icons on their own, run:

```sh
make generate
```

Although this step is run prior to generating new icons anyway.

### 🖼️ Manually generating a new preview image

To generate a new preview image, used in the README of this project, run:

```sh
make preview
```

Although this step is run prior to generating new icons anyway.

### 🗑️ Manually cleaning Icons

If you want to quickly wipe the slate clean, run:

```sh
make clean
```

Although this step is run prior to generating new icons anyway.

## ❓ F.A.Q's

- Can I get the icon to automatically change with light/dark mode?

## Todo
- Small icon had more defined edges / dropshadow, need to figure out how to extract that icon and look at the styling instead of using the same image for all sizes
- Unfortunately, no. As mentioned in the [Folderify README, under Usage](https://github.com/lgarron/folderify#usage):

## How to source the folder icon
1. Create a new folder (or use an existing one)
2. Right click on the folder and select "Get Info"
3. Select the image next to the name of the folder (icon in the top left of the window) and copy it (via ⌘ + C or Edit -> Copy)
4. While that is in your clipboard, pop open Photoshop (PS) (or editor of choice) and create a new project from the clipboard
5. Edit as necessary!
> There is currently no simple way to set an icon that will automatically switch between light and dark when you switch the entire OS. You can only assign one icon to a folder.
## Editing notes
In the included PSD, I've ruled out the centre points / thing's I think will be handy. The layout for which I sketched out from other macOS icons, using the above method to first get the icon (say, Downloads) into PS, then looking at the dimensions / layout / opacity / colour / inner-dropshadow used within that to make it as similar as possible. Just took a hell of a lot of fiddling with the blending options, making micro adjustments, while comparing it to the reference icon until it looked as near as I could realistically get it.
- This appears to be a limitation within macOS itself and Apple currently not allowing for the distinction between two icons

## Sources
- GitHub icon: [Dave Gandy on flaticon](https://www.flaticon.com/free-icon/github-logo_25231)
## 🎂 Sources

- Amazing GitHub icon: [Dave Gandy on flaticon](https://www.flaticon.com/free-icon/github-logo_25231)
- Superb icon generation: [Folderify](https://github.com/lgarron/folderify)
- Fabulous macOS package manager: [`brew`](https://brew.sh/)
Binary file added art/arrow.afphoto
Binary file not shown.
Binary file added art/arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/get_info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/preview_new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/preview_old.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/10.10 - Yosemite/light/icon.icns
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/10.11 - El Capitan/light/icon.icns
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/10.12 - Sierra/light/icon.icns
Binary file not shown.
Binary file added icons/10.13 - High Sierra/light/icon.icns
Binary file not shown.
Binary file added icons/10.14 - Mojave/light/icon.icns
Binary file not shown.
Binary file added icons/10.15 - Catalina/light/icon.icns
Binary file not shown.
Binary file added icons/10.5 - Leopard/light/icon.icns
Binary file not shown.
Binary file added icons/10.6 - Snow Leopard/light/icon.icns
Binary file not shown.
Binary file added icons/10.7 - Lion/light/icon.icns
Binary file not shown.
Binary file added icons/10.8 - Mountain Lion/light/icon.icns
Binary file not shown.
Binary file added icons/10.9 - Mavericks/light/icon.icns
Binary file not shown.
Binary file added icons/11.0 - Big Sur/dark/icon.icns
Binary file not shown.
Binary file added icons/11.0 - Big Sur/light/icon.icns
Binary file not shown.
Binary file added icons/12.0 - Monterey/dark/icon.icns
Binary file not shown.
Binary file added icons/12.0 - Monterey/light/icon.icns
Binary file not shown.
109 changes: 109 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# ~~ Function to normalise the process of making an icon
# ~ At the moment, there is no way to export to a given path or directory
# ~ Each line is also run in its own shell, so no variables here!
# ~ DEBUG: remove '> /dev/null 2>&1' from the end of the folderify call
define makeIcon
@ echo "~ Generating icons for: $(1) ~ $(2) ($(if $(3),$(3),light))..."

@ mkdir -p "./icons/$(1) - $(2)/$(if $(3),$(3),light)"

@ folderify ./mask.png --macOS $(1) --color-scheme $(if $(3),$(3),light) > /dev/null 2>&1

@ mv "./mask.iconset" "./icons/$(1) - $(2)/$(if $(3),$(3),light)/icon.iconset"
@ mv "./mask.icns" "./icons/$(1) - $(2)/$(if $(3),$(3),light)/icon.icns"

@ echo "~ Icons generated."
@ echo ""
endef

# ~~ Convert an ICNS file to PNG, mainly for the preview in the README
# ~ sips should be a native macOS binary
# ~ DEBUG: remove '> /dev/null 2>&1' from the end of the sips call
define icnsToPng
@ sips -s format png $(1) --out $(2) > /dev/null 2>&1
endef

# ~~ Install the required dependencies
.PHONY: install
install:
@ echo "~ Installing required dependencies..."

@ brew install folderify

@ echo "~ Required dependencies installed!"
@ echo ""

# ~~ Clean the generated icon files
.PHONY: clean
clean:
@ echo "~ Cleaning existing icons..."

@ if [ -d ./icons ]; then rm -r ./icons; fi

@ echo "~ Icons cleaned!"
@ echo ""

# ~~ Generate the icons
.PHONY: generate
generate:
@ echo "~ Creating new icons..."
@ echo ""

@ # Mac OS X 10.5 - Leopard
$(call makeIcon,10.5,Leopard)

@ # Mac OS X 10.6 - Snow Leopard
$(call makeIcon,10.6,Snow Leopard)

@ # Mac OS X 10.7 - Lion
$(call makeIcon,10.7,Lion)

@ # OS X 10.8 - Mountain Lion
$(call makeIcon,10.8,Mountain Lion)

@ # OS X 10.9 - Mavericks
$(call makeIcon,10.9,Mavericks)

@ # OS X 10.10 - Yosemite
$(call makeIcon,10.10,Yosemite)

@ # OS X 10.11 - El Capitan
$(call makeIcon,10.11,El Capitan)

@ # macOS 10.12 - Sierra
$(call makeIcon,10.12,Sierra)

@ # macOS 10.13 - High Sierra
$(call makeIcon,10.13,High Sierra)

@ # macOS 10.14 - Mojave
$(call makeIcon,10.14,Mojave)

@ # macOS 10.15 - Catalina
$(call makeIcon,10.15,Catalina)

@ # macOS 11 - Big Sur
$(call makeIcon,11.0,Big Sur)
$(call makeIcon,11.0,Big Sur,dark)

@ # macOS 12 - Monterey
$(call makeIcon,12.0,Monterey)
$(call makeIcon,12.0,Monterey,dark)

@ echo "~ New icons created!"
@ echo ""

# Manually grabs the latest icon and uses it as the preview image
.PHONY: preview
preview:
@ echo "~ Creating preview image..."

$(call icnsToPng,"./icons/10.5 - Leopard/light/icon.icns","./art/preview_old.png")
$(call icnsToPng,"./icons/12.0 - Monterey/light/icon.icns","./art/preview_new.png")

@ echo "~ Preview image created!"
@ echo ""

# ~~ Build the icons
.PHONY: icons
icons: clean generate preview
Binary file added mask.png
Binary file removed preview.png
Diff not rendered.

0 comments on commit 97d7efc

Please sign in to comment.