1#!/usr/local/bin/bash 2# 3# This file is part of plata-theme 4# 5# Copyright (C) 2018-2020 Tista <tista.gma500@gmail.com> 6# 7# This program is free software; you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation; either version 2 of the License, or 10# (at your option) any later version. 11# 12 13SRC_LIGHT_FILE="./light/ColorDeck-light.cdk" 14SRC_DARK_FILE="./dark/ColorDeck-dark.cdk" 15COL_FILE="../../gtk/sass/common/_colors.scss" 16KEY_FILE="../../gtk/sass/common/resources/_key_colors.scss" 17 18# Default colours 19selection1="`grep 'Indigo500' $COL_FILE | \ 20 cut -d' ' -f3`" 21accent1="`grep 'Indigo300' $COL_FILE | \ 22 cut -d' ' -f3`" 23suggested1="`grep 'DPurple500' $COL_FILE | \ 24 cut -d' ' -f3`" 25 26# Check and re-color color-scheme 27if [ -e $KEY_FILE ]; then 28 selection2="`grep 'key_selection' $KEY_FILE | \ 29 cut -d' ' -f2 | cut -d';' -f1`" 30 accent2="`grep 'key_accent' $KEY_FILE | \ 31 cut -d' ' -f2 | cut -d';' -f1`" 32 suggested2="`grep 'key_suggestion' $KEY_FILE | \ 33 cut -d' ' -f2 | cut -d';' -f1`" 34 35 cp -f $SRC_LIGHT_FILE.in $SRC_LIGHT_FILE && \ 36 cp -f $SRC_DARK_FILE.in $SRC_DARK_FILE && sleep 1 37 38 if [ $selection1 != $selection2 ]; then 39 sed -i '' "s/$selection1/$selection2/gi" $SRC_LIGHT_FILE 40 sed -i '' "s/$selection1/$selection2/gi" $SRC_DARK_FILE 41 echo $selection1 is re-colored with $selection2. 42 fi 43 if [ $accent1 != $accent2 ]; then 44 sed -i '' "s/$accent1/$accent2/gi" $SRC_LIGHT_FILE 45 sed -i '' "s/$accent1/$accent2/gi" $SRC_DARK_FILE 46 echo $accent1 is re-colored with $accent2. 47 fi 48 if [ $suggested1 != $suggested2 ]; then 49 sed -i '' "s/$suggested1/$suggested2/gi" $SRC_LIGHT_FILE 50 sed -i '' "s/$suggested1/$suggested2/gi" $SRC_DARK_FILE 51 echo $suggested1 is re-colored with $suggested2. 52 fi 53else 54 echo ../../gtk/sass/common/resources/_key_colors.scss was not found. Stopped... 55 exit 1 56fi 57