Skip to content

Instantly share code, notes, and snippets.

@sach1t
Created September 25, 2016 02:52
Show Gist options
  • Save sach1t/b1f9cc96f503ad69d6702b58de243c07 to your computer and use it in GitHub Desktop.
Save sach1t/b1f9cc96f503ad69d6702b58de243c07 to your computer and use it in GitHub Desktop.
Kuler Color Background for Gnome
COLOR_FILE='/tmp/colors'
if [ ! -e "$COLOR_FILE" ]; then
tmp_file=$(mktemp)
wget -q -O "$tmp_file" --header='Accept: text/html' --user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0' 'https://kuler-api.adobe.com/feeds/rss/get.cfm?itemsPerPage=100&listType=popular'
grep -F "kuler:swatchHexColor" "$tmp_file" | sed 's/<[\/]*kuler:swatchHexColor>//g' | sed 's/ //g' > "$COLOR_FILE"
rm "$tmp_file"
fi
total_colors=$(wc -l "$COLOR_FILE" | cut -d' ' -f1)
random_line=$(((RANDOM % total_colors) + 1))
color=$(sed -n "${random_line}p" "$COLOR_FILE")
gsettings set org.gnome.desktop.background primary-color "#${color}"
gsettings set org.gnome.desktop.background secondary-color "#${color}"
gsettings set org.gnome.desktop.background color-shading-type "solid"
@sach1t
Copy link
Author

sach1t commented Sep 25, 2016

Gets a random color from the top 100 most popular color schemes on Kuler, and sets that as the background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment