My poor eyes suffer from white backgrounds. So i wrote a tiny perl script to reverse colors ! I had no further adaptations to make, it seems to work for many file types !!!
USAGE:
perl darkstyler.pl < stylers.xml > stylers.xml_dark mv stylers.xml stylers.xml_ori cp stylers.xml_dark stylers.xml
==================
#!/bin/perl
sub hpoids { $_[0]=~/(..)(..)(..)/; return hex($1)+hex($2)+hex($3); } sub hrev { $_[0]=~/(..)(..)(..)/; return sprintf("%02X%02X%02X",255-hex $1,255-hex $2,255-hex $3) }
while(<>) { unless (/fgColor="([^"]+)" bgColor="([^"]+)"/) { print; next } $fg=$1; $bg=$2;
# invert color levels #if (hpoids($bg)>384) { $fg=hrev $fg; $bg=hrev $bg } else { print; next } $fg=hrev $fg; $bg=hrev $bg; # main color $fg='FFFF00' if $fg eq 'FFFFFF';
s/fgColor="([^"]+)" bgColor="([^"]+)"/fgColor="$fg" bgColor="$bg"/; print; }
My poor eyes suffer from white backgrounds.
So i wrote a tiny perl script to reverse colors !
I had no further adaptations to make, it seems to work
for many file types !!!
USAGE:
perl darkstyler.pl < stylers.xml > stylers.xml_dark
mv stylers.xml stylers.xml_ori
cp stylers.xml_dark stylers.xml
==================
#!/bin/perl
sub hpoids { $_[0]=~/(..)(..)(..)/; return hex($1)+hex($2)+hex($3); }
sub hrev { $_[0]=~/(..)(..)(..)/; return sprintf("%02X%02X%02X",255-hex $1,255-hex $2,255-hex $3) }
while(<>) {
unless (/fgColor="([^"]+)" bgColor="([^"]+)"/) { print; next }
$fg=$1; $bg=$2;
# invert color levels
#if (hpoids($bg)>384) { $fg=hrev $fg; $bg=hrev $bg } else { print; next }
$fg=hrev $fg; $bg=hrev $bg;
# main color
$fg='FFFF00' if $fg eq 'FFFFFF';
s/fgColor="([^"]+)" bgColor="([^"]+)"/fgColor="$fg" bgColor="$bg"/;
print;
}