Skip to content

Commit

Permalink
Update tools #343
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartFinn committed Feb 19, 2017
1 parent f035d07 commit 7be6f91
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
20 changes: 18 additions & 2 deletions tools/_fix_color_scheme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

set -e

# Papirus and Papirus-Light
add_class() {
# add the class if a value matches:
sed -i -r \
Expand All @@ -32,6 +33,7 @@ add_class() {
"$@"
}

# Papirus-Dark
add_class_dark() {
# add the class if a value matches:
sed -i -r \
Expand All @@ -40,6 +42,16 @@ add_class_dark() {
"$@"
}

# ePapirus
add_class_e() {
# add the class if a value matches:
sed -i -r \
-e '/([^-]color|fill|stop-color|stroke):#6e6e6e/I s/(style="\S+")/\1 class="ColorScheme-Text"/' \
-e '/([^-]color|fill|stop-color|stroke):#5294e2/I s/(style="\S+")/\1 class="ColorScheme-Highlight"/' \
-e '/([^-]color|fill|stop-color|stroke):#ffffff/I s/(style="\S+")/\1 class="ColorScheme-ButtonBackground"/' \
"$@"
}

fix_color_and_fill() {
# if class exist:
# - remove color
Expand All @@ -62,11 +74,15 @@ for file in "$@"; do
fix_color_and_fill "$file"

if grep -q -i '#5c616c' "$file"; then
# is Papirus
# it is Papirus or Papirus-Light
add_class "$file"
fix_color_and_fill "$file"
elif grep -q -i '#6e6e6e' "$file"; then
# it is ePapirus
add_class_e "$file"
fix_color_and_fill "$file"
else
# is Papirus-Dark
# it is Papirus-Dark
add_class_dark "$file"
fix_color_and_fill "$file"
fi
Expand Down
4 changes: 3 additions & 1 deletion tools/work/convert-to-dark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ done

# convert color scheme
find "$_PAPIRUS_DARK_DIR" -type f -name '*.svg' -exec sed -i \
-e 's/#5c616c/#d3dae3/I' '{}' \;
-e 's/class="ColorScheme-ButtonBackground"/class="ColorScheme-Text"/I' \
-e 's/\s*\.ColorScheme-ButtonBackground.\+\}//I' \
-e 's/#5c616c/#d3dae3/gI' '{}' \;
4 changes: 2 additions & 2 deletions tools/work/convert-to-e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ done

# convert color scheme
find "$_EPAPIRUS_DIR" -type f -name '*.svg' -exec sed -i \
-e 's/#5c616c/#6e6e6e/I' \
-e 's/#d3dae3/#ffffff/I' '{}' \;
-e 's/#5c616c/#6e6e6e/gI' \
-e 's/#d3dae3/#ffffff/gI' '{}' \;
4 changes: 3 additions & 1 deletion tools/work/convert-to-light.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ done

# convert color scheme
find "$_PAPIRUS_LIGHT_DIR" -type f -name '*.svg' -exec sed -i \
-e 's/#d3dae3/#5c616c/I' '{}' \;
-e 's/class="ColorScheme-ButtonBackground"/class="ColorScheme-Text"/I' \
-e 's/\s*\.ColorScheme-ButtonBackground.\+\}//I' \
-e 's/#d3dae3/#5c616c/gI' '{}' \;

0 comments on commit 7be6f91

Please sign in to comment.