Add: colour options to git config

This commit is contained in:
Aroy-Art 2024-10-05 23:33:33 +02:00
parent 0ba56a4132
commit a2223fb344
Signed by: Aroy
GPG key ID: DB9689E9391DD156
2 changed files with 81 additions and 0 deletions

18
Configs/Git/.gitconfig Normal file
View file

@ -0,0 +1,18 @@
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold # line info
old = red # deletions
new = green # additions
[color "status"]
added = yellow
changed = green
untracked = cyan

63
ShellScripts/split-sprites.sh Executable file
View file

@ -0,0 +1,63 @@
#!/bin/bash
# Function to display help message
function usage {
echo "Usage: $0 -i image_path [-s width height] [-n columns rows]"
echo " -i image_path : Path to the sprite sheet image"
echo " -s width height : Size of a single sprite (in pixels)"
echo " -n columns rows : Number of columns and rows in the sprite sheet"
exit 1
}
# Initialize variables
img_path=""
sprite_width=""
sprite_height=""
columns=""
rows=""
# Parse command line options
while getopts "i:s:n:" opt; do
case $opt in
i) img_path=$OPTARG ;;
s)
sprite_width=${OPTARG}
sprite_height=${!OPTIND}
OPTIND=$(($OPTIND + 1))
;;
n)
columns=${OPTARG}
rows=${!OPTIND}
OPTIND=$(($OPTIND + 1))
;;
*) usage ;;
esac
done
# Ensure image path is provided
if [[ -z "$img_path" ]]; then
echo "Error: Image path is required."
usage
fi
# Get image dimensions
img_info=$(magick identify "$img_path")
img_width=$(echo "$img_info" | cut -d ' ' -f 3 | cut -d 'x' -f 1)
img_height=$(echo "$img_info" | cut -d ' ' -f 3 | cut -d 'x' -f 2)
# Calculate sprite width/height from columns/rows, if provided
if [[ -n "$columns" && -n "$rows" ]]; then
sprite_width=$((img_width / columns))
sprite_height=$((img_height / rows))
elif [[ -z "$sprite_width" || -z "$sprite_height" ]]; then
echo "Error: Either sprite size (-s) or number of columns and rows (-n) must be specified."
usage
fi
# Output info
echo "Splitting image $img_path into sprites of size ${sprite_width}x${sprite_height}..."
# Use ImageMagick to split the sprite sheet
magick convert "$img_path" -crop "${sprite_width}x${sprite_height}" +repage sprite_%d.png
echo "Sprites successfully split into individual images (sprite_0.png, sprite_1.png, etc.)"