From ef8b9ae8901178cdb521dcc6dcc55abbbf09e693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Fiti=C3=A9?= Date: Sun, 21 Jun 2020 21:30:54 +0200 Subject: improvement:layout: Improve Car Dark layout colors, bring all layers up to date with Car Light, automate changes in all layers with script (#1026) * Improve Car Dark layout colors, bring all layers up to date with Car Light, automate changes in all layers with script * Icon colors * CodeFactor hates cats ... * Comment --- navit/navit_layout_car_dark_shipped.xml | 1005 ++++++++++++++++++----------- navit/navit_layout_car_generatedarkxml.sh | 121 ++-- navit/navit_layout_car_shipped.xml | 17 +- 3 files changed, 719 insertions(+), 424 deletions(-) diff --git a/navit/navit_layout_car_dark_shipped.xml b/navit/navit_layout_car_dark_shipped.xml index f858078ea..1c8ef041c 100644 --- a/navit/navit_layout_car_dark_shipped.xml +++ b/navit/navit_layout_car_dark_shipped.xml @@ -66,16 +66,15 @@ + - @@ -541,716 +540,988 @@ - - + + - - + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - - - + + + - - - + + + - - - + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + + + + + - - + + + + + + + + + + + + + + + + + - - + + - - + + - - - - - + + - - - - - + + - + + - - + + - - + + - - + + - - + + + - - + + + - - + + + - - + + + - - + + + - + + - + + - + + - + + - + + + - + + + - + + + - + + + - + + + - + + - + + - + + - + + + - + + + - + + + - + + + - + + - + + - + + - + + - + + + - + + + - + + + - + + + - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + + - - + + + + - - + + + + - - + + + + - - + + + + - - + + - - + + + - + + - + + - + + - + + - + + - + + + - + + + - + + + - + + + - + + + - + - - - + + - - + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - - + + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1260,46 +1531,46 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1312,7 +1583,7 @@ - + @@ -1321,12 +1592,12 @@ - - - + + + @@ -1336,6 +1607,9 @@ + + + @@ -1360,12 +1634,6 @@ - - @@ -1507,6 +1775,9 @@ + + + @@ -1535,7 +1806,7 @@ - + @@ -1595,19 +1866,19 @@ - - + + - - + + - + - - + + @@ -1681,9 +1952,6 @@ - - - @@ -1708,9 +1976,6 @@ - - - @@ -1756,10 +2021,16 @@ + + + + + + - + @@ -1772,6 +2043,9 @@ + + + @@ -1781,6 +2055,9 @@ + + + @@ -1805,10 +2082,16 @@ + + + - - + + + + + diff --git a/navit/navit_layout_car_generatedarkxml.sh b/navit/navit_layout_car_generatedarkxml.sh index 9c3aa70ca..16a6ce04b 100755 --- a/navit/navit_layout_car_generatedarkxml.sh +++ b/navit/navit_layout_car_generatedarkxml.sh @@ -1,6 +1,6 @@ #!/bin/bash -# This script automatically converts the rgb colors used for the polygons in the +# This script automatically converts the rgb colors used for the layers in # navit_layout_car_shipped.xml to the values appropriate for the dark layout in # navit_layout_car_dark_shipped.xml. # It's a bit of a mess, but gets the job done. @@ -14,78 +14,91 @@ ifd=navit_layout_car_dark_shipped.xml # Temporary dark output file ofd=$ifd.new -# Create new temporary dark output file -[ -f $ofd ] && rm -f $ofd -touch $ofd +# Iterate over all layers in dark input file +grep \.* ]]; then - inpolygons=true - getpolygons=true - fi + # Init: not in layer + inlayer=false + getlayer=false - # Check to see if inside polygons layer - close tag - if [[ $l =~ .*\.* ]]; then - inpolygons=false - fi + # Read dark input file + while read -r l + do - # Trigger once when polygons open tag found in dark input file - if [ $getpolygons == true ]; then + # Check to see if inside layer - open tag + if [[ $l =~ .*\.* ]]; then + inlayer=true + getlayer=true + fi - getpolygons=false # Just triggered - inpolygons=false # Now used for light input file + # Check to see if inside layer - close tag + if [[ $l =~ .*\.* ]]; then + inlayer=false + fi - # Insert data from light input file - while read -r l - do + # Trigger once when open tag found in dark input file + if [ $getlayer == true ]; then - # Check to see if inside polygons layer - if [[ $l =~ .*\.* ]]; then - inpolygons=true - fi + getlayer=false # Just triggered + inlayer=false # Now used for light input file - if [[ $l =~ .*\.* ]]; then - inpolygons=false - fi + # Insert data from light input file + while read -r l + do - # Inside polygons layer - if [ $inpolygons == true ]; then + # Check to see if inside layer - open tag + if [[ $l =~ .*\.* ]]; then + inlayer=true + fi - 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 - cold=$( printf '%02x' $(echo $(printf "%d" 0x${coll:0:2})/16+16 | bc)) - cold=$cold$(printf '%02x' $(echo $(printf "%d" 0x${coll:2:2})/10+14 | bc)) - cold=$cold$(printf '%02x' $(echo $(printf "%d" 0x${coll:4:2})/8+12 | bc)) - l=$(echo $l | sed "s/#$coll/#$cold/") # Replace color + # Check to see if inside layer - close tag + if [[ $l =~ .*\.* ]]; then + inlayer=false fi - l=$(echo $l | sed "s/> $ofd # (Modified) line from light input file to dark output file + # 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 + cold=$( printf '%02x' $(echo $(printf "%d" 0x${coll:0:2})/16+16 | bc)) + cold=$cold$(printf '%02x' $(echo $(printf "%d" 0x${coll:2:2})/10+14 | bc)) + cold=$cold$(printf '%02x' $(echo $(printf "%d" 0x${coll:4:2})/8+12 | bc)) + l=$(echo $l | sed "s/#$coll/#$cold/") # Replace color + fi - fi + # Misc. 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 - done < $ifl # Read light input file - inpolygons=true # Done inserting, still in polygons layer in dark input file + else - else + # Outside layer + if [ $inlayer == false ]; then + echo $l >> $ofd # Just copy as-is to dark output file + fi - # Outside polygons layer - if [ $inpolygons == false ]; then - echo $l >> $ofd # Just copy as-is to dark output file fi - fi + done < $ifd # Read dark input file -done < $ifd # Read dark input file + cp $ofd $ifd # Replace + rm -f $ofd # Clean up -cp $ofd $ifd # Replace -rm -f $ofd # Clean up +done # Next layer in dark input file diff --git a/navit/navit_layout_car_shipped.xml b/navit/navit_layout_car_shipped.xml index 064bc2dbc..0603fc40f 100644 --- a/navit/navit_layout_car_shipped.xml +++ b/navit/navit_layout_car_shipped.xml @@ -66,16 +66,15 @@ + - -- cgit v1.2.1