Welcome to Centmin Mod Community
Register Now

Change colors for every file?

Discussion in 'Feature Requests & Suggestions' started by deschlong, Jul 11, 2018.

  1. deschlong

    deschlong New Member

    15
    4
    3
    Mar 1, 2018
    Ratings:
    +6
    Local Time:
    10:33 PM
    1.15
    10.1
    Hello,

    I played a bit around with the colors and was wondering if its possible to change it for everyfile which is getting 'called'.

    I have a dark background on babun/cmder and the colors looking a bit off, so I changed some color codes for the centmin.sh, here is what it looks like:

    Screenshot_1.png

    The top part doesnt have it changed, the menu is changed.

    It is basically change it from:

    Code:
    black='\E[30;40m'
    red='\E[31;40m'
    green='\E[32;40m'
    yellow='\E[33;40m'
    blue='\E[34;40m'
    magenta='\E[35;40m'
    cyan='\E[36;40m'
    white='\E[37;40m'
    
    To:

    Code:
    black='\E[30m'
    red='\E[31m'
    green='\E[32m'
    yellow='\E[33m'
    blue='\E[34m'
    magenta='\E[35m'
    cyan='\E[36m'
    white='\E[37m'
    
    So, remove the
    Code:
    ;40
    
    Is it possible to write a little script which will change it everywhere? Because I assume when CMM updates it will go back to default, so after a updated I could execute the 'color changer'.

    Thanks!

    Edit:

    Alright, I think it should be something like this:
    Code:
    #!/bin/bash
    
    PATTERN=';40m'
    TPATH='/usr/local/src/centminmod/tools'
    
    if grep -q $PATTERN $TPATH/*;
            then
                    sed -i 's/;40m/m/g' $TPATH/*.sh
            else
                    echo "Nope, skipping..."
    fi
    
    And of course for every other path
     
    Last edited: Jul 11, 2018
  2. eva2000

    eva2000 Administrator Staff Member

    35,099
    7,748
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,948
    Local Time:
    6:33 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    will see what I can come up with :)
     
    • Winner Winner x 1
  3. eva2000

    eva2000 Administrator Staff Member

    35,099
    7,748
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,948
    Local Time:
    6:33 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    with those changed colour codes i am not able to reproduce your colours probably due to my SSH terminal settings so can't be sure this one liner command works for your.. if it doesn't work you'd need to reset the entire code back via git stash command loosing all your custom changes in the code

    3 commands to backup your version of /usr/local/src/centminmod, switch into centmin mod directory and run find and replace
    Code (Text):
    cp -a /usr/local/src/centminmod /usr/local/src/centminmod-backup
    cd /usr/local/src/centminmod
    find . -type f \( -name '*.inc' -o -name '*.sh' \) -print | while read f; do echo $f; sed -i 's|\\E\[30;40m|\\E\[30m|' $f; sed -i 's|\\E\[31;40m|\\E\[31m|' $f; sed -i 's|\\E\[32;40m|\\E\[32m|' $f; sed -i 's|\\E\[33;40m|\\E\[33m|' $f; sed -i 's|\\E\[34;40m|\\E\[34m|' $f; sed -i 's|\\E\[35;40m|\\E\[35m|' $f; sed -i 's|\\E\[36;40m|\\E\[36m|' $f; sed -i 's|\\E\[37;40m|\\E\[37m|' $f; done
    

    if doesn't work run git stash to revert to defaults
    Code (Text):
    cd /usr/local/src/centminmod
    git stash
    
     
    • Winner Winner x 1
  4. deschlong

    deschlong New Member

    15
    4
    3
    Mar 1, 2018
    Ratings:
    +6
    Local Time:
    10:33 PM
    1.15
    10.1
    Somehow your script didnt work for all color codes I guess?

    But this one does:

    Code:
        cp -a /usr/local/src/centminmod /usr/local/src/centminmod-backup
        find /usr/local/src/centminmod -type f \( -name '*.inc' -o -name '*.sh' \) -print | while read f; do
            echo $f
            sed -i 's/;40m/m/g' $f
        done
    
    Looks much better :)

    Screenshot_3.png
     
    Last edited: Jul 11, 2018
    • Informative Informative x 1
  5. eva2000

    eva2000 Administrator Staff Member

    35,099
    7,748
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,948
    Local Time:
    6:33 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    strange i tried that exact same sed before on mine and didn't work for me just because grey text on black background for me heh. Glad to hear it works for you
     
  6. deschlong

    deschlong New Member

    15
    4
    3
    Mar 1, 2018
    Ratings:
    +6
    Local Time:
    10:33 PM
    1.15
    10.1
    Looks also good with other clients:

    Kitty/Putty:
    kitty.png

    MobaXTerm:
    mobaxterm.png

    Ubuntu:
    ubuntu.png
     
    • Like Like x 1
..