The following steps configure your Xcode project to check the status of your custom color palette in the system, during the build process.
When your custom color palette is not installed in the system, Xcode's build process will fail with an error, instructing you to run a script which will install the file.
When the installed color palette doesn't match what is in your project's root directory (according to an md5 file checksum comparison), Xcode's build process will warn you to update the .clr file.
This system allows you to keep your custom color palette file in your project directory, under source control. Whenever changes to the palette file are pushed to the repo, Xcode will notice them and notify you during the build process.
-
Place your custom .clr color palette file in the root of your project directory
-
Create
install_colors.sh
in your project root:cp YOUR_COLOR_FILE_NAME.clr ~/Library/Colors
(don't forget to
chmod +x install_colors.sh
) -
Create a new Xcode project Run Script with the following script contents (replacing
YOUR_COLOR_FILE_NAME
in line 1 with the filename you used in Step 2):COLOR_FILENAME="YOUR_COLOR_FILE_NAME.clr" ##### SYSTEM_COLOR_FILE_PATH=~/Library/Colors/$COLOR_FILENAME if [ ! -f "$SYSTEM_COLOR_FILE_PATH" ]; then echo "error: Custom color palette not found in system! Run ./install_colors.sh" exit 1 fi PROJECT_COLOR_FILE_MD5="$(md5 -q $COLOR_FILENAME)" SYSTEM_COLOR_FILE_MD5="$(md5 -q $SYSTEM_COLOR_FILE_PATH)" if [ ! "$PROJECT_COLOR_FILE_MD5" == "$SYSTEM_COLOR_FILE_MD5" ]; then echo "warning: Your system's custom color palette file does not match file in project directory! Run ./install_colors.sh to update." exit 0 fi
-
There is no Step 4!