From f054ba6846155b5a65271f7823840fae34dedbf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kune=C5=A1?= Date: Sat, 17 Nov 2018 22:13:40 +0100 Subject: [PATCH] slimming down scripts, adding command line arguments, theme color definitions in json file, added all colors from old colora-theme-colection --- 0-install-tools.sh | 5 ++- 1-change-color.sh | 78 ++++++++++----------------------------- 2-delete-assets.sh | 19 ++-------- 3-make-assets.sh | 27 ++++---------- 4-moving-the-themes.sh | 83 +++++++++++++++++------------------------- README.md | 29 ++++++++------- autobuild-themes.py | 58 +++++++++-------------------- themes.json | 34 +++++++++++++++++ 8 files changed, 136 insertions(+), 197 deletions(-) create mode 100644 themes.json diff --git a/0-install-tools.sh b/0-install-tools.sh index 1ad33a9..c030ad9 100644 --- a/0-install-tools.sh +++ b/0-install-tools.sh @@ -1,3 +1,6 @@ #!/bin/bash -echo "Installing all the needed software to be able to run the scripts." + +echo "Installing all software needed to run the scripts." + sudo apt-get install -y git python3 ruby-sass optipng inkscape + diff --git a/1-change-color.sh b/1-change-color.sh index e322a9f..cb0574a 100755 --- a/1-change-color.sh +++ b/1-change-color.sh @@ -1,63 +1,29 @@ #!/bin/bash # -################################################################################################################## -# Written to be used on 64 bits computers -# Author : Erik Dubois -# Website : http://www.erikdubois.be -################################################################################################################## -################################################################################################################## +# Prepare light and dark color in hexadecimal format (6 letters or numbers). +# - Never put a hashtag # in front of the colour code if copy/pasting from gpick +# - Never put "FF" at the end if copy/pasting from inkscape +# Use color values as scrpt arguments in format "1-change-color.sh LIGHT_COLOR DARK_COLOR" +# - example: ./1-change-color.sh 9ab87c 8fa876 # -# DO NOT JUST RUN THIS. EXAMINE AND JUDGE. RUN AT YOUR OWN RISK. -# -################################################################################################################## - -# changing the assets from colour -# Mint-Y Theme -# Light green - 9ab87c -# Dark green - 8fa876 -# but there are some minor green variations to consider as well +# path to Mint-Y source +SRC_DIR="src/Mint-Y" -################################################################################################################## -################################################################################################################## -################################################################################################################## -# put your colour codes in here and do not change the rest -# Never put a hashtag or # in front of the colour code if copy/pasting from gpick -# Never put "FF" at the end if copy/pasting from inkscape -# Always 6 letters or numbers -# THESE CODES MUST BE CHANGED -# THESE CODES MUST BE CHANGED -# THESE CODES MUST BE CHANGED -# THESE CODES MUST BE CHANGED +# get new colors +personallightcolour=$1 +personaldarkcolour=$2 +if [ $# -ne 2 ]; then + echo "ERROR! Missing (or incorect number of) color values! Using default colors!" + # these are orginal colors + personallightcolour=9ab87c + personaldarkcolour=8fa876 +fi -#original light version is #9ab87c -#original dark version is #8fa876 -# !!!COLOR_REPLACE_START!!! -personallightcolour=fd424d -personaldarkcolour=fd424d -# !!!COLOR_REPLACE_END!!! - -# THESE CODES MUST BE CHANGED -# THESE CODES MUST BE CHANGED -# THESE CODES MUST BE CHANGED -# THESE CODES MUST BE CHANGED -################################################################################################################## -################################################################################################################## -################################################################################################################## - - -echo "All colours in the folder src are still the original green ones from github!!!" -echo "Choose your colour that will replace the green online or with tools like gpick." -echo "e.g. sudo apt-get install gpick" +echo "All css files but also svg files will be affected" +echo "PNG'S will not be altered with this script" echo "Changing ....." -echo "Wait for it ...." - -################################################################################################################## - -## DO NOT CHANGE THESE LINES -## DO NOT CHANGE THESE LINES -## DO NOT CHANGE THESE LINES #original light version is #9ab87c @@ -79,9 +45,8 @@ newcolour3=$personaldarkcolour newcolour4=$personallightcolour newcolour5=$personallightcolour newcolour6=$personallightcolour -newcolour7=$personaldarkcolour +newcolour7=$personaldarkcolour -SRC_DIR="src/Mint-Y" find $SRC_DIR -type f -exec sed -i 's/'$oldcolour1'/'$newcolour1'/g' {} \; find $SRC_DIR -type f -exec sed -i 's/'$oldcolour2'/'$newcolour2'/g' {} \; @@ -122,7 +87,4 @@ oldcolour1="129, 166, 91" find $SRC_DIR -type f -exec sed -i "s/$oldcolour1/$newcolour1/g" {} \; -echo "All css files but also svg files will be affected" -echo "PNG'S will not be altered with this script" -echo -echo "Next up delete all assets i.e. png's with script number 2" +echo "Finished! Next, delete all assets i.e. png's with script number 2" diff --git a/2-delete-assets.sh b/2-delete-assets.sh index fb7122a..27dbca0 100755 --- a/2-delete-assets.sh +++ b/2-delete-assets.sh @@ -1,19 +1,9 @@ #!/bin/bash -# -################################################################################################################## -# Written to be used on 64 bits computers -# Author : Erik Dubois -# Website : http://www.erikdubois.be -################################################################################################################## -################################################################################################################## -# -# DO NOT JUST RUN THIS. EXAMINE AND JUDGE. RUN AT YOUR OWN RISK. -# -################################################################################################################## +# path to Mint-Y source SRC_DIR="src/Mint-Y" -echo "Deleting all assets i.e. png in the src folder" +echo "Deleting all assets i.e. png in the src folder..." rm -f $SRC_DIR/gtk-2.0/assets/*.png rm -f $SRC_DIR/gtk-2.0/assets-dark/*.png @@ -21,7 +11,4 @@ rm -f $SRC_DIR/gtk-2.0/menubar-toolbar/*.png rm -f $SRC_DIR/gtk-3.0/assets/*.png -echo "All png's have been deleted" -echo "Proceed to making the assets." -echo -echo "Run script number 3 to make the assets." +echo "Finished! Next, run script number 3 to make new assets." diff --git a/3-make-assets.sh b/3-make-assets.sh index 8f2ab7b..1278b9d 100755 --- a/3-make-assets.sh +++ b/3-make-assets.sh @@ -1,24 +1,15 @@ #!/bin/bash -# -################################################################################################################## -# Written to be used on 64 bits computers -# Author : Erik Dubois -# Website : http://www.erikdubois.be -################################################################################################################## -################################################################################################################## -# -# DO NOT JUST RUN THIS. EXAMINE AND JUDGE. RUN AT YOUR OWN RISK. -# -################################################################################################################## + +# path to Mint-Y source +SRC_DIR="src/Mint-Y" echo "It is time for you to take a coffee." -echo "It will take as long as it takes depending on cpu etc..." +echo "It will take as long as it takes depending on cpu etc." -echo "Making all assets" +echo "Making all assets..." -SRC_DIR="src/Mint-Y" cd $SRC_DIR # fix for nonexistent "render-menubar-toolbar.sh" in mint-themes repo @@ -31,6 +22,8 @@ cp assets-dark/button-hover.png menubar-toolbar/button-h cp assets-dark/button-insensitive.png menubar-toolbar/button-insensitive.png cp assets/menubar.png menubar-toolbar/menubar.png cp assets-dark/menubar.png menubar-toolbar/menubar-dark.png +cp assets/menubar_button.png menubar-toolbar/menubar_button.png +cp assets-dark/menubar_button.png menubar-toolbar/menubar_button-dark.png cp assets/toolbar-entry-border-active-bg.png menubar-toolbar/toolbar-entry-border-active-bg.png cp assets-dark/toolbar-entry-border-active-bg.png menubar-toolbar/toolbar-entry-border-active-bg-dark.png cp assets/toolbar-entry-border-bg.png menubar-toolbar/toolbar-entry-border-bg.png @@ -43,8 +36,4 @@ cd .. python build-themes.py -echo "All assets have been made." -echo "Svg's have been exported from the assets svg files" -echo "and converted to png's" -echo -echo "Run script number 4 to install the themes." +echo "Finished! Next, run script number 4 to install the themes." diff --git a/4-moving-the-themes.sh b/4-moving-the-themes.sh index bd053fb..e5f8bf7 100755 --- a/4-moving-the-themes.sh +++ b/4-moving-the-themes.sh @@ -1,78 +1,61 @@ #!/bin/bash # -################################################################################################################## -# Written to be used on 64 bits computers -# Author : Erik Dubois -# Website : http://www.erikdubois.be -################################################################################################################## -################################################################################################################## -# -# DO NOT JUST RUN THIS. EXAMINE AND JUDGE. RUN AT YOUR OWN RISK. -# -################################################################################################################## - +# Usage: +# ./4-moving-the-themes.sh THEME_NAME +# OR +# ./4-moving-the-themes.sh THEME_NAME THEME_FOLDER choice=$1 - -if [ $# -ne 1 ]; then - +if [ $# -eq 0 ]; then echo "Let us rename the folders so they are unique :" echo "Your name will be added after 'Mint-Y', 'Mint-Y-Dark' or 'Mint-Y-Darker'." echo "For example if you type Sun you will get" - echo "E.g. Mint-Y-Sun, Mint-Y-Darker-Sun, Mint-Y-Dark-Sun" + echo "E.g. Mint-Y-Sun, Mint-Y-Darker-Sun, Mint-Y-Dark-Sun" read -p "How should we name this new theme? First letter is a capital letter (no space but '-') : " choice echo "Renaming the folders" - - fi +target=$2 +if [ $# -eq 1 ]; then + target=$HOME"/.themes" +fi -# if there is no hidden folder then make one -[ -d $HOME"/.themes" ] || mkdir -p $HOME"/.themes" -cp -rf usr/share/themes/Mint-Y* $HOME"/.themes" - - -# fix for gtk2 sublime text select menu still green -cp ~/.themes/Mint-Y/gtk-2.0/assets/menubar_button.png ~/.themes/Mint-Y/gtk-2.0/menubar-toolbar/menubar_button-dark.png -cp ~/.themes/Mint-Y/gtk-2.0/assets/menubar_button.png ~/.themes/Mint-Y/gtk-2.0/menubar-toolbar/menubar_button.png - -cp ~/.themes/Mint-Y-Dark/gtk-2.0/assets/menubar_button.png ~/.themes/Mint-Y-Dark/gtk-2.0/menubar-toolbar/menubar_button-dark.png -cp ~/.themes/Mint-Y-Dark/gtk-2.0/assets/menubar_button.png ~/.themes/Mint-Y-Dark/gtk-2.0/menubar-toolbar/menubar_button.png - -cp ~/.themes/Mint-Y-Darker/gtk-2.0/assets/menubar_button.png ~/.themes/Mint-Y-Darker/gtk-2.0/menubar-toolbar/menubar_button-dark.png -cp ~/.themes/Mint-Y-Darker/gtk-2.0/assets/menubar_button.png ~/.themes/Mint-Y-Darker/gtk-2.0/menubar-toolbar/menubar_button.png - +# if there is no themes folder then make one +[ -d $target ] || mkdir -p $target +# remove old version of this theme +cp -rf usr/share/themes/Mint-Y* $target -mv $HOME"/.themes/Mint-Y" $HOME"/.themes/Mint-Y-"$choice -mv $HOME"/.themes/Mint-Y-Dark" $HOME"/.themes/Mint-Y-Dark-"$choice -mv $HOME"/.themes/Mint-Y-Darker" $HOME"/.themes/Mint-Y-Darker-"$choice +# copy theme to destination +mv $target"/Mint-Y" $target"/Mint-Y-"$choice +mv $target"/Mint-Y-Dark" $target"/Mint-Y-Dark-"$choice +mv $target"/Mint-Y-Darker" $target"/Mint-Y-Darker-"$choice -echo "################################################################" +# update theme names in index.theme +echo "################################################################" echo "Renaming the content of the index.theme" echo "Mint-Y-Darker-$choice" -find $HOME"/.themes/Mint-Y-Darker-"$choice -name "index.theme" -type f -exec sed -i 's/'Name=Mint-Y-Darker'/'Name=Mint-Y-Darker-$choice'/g' {} \; -find $HOME"/.themes/Mint-Y-Darker-"$choice -name "index.theme" -type f -exec sed -i 's/'GtkTheme=Mint-Y-Darker'/'GtkTheme=Mint-Y-Darker-$choice'/g' {} \; -find $HOME"/.themes/Mint-Y-Darker-"$choice -name "index.theme" -type f -exec sed -i 's/'MetacityTheme=Mint-Y-Dark'/'MetacityTheme=Mint-Y-Darker-$choice'/g' {} \; -echo "################################################################" +find $target"/Mint-Y-Darker-"$choice -name "index.theme" -type f -exec sed -i 's/'Name=Mint-Y-Darker'/'Name=Mint-Y-Darker-$choice'/g' {} \; +find $target"/Mint-Y-Darker-"$choice -name "index.theme" -type f -exec sed -i 's/'GtkTheme=Mint-Y-Darker'/'GtkTheme=Mint-Y-Darker-$choice'/g' {} \; +find $target"/Mint-Y-Darker-"$choice -name "index.theme" -type f -exec sed -i 's/'MetacityTheme=Mint-Y-Dark'/'MetacityTheme=Mint-Y-Darker-$choice'/g' {} \; +echo "################################################################" echo "Renaming inside the index.theme" echo "Mint-Y-Dark-$choice" -find $HOME"/.themes/Mint-Y-Dark-"$choice -name "index.theme" -type f -exec sed -i 's/'Name=Mint-Y-Dark'/'Name=Mint-Y-Dark-$choice'/g' {} \; -find $HOME"/.themes/Mint-Y-Dark-"$choice -name "index.theme" -type f -exec sed -i 's/'GtkTheme=Mint-Y-Dark'/'GtkTheme=Mint-Y-Dark-$choice'/g' {} \; -find $HOME"/.themes/Mint-Y-Dark-"$choice -name "index.theme" -type f -exec sed -i 's/'MetacityTheme=Mint-Y-Dark'/'MetacityTheme=Mint-Y-Dark-$choice'/g' {} \; -echo "################################################################" +find $target"/Mint-Y-Dark-"$choice -name "index.theme" -type f -exec sed -i 's/'Name=Mint-Y-Dark'/'Name=Mint-Y-Dark-$choice'/g' {} \; +find $target"/Mint-Y-Dark-"$choice -name "index.theme" -type f -exec sed -i 's/'GtkTheme=Mint-Y-Dark'/'GtkTheme=Mint-Y-Dark-$choice'/g' {} \; +find $target"/Mint-Y-Dark-"$choice -name "index.theme" -type f -exec sed -i 's/'MetacityTheme=Mint-Y-Dark'/'MetacityTheme=Mint-Y-Dark-$choice'/g' {} \; +echo "################################################################" echo "Renaming inside the index.theme" echo "Mint-Y-$choice" -find $HOME"/.themes/Mint-Y-"$choice -name "index.theme" -type f -exec sed -i 's/'Name=Mint-Y'/'Name=Mint-Y-$choice'/g' {} \; -find $HOME"/.themes/Mint-Y-"$choice -name "index.theme" -type f -exec sed -i 's/'GtkTheme=Mint-Y'/'GtkTheme=Mint-Y-$choice'/g' {} \; -find $HOME"/.themes/Mint-Y-"$choice -name "index.theme" -type f -exec sed -i 's/'MetacityTheme=Mint-Y'/'MetacityTheme=Mint-Y-$choice'/g' {} \; +find $target"/Mint-Y-"$choice -name "index.theme" -type f -exec sed -i 's/'Name=Mint-Y'/'Name=Mint-Y-$choice'/g' {} \; +find $target"/Mint-Y-"$choice -name "index.theme" -type f -exec sed -i 's/'GtkTheme=Mint-Y'/'GtkTheme=Mint-Y-$choice'/g' {} \; +find $target"/Mint-Y-"$choice -name "index.theme" -type f -exec sed -i 's/'MetacityTheme=Mint-Y'/'MetacityTheme=Mint-Y-$choice'/g' {} \; + -echo "The themes have been renamed and moved to your home folder" -echo "in the hidden folder .themes" -echo "The folder was created if you did not have one." +echo "The themes have been renamed and moved to folder: "$target echo "If you made a mistake, delete the folders in .themes and run the script again." echo "Select theme with your theme manager and enjoy!" diff --git a/README.md b/README.md index 2a6c84c..c90935a 100644 --- a/README.md +++ b/README.md @@ -25,19 +25,14 @@ If you are on a different kind of distro, you will need to change package manage #### 1. Get the source -First, install git: - - sudo apt-get install git - -Get the latest version of the Linux Mint themes and Mint-Y-Colora with: +Get the latest version of the Linux Mint themes and Mint-Y-Colora theme, download and extract it from browser or clone repo with: git clone https://github.com/linuxmint/mint-themes.git git clone https://github.com/kunesj/Mint-Y-Colora-Theme.git -Copy scripts into downloaded mint-themes: +Copy scripts and file with theme definitions into downloaded mint-themes folder: - cp Mint-Y-Colora-Theme/*.sh mint-themes/ - cp Mint-Y-Colora-Theme/*.py mint-themes/ + cp Mint-Y-Colora-Theme/*.{sh,py,json} mint-themes/ Go inside mint-themes folder and install required tools with: @@ -46,22 +41,25 @@ Go inside mint-themes folder and install required tools with: #### 2. Define name and color of new theme(s) -Find yourself a nice colour with gpick or online. It should be a hexadecimal notation but without the hashtag `#`. Theme name must not have any spaces and will be appended to Mint-Y. example: +Find yourself a nice colour with gpick or online. It should be a hexadecimal notation but without the hashtag `#`. +Theme name must not have any spaces and will be appended to Mint-Y. example: ``` Sun -> Mint-Y-Sun, Mint-Y-Darker-Sun, Mint-Y-Dark-Sun Sun-Alt -> Mint-Y-Sun-Alt, Mint-Y-Darker-Sun-Alt, Mint-Y-Dark-Sun-Alt ``` -Open `autobuild-themes.py` and add line(s) inside `THEMES` dictionary variable. example: +Open `themes.json` and add/replace line(s) with theme definitions. example: ``` -THEMES = { - 'Numix': {'light': 'd64937', 'dark': 'd64937'}, +{ + "Smoke": {"light": "A1A1A1", "dark": "A1A1A1"}, + "Majestic": {"light": "5F5F5F", "dark": "5F5F5F"} } ``` +Last line must NOT have `,` at the end! #### 3. Build theme(s) -Build all themes defined in `THEMES` dictionary variable: +Build all themes defined in `themes.json`: ``` ./autobuild-themes.py ``` @@ -85,6 +83,10 @@ If you cant find theme you want to uninstall in this folder, it could be install # F A Q +#### Can scripts put created themes somewhere else than `~/.themes`? +``` +./autobuild-themes.py TARGET_DIR +``` #### I want icons on the toolbar to be white like on the pictures! @@ -141,6 +143,7 @@ This is the original Mint-Y-Dark theme with all the little green accents. # Mint-Y-Colora themes on Linux Mint 18.2 +note: These pictures are relatively old # Mint-Y-Alu diff --git a/autobuild-themes.py b/autobuild-themes.py index 44f57c3..89d956a 100755 --- a/autobuild-themes.py +++ b/autobuild-themes.py @@ -2,55 +2,33 @@ # coding: utf-8 import sys, os +import json -########################## -# FEEL FREE TO EDIT THIS # -########################## -THEMES = { - 'Smoke': {'light': 'A1A1A1', 'dark': 'A1A1A1'}, - 'Majestic': {'light': '5F5F5F', 'dark': '5F5F5F'}, - 'Numix': {'light': 'd64937', 'dark': 'd64937'}, - 'Numix-Orange': {'light': 'FFA726', 'dark': 'FFA726'}, -} - -#################### -# DO NOT EDIT THIS # -#################### -REPLACE_START = '# !!!COLOR_REPLACE_START!!!' -REPLACE_END = '# !!!COLOR_REPLACE_END!!!\n' -REPLACE_STRING = '''{} -personallightcolour={} -personaldarkcolour={} -{}''' +# load theme definitions +THEMES = {} +with open("themes.json", "r") as f: + THEMES = json.loads(f.read()) + +# get installation destination +TARGET = "" if (len(sys.argv) == 1) else sys.argv[1] # change working directory to directory of this file os.chdir(os.path.dirname(os.path.abspath(__file__))) for tname in THEMES: print('Processing theme: {}'.format(tname)) - - # Replace colors in script - with open('1-change-color.sh', 'r') as f: - data = f.read() - header = data.split(REPLACE_START)[0] - footer = data.split(REPLACE_END)[-1] - - new_colors = REPLACE_STRING.format( - REPLACE_START, - THEMES[tname]['light'], - THEMES[tname]['dark'], - REPLACE_END - ) - with open('1-change-color-updated.sh', 'w') as f: - f.write(header + new_colors + footer) - os.system('chmod +x 1-change-color-updated.sh') - - # Build theme + + if (THEMES[tname]['light'] is None) or (THEMES[tname]['dark'] is None): + print("Theme has empty/bad definition, skipping!") + continue + os.system('git checkout -- src && rm -rf usr') - os.system('./1-change-color-updated.sh') + os.system('./1-change-color.sh {} {}'.format(THEMES[tname]['light'], THEMES[tname]['dark'])) os.system('./2-delete-assets.sh') os.system('./3-make-assets.sh') - os.system('./4-moving-the-themes.sh {}'.format(tname)) - + if TARGET == "": + os.system('./4-moving-the-themes.sh {}'.format(tname)) + else: + os.system('./4-moving-the-themes.sh {} "{}"'.format(tname, TARGET)) diff --git a/themes.json b/themes.json new file mode 100644 index 0000000..99f0da1 --- /dev/null +++ b/themes.json @@ -0,0 +1,34 @@ +{ + "Numix": {"light": "d64937", "dark": "d64937"}, + + + "Alu": {"light": "8d8d8d", "dark": "747474"}, + "Arc": {"light": "6ba4e7", "dark": "3f89e0"}, + "Arch": {"light": "45a8da", "dark": "81a65b"}, + "Casablanca": {"light": "FDB95B", "dark": "FDB95B"}, + "Crimson": {"light": "fd424d", "dark": "fc101d"}, + "Evopop": {"light": "1685a6", "dark": "106179"}, + "Faba": {"light": "D7CBDC", "dark": "81a65b"}, + "Fire": {"light": "bb2f2f", "dark": "81a65b"}, + "Froly": {"light": "fd7980", "dark": "fd7980"}, + "Havelock": {"light": "5491d6", "dark": "5491d6"}, + "Hibiscus": {"light": "851042", "dark": "851042"}, + "Lightning": {"light": "ffb851", "dark": "81a65b"}, + "Majestic": {"light": "5F5F5F", "dark": "5F5F5F"}, + "Mandy": {"light": "C93648", "dark": "C93648"}, + "Matrix": {"light": "3d7440", "dark": "2b532e"}, + "Moka": {"light": "e1d5e5", "dark": "e1d5e5"}, + "Numix-Orange": {"light": "FFA726", "dark": "FFA726"}, + "Oranchelo": {"light": "41aacc", "dark": "2e8dac"}, + "Orange": {"light": "EF7E2C", "dark": "EF7E2C"}, + "Paper": {"light": "90a4ae", "dark": "738c98"}, + "Polo": {"light": "688BC6", "dark": "688BC6"}, + "Smoke": {"light": "A1A1A1", "dark": "A1A1A1"}, + "Sun": {"light": "ef7e2c", "dark": "d86410"}, + "Tacao": {"light": "EFA369", "dark": "EFA369"}, + "Violet": {"light": "7A70FF", "dark": "7A70FF"}, + "Watusi": {"light": "1080e4", "dark": "1080e4"} +} + + +