From d420bcca0a9df3f8dafe3e595f273d21f220eb2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Fiti=C3=A9?= Date: Wed, 24 Jun 2020 04:45:39 +0000 Subject: Small script cleanups --- navit/navit_layout_car_generatedarkxml.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/navit/navit_layout_car_generatedarkxml.sh b/navit/navit_layout_car_generatedarkxml.sh index dc87a7855..7b659b20d 100755 --- a/navit/navit_layout_car_generatedarkxml.sh +++ b/navit/navit_layout_car_generatedarkxml.sh @@ -6,7 +6,7 @@ # It's a bit of a mess, but gets the job done. # Variables -defcol='55c4bd' +textcolor='55c4bd' # Settings IFS='' # Keep whitespace @@ -72,32 +72,41 @@ do # Modify color if [[ $l =~ .*color=\"#[0-9a-fA-F]{6}.* ]]; then # Contains rgb(a) color - coll=$(echo $l | cut -d# -f2 | cut -c-6) # Get rgb color and convert + + # Get hexadecimal color + coll=$(echo $l | cut -d# -f2 | cut -c-6) + # Get color values in decimal cr=$(printf "%d" 0x${coll:0:2}) cg=$(printf "%d" 0x${coll:2:2}) cb=$(printf "%d" 0x${coll:4:2}) - # Modify color values + + # Modify decimal color values crn=$(echo $cr/16+$cg/32+$cb/32+16 | bc) cgn=$(echo $cr/24+$cg/12+$cb/24+12 | bc) cbn=$(echo $cr/16+$cg/16+$cb/ 8+ 8 | bc) - # Convert new color values to hex + + # Convert new decimal color values to hexadecimal cold=$( printf '%02x' $crn) cold=$cold$(printf '%02x' $cgn) cold=$cold$(printf '%02x' $cbn) - l=$(echo $l | sed "s/#$coll/#$cold/") # Replace color + + # Replace old color with new hexadecimal color values + l=$(echo $l | sed "s/#$coll/#$cold/") + fi - # Misc. modifications + # Miscellaneous modifications l=$(echo $l | sed -r "s/_bk\./_wh\./") # Black to white icons - l=$(echo $l | sed -r "s/(> $ofd # Modified line from light input file to dark output file fi done < $ifl # Read light input file + inlayer=true # Done inserting, still in layer in dark input file else -- cgit v1.2.1