forked from ice1000/NppExtension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
light_versions.pl
29 lines (23 loc) · 996 Bytes
/
light_versions.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl
# Notes:
# For windows users you can run this file in git-bash directly as an executable file
# or use `perl light_versions.pl`, don't install perl if you have git-bash.
# For linux users you simply install perl5 and run this file the in the same way as
# windows users do in their git-bash.
use strict;
use warnings FATAL => 'all';
$|++;
foreach my $filePath (@ARGV) {
open my $file, '<', $filePath or die "Failed to open $filePath: $!\n";
my $outPath = $filePath =~ s/([^\.]+)\.xml$/$1-light.xml/r;
open my $out, '>', $outPath or die "Failed to open $outPath: $!\n";
# https://stackoverflow.com/a/50089592/7083401
while ($_ = <$file>) {
my $line = s/bgColor="2B2B2B"/bgColor="FFFFFF"/gr
=~ s/fgColor="CC7832"/fgColor="0000FF"/gr
=~ s/fgColor="A9B7C6"/fgColor="000000"/gr;
print $out $line;
}
close $file or die "Failed to close $filePath: $!\n";
close $out or die "Failed to close $outPath: $!\n";
}