Function coloured_strings::colour

source ·
pub fn colour(text: &str, colour: &str) -> String
Expand description

This function takes the &str, then calls the “colourise” function to convert it into a coloured string.


Examples

colour("this is a black string", "black");
colour("this is a underlined string", "u");

Available Colours

   // normal colours
    "black" | "b"
    "red" | "r"
    "green" | "g"
    "yellow" | "y"
    "blue" | "bl"
    "magenta" | "m"
    "cyan" | "c"
    "white"| "w"
     
    // bright colours
    "brightblack" | "bb" 
    "brightred" | "br"   
    "brightgreen" | "bg"   
    "brightyellow" | "by"  
    "brightblue" | "bbl" 
    "brightmagenta" | "bm"  
    "brightcyan" | "bc"  
    "brightwhite" | "bw"  
     
    //background colours
    "backgroundred" | "b-r"   
    "backgroundgreen" | "b-g"  
    "backgroundyellow" | "b-y"  
    "backgroundblue" | "b-b"  
    "backgroundmagenta" | "b-m"  
    "backgroundcyan" | "b-c"  
    "bacgroundwhite" | "b-w" 
        
    //bright background colours
    "backgroundbrightblack" | "b-bb" 
    "backgroundbrightred" | "b-br" 
    "backgroundbrightgreen" | "b-bg" 
    "backgroundbrightyellow" | "b-by"  
    "backgroundbrightblue" | "b-bbl"  
    "backgroundbrightmagenta" | "b-bm"  
    "backgroundbrightcyan" | "b-bc"  
    "backgroundbrightwhite" | "b-bw"  

   // other styles
    "clear" | "cl"  
    "dimmed" | "d"   
    "italic" | "i"   
    "underline" | "u"  
    "blink" | "bli"   
    "reversed" | "re"   
    "hidden" | "h"  
    "strikethrough" | "s"