X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=tools%2Fgen-styles;h=d158d8bf370e227e5b9894c9a39b8c02558006dd;hp=19c420a45476a30ee32fa51c1733049df61a0fea;hb=c3d401c2ce5137fd8c3e8f4bf3b71b21dc881ccb;hpb=ee37227040bef9cae98cce2aada288c3a55b9781 diff --git a/tools/gen-styles b/tools/gen-styles index 19c420a4..d158d8bf 100644 --- a/tools/gen-styles +++ b/tools/gen-styles @@ -140,8 +140,10 @@ warn sprintf( 's%1.3f, l%1.3f -> %s', my $baseTheme = "AppTheme.NoActionBar"; +use constant STEP_DEGREES => 15; + # # hsb -# for( my $hue = 0; $hue < 360; $hue += 15 ) { +# for( my $hue = 0; $hue < 360; $hue += STEP_DEGREES ) { # printf "\n"; + $result .= "$baseIndent\n"; return $result; } @@ -226,16 +232,18 @@ if ($xml) { my $end_marker = ''; my ($fh, $filename) = tempfile(basename($0).'.XXXXXXXX', DIR => dirname($xml)); open(my $in, '<', $xml); + my $base_indent = ''; my $state = 'waiting-for-start-marker'; while (<$in>) { if ( $state eq 'waiting-for-start-marker' ) { print $fh $_; - $state = 'skipping-styles' if /^\s*\Q$start_marker\E/; + $state = 'skipping-styles', $base_indent = $1 + if /^(\s*)\Q$start_marker\E/; next; } if ( $state eq 'skipping-styles' ) { next unless /^\s*\Q$end_marker\E/; - outputThemes($fh); + outputThemes($fh, $base_indent); print $fh $_; $state = 'copying-the-rest'; next;