Tagged: OLED dark mode
Viewing 2 posts - 1 through 2 (of 2 total)
- AuthorPosts
- January 28, 2022 at 13:02 #47104RandyParticipant
Hallo,
Ich wollte gerne ein dunkles, OLED freundliches Theme für mein Smartphone. Ich hab eins online gefunden aber es funktioniert nicht mit V5.
Elevate ist ein tolles Theme, es gefällt mir sehr gut. Also habe ich ein kleines Perl Script geschrieben, um Elevate (oder andere Themes??) in den “dark mode” zu versetzen. Vielleicht ist es für den einen oder anderen auch nützlich. Das ganze ist sehr quick and dirty aber ich bin mit dem Ergebnis ganz zufrieden. Man könnte auch einfach die Regex in Notepad++ mit search and replace verwenden und das gleiche erreichen mit etwas mehr Aufwand ohne das Script.Vielen Dank für Elevate!!!
#!/usr/bin/perl use String::Substitution -copy; #https://stackoverflow.com/questions/392643/ #Example usage: perl thiscript.pl "themefilename.xml" #The script will create a file "themefilename_BLACK.xml" if (!$ARGV[0]){die "No input file specified"} open INF, "$ARGV[0]" or die $!; my @theme = <INF>; close INF; my @reps = ( ['<area.*?\/p_.*?>', ''], ['<area(.*?)fill="#.*?"(.*?)', '<area$1fill="#000000"$2'], ['map-background="#.*?"', 'map-background="#000000"'], ['map-background-outside="#.*?"', 'map-background-outside="#000000"'], ['<pathText(.*?)fill="#.*?"(.*?)', '<pathText$1fill="#FFFFFF"$2'], ['<pathText(.*?)stroke="#.*?"(.*?)', '<pathText$1stroke="#000000"$2'], ['<caption(.*?)fill="#.*?"(.*?)', '<caption$1fill="#FFFFFF"$2'], ['<caption(.*?)stroke="#.*?"(.*?)', '<caption$1stroke="#000000"$2'], ['<rule e="way"(.*?)k="contour_ext"(.*?)v="elevation_(.*?)', '<rule e="way"$1k="disable"$2v="elevation_$3'], ['<rule e="way"(.*?)k="building"(.*?)v="yes(.*?)', '<rule e="way"$1k="disable"$2v="yes$3'] ); my $repc = scalar(@reps) - 1; my $linec = scalar(@theme) - 1; my @out; my $outc; for (my $x=0; $x <= $linec; $x++){ $out[$outc] = $theme[$x]; for (my $y=0; $y <= $repc; $y++){ if ($out[$outc] =~ $reps[$y][0]){ $out[$outc] = gsub($out[$outc], $reps[$y][0], $reps[$y][1]); } } $outc++; } my $outfile; if ($ARGV[0] =~ /(.*)\./){ $outfile = $1 . "_BLACK.xml"; } else {die "Something is wrong with the file name."} print "Writing: $outfile\n"; open OUTF, ">$outfile" or die $!; print OUTF @out; close INF;
Liebe Grüße,
Randy2 users thanked author for this post.
January 29, 2022 at 08:48 #47125ChristianKKeymasterHey, super,
diese Perl-Lib kannte ich noch nicht…
LG, Christian
- AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.