[CentOS] Change bash colours like in VIM

Keith Roberts keith at karsites.net
Thu Aug 18 13:56:23 UTC 2011


On Thu, 18 Aug 2011, Marc Deop i Argemí wrote:

*snip*

> The best colourscheme for the eyes is a dark background with an even
> darker text color.
>
> And the worst would be dark background with light color for the text
> (although many "geeks" use that combination...)

I find the white background on some html manuals, like php 
and mysql give me a headache and eye strain after a while.

So for my local downloaded copy of php docs, Smarty docs, 
and MySQL docs I use these scripts to change the background 
colour for those html manuals:

#!/bin/bash

# bash script to change BGCOLOR on all mysql document 
# files in CWD
# this file needs to be in and run from the
# mysql html document directory

for file in *.html
do
     # display a listing of all files in CWD
     #ls -l "$file"

     # show progress of script
     echo "Processing $file";

     # -i sed option writes changes to current file being 
processed
     #
     # this changes BGCOLOR from white to a purple color
     # - choose your background color by editing #BC88FF
     # - to the hex color value of your choice
     sed -i s/bgcolor=\"white\"/bgcolor=\"\#C7E2FF\"/g 
"$file"
done
exit 0


and for the PHP manual I use a PHING project script to add
a stylesheet declaration to each html page:

<?xml version="1.0" ?>

<project name="adding stylesheet tag" default="main" 
basedir=".">

   <target name="main">

     <echo msg="adding stylesheet tag..." />

     <reflexive>
       <fileset dir=".">
         <include name="*.html" />

<!--
         <include name="**/*" />

         <exclude name="tmp-backups/**" />
         <exclude name="*.xml" />
         <exclude name="*.xml.bak" />
         <exclude name="**/*.xml" />
         <exclude name="**/*.xml.bak" />
-->

       </fileset>

       <filterchain>
         <replaceregexp>
           <regexp pattern="<head>"
                   replace="<head> <link rel="stylesheet" type="text/css" href="MY-style.css" />" />

         </replaceregexp>
       </filterchain>

     </reflexive>

   </target>

</project>


Plus you will need the stylesheet for the php manual in the 
/php-chunked-xhtml *.html docs directory:

# MY-style.css

body {
  background-color: #66CC33;
}

.phpcode {
  background-color: #CCFFFF;
  padding-top: 10px;
  padding-bottom: 10px;
  padding-left: 12px;
  width: auto;
}

and for the Smarty 2.6 html manual I use:

#!/bin/bash

# bash script to change BGCOLOR on all smarty document files in CWD
# this file needs to be in and run from the smarty document html directory

for file in *.html
do
     # display a listing of all files in CWD
     #ls -l "$file"

     # show progress of script
     echo "Processing $file";

     # -i sed option writes changes to current file being 
processed
     #
     # this changes BGCOLOR from white to a purple color
     # - choose your background color by editing #BC88FF
     # - to the hex color value of your choice
     sed -i s/bgcolor=\"white\"/bgcolor=\"\#C7E2FF\"/g 
"$file"
done 
exit 0


Kind Regards,

Keith Roberts

-----------------------------------------------------------------
Websites:
http://www.karsites.net
http://www.php-debuggers.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------


More information about the CentOS mailing list