merged templating on master

This commit is contained in:
Eudaimon 2022-07-14 12:47:12 +02:00
commit 71daf0b284
14 changed files with 184 additions and 90 deletions

View file

@ -1,13 +1,13 @@
#! /bin/bash
# This file contains a color scheme for Skewaita
# This file contains a color scheme for Skewaita GTK theme
# To use it, follow these steps:
# 1. execute process_variables <name of the color scheme file>
# (this processes templates to create somw files, which are then copyied to their respective source directory)
# 2. go up one directory, to source, and execute "./compile.sh light" or "./compile.sh dark" depending on whether the theme is light or dark
# 1. execute ./use_scheme.sh <this_file_name>
# (this processes templates to create some files, which are then copyied to their respective source directory)
# 2. go up one directory, to "source", and execute "./compile.sh light" or "./compile.sh dark" depending on whether the theme is light or dark
# Original Skweaita: light, with grayish tones and light green accents, VERY easy on the eyes
# Original Skewaita: light, with grayish tones and light green accents, VERY easy on the eyes
vwindow_fg="#241f31"
vwindow_bg="#a7a7a7"

View file

@ -0,0 +1,53 @@
#! /bin/bash
# This file contains a color scheme for Skewaita GTK theme
# To use it, follow these steps:
# 1. execute ./use_scheme.sh <this_file_name>
# (this processes templates to create some files, which are then copyied to their respective source directory)
# 2. go up one directory, to "source", and execute "./compile.sh light" or "./compile.sh dark" depending on whether the theme is light or dark
# Soil colors: dark gray, with green accents, readable and easy on the eyes
vwindow_fg="#c0c0c0"
vwindow_bg="#3f3e3e"
vtext_widget_fg="#b0b0b0"
vtext_widget_bg="#2d2c2c"
vselected_fg="#b5f08f"
vselected_bg="#669900"
vbutton_fg=$vtext_widget_fg
vbutton_bg="#343F37"
vbutton_checked_bg=$vselected_bg
vbutton_checked_fg=$vselected_fg
vdisabled_fg="#a14242"
vdisabled_bg="#482B2B"
# Usually an automatic fg color on these backgrounds should check this value!
vwarningc="#f57900"
verrorc="#CC0000"
vsuccessc="#33d17a"
vtitlebar_active_fg=$vselected_fg
vtitlebar_active_bg=$vselected_bg
vtitlebar_backdrop_fg=$vwindow_fg
vtitlebar_backdrop_bg=$vwindow_bg
vhint_fg="#5696c1"
vhint_bg="#25456e"
vosd_fg=$vhint_fg
vosd_bg=$vhint_bg
vlink_fg="#99c1f1"
vlink_visited_fg="#dc8add"
# export vwindow_fg vwindow_bg vtext_widget_fg vtext_widget_bg vselected_fg vselected_bg vbutton_fg vbutton_bg vbutton_checked_bg vbutton_checked_fg vdisabled_fg vdisabled_bg vwarningc verrorc vsuccessc vtitlebar_active_fg vtitlebar_active_bg vtitlebar_backdrop_fg vtitlebar_backdrop_bg vhint_fg vhint_bg vosd_fg vosd_bg vlink_fg vlink_visited_fg

View file

@ -1,24 +0,0 @@
#! /bin/bash
source variables.sh
# envsubst <_theme_colors.scss >theme_colors_.scss.processed # not working!
echo "Variables read; parsing files..."
for FILE in "_theme_colors.scss" "gtkrc" ; do
echo " processing $FILE..."
while read -r line ; do
while [[ "$line" =~ (\$\{[a-zA-Z_][a-zA-Z_0-9]*\}) ]] ; do
LHS=${BASH_REMATCH[1]}
RHS="$(eval echo "\"$LHS\"")"
line=${line//$LHS/$RHS}
done
echo "$line"
done < "$FILE" > "$FILE.processed"
done
echo "Done; copying processed files"
cp _theme_colors.scss.processed ../common/_theme_colors.scss
cp gtkrc.processed ../../gtk-2.0/gtkrc

56
source/templates/use_scheme.sh Executable file
View file

@ -0,0 +1,56 @@
#! /bin/bash
# exit when any command fails
set -e
usage () {
echo -e "\nUsage:"
echo -e $(basename "$0") "name_of_color_scheme_file.sh\n"
echo -e "Changes current color scheme for Skewaita, using the specified color scheme bash file."
echo -e "After this step, you need to rebuild the theme:"
echo -e 'go up one directory, to "source", and execute "./compile.sh light" or "./compile.sh dark" depending on whether the theme is light or dark\n'
}
# Check for correct parameters and the existence of color scheme file
if [[ $# -ne 1 ]]
then
usage
exit 1
fi
filename=$1
# if color scheme filename provided does not include .sh extension, add it
[[ "$filename" == *.sh ]] || filename="$filename.sh"
echo -e "\nReading color scheme from file '$filename'\n"
source $filename
# envsubst <_theme_colors.scss >theme_colors_.scss.processed # not working!
echo "New color scheme read; processing template files..."
for FILE in "_theme_colors.scss" "gtkrc" ; do
echo " processing $FILE..."
while read -r line ; do
while [[ "$line" =~ (\$\{[a-zA-Z_][a-zA-Z_0-9]*\}) ]] ; do
LHS=${BASH_REMATCH[1]}
RHS="$(eval echo "\"$LHS\"")"
line=${line//$LHS/$RHS}
done
echo "$line"
done < "$FILE" > "$FILE.processed"
done
echo "Done; copying processed files"
cp _theme_colors.scss.processed ../common/_theme_colors.scss
cp gtkrc.processed ../../gtk-2.0/gtkrc
echo -e "\nSUCCESS\n"
echo "Now you need to rebuild the theme:"
echo -e 'go up one directory, to "source", and execute "./compile.sh light" or "./compile.sh dark" depending on whether the theme is light or dark\n'