paint-it-black.sh 1.44 KB
Newer Older
Felix Eckhofer's avatar
Felix Eckhofer committed
1
2
3
4
5
6
#!/bin/sh
# set the background color in the default ubuntu bootsplash and grub
# themes to black. i like a lot of things about the default ubuntu look
# and feel but that weird purple certainly is not among those.
#     -- felix@tribut.de

7
8
9
10
notice() {
	echo "$@" >&2
}

Felix Eckhofer's avatar
Felix Eckhofer committed
11
12
13
sedfilter() {
	SOURCE="$1"
	FILTER="$2"
14
	[ -w "$SOURCE" ] || { notice "$SOURCE not writeable"; return 1; }
Felix Eckhofer's avatar
Felix Eckhofer committed
15
16
17
18
19
20
	TEMPFILE="`mktemp`"

	cp "$SOURCE" "$TEMPFILE" && sed -r "$FILTER" < "$TEMPFILE" > "$SOURCE"
	RETCODE="$?"

	if [ 0 -eq "$RETCODE" ]; then
21
		notice "$SOURCE: done, the changes are as follows:"
Felix Eckhofer's avatar
Felix Eckhofer committed
22
23
24
25
26
27
28
		diff -u "$TEMPFILE" "$SOURCE" >&2
	fi

	rm -f "$TEMPFILE"
	return "$RETCODE"
}

29
30
31
THEMEDIR="/usr/share/plymouth/themes" # xenial and up
[ -f "$THEMEDIR/ubuntu-logo/ubuntu-logo.grub" ] || THEMEDIR="/lib/plymouth/themes" # until wily

Felix Eckhofer's avatar
Felix Eckhofer committed
32
sedfilter \
33
	"$THEMEDIR/ubuntu-logo/ubuntu-logo.grub" \
Felix Eckhofer's avatar
Felix Eckhofer committed
34
35
	's/background_color [0-9]+,[0-9]+,[0-9]+/background_color 0,0,0/'
sedfilter \
36
	"$THEMEDIR/ubuntu-logo/ubuntu-logo.script" \
Felix Eckhofer's avatar
Felix Eckhofer committed
37
	's/^(Window.SetBackground(Top|Bottom)Color ?)\(0\.[0-9]{1,2}, 0\.[0-9]{1,2}, 0\.[0-9]{1,2}\)/\1(0.00, 0.00, 0.00)/'
38
sedfilter \
39
	"$THEMEDIR/ubuntu-text/ubuntu-text.plymouth" \
40
	's/^black=0x[a-fA-F0-9]{6}/black=0x000000/'
41
42

notice "You may want to run 'update-initramfs -u -k all && update-grub' now :)"
43

44
45
if update-alternatives --query gdm3.css 2>/dev/null | grep '^Link: ' | grep -q '/ubuntu.css$'
then
46
47
	notice "To modify the background of gdm, check 'update-alternatives --config gdm3.css'"
fi