diff options
author | Johan FitiƩ <jfitie@gmail.com> | 2020-06-24 04:45:39 +0000 |
---|---|---|
committer | Johan FitiƩ <jfitie@gmail.com> | 2020-06-24 04:45:39 +0000 |
commit | d420bcca0a9df3f8dafe3e595f273d21f220eb2a (patch) | |
tree | a8dcdc3db5aa743c56f24b6133f987ff9a8599b4 | |
parent | 69704b63a2059a6b56072026fe2282268545691f (diff) | |
download | navit-betterdarkcolors.tar.gz |
Small script cleanupsbetterdarkcolors
-rwxr-xr-x | navit/navit_layout_car_generatedarkxml.sh | 25 |
1 files 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/(<text )/\1color=\"#$defcol\" background_color=\"#000000\" /") # Add text color - l=$(echo $l | sed -r "s/(<circle color=\"#[0-9a-fA-F]{6,8}\" )/\1background_color=\"#$defcol\" /") # Add circle bg color + l=$(echo $l | sed -r "s/(<text )/\1color=\"#$textcolor\" background_color=\"#000000\" /") # Add text color + l=$(echo $l | sed -r "s/(<circle color=\"#[0-9a-fA-F]{6,8}\" )/\1background_color=\"#$textcolor\" /") # Add circle bg color echo $l >> $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 |