1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Get text color

Discussion in 'Development' started by #A6543, Jan 27, 2017.

  1. #A6543

    #A6543 Zombie

    Messages:
    267
    How can I get the color of a variable like $name?
     
  2. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    please provide started code for us to better assist you
     
  3. #A6543

    #A6543 Zombie

    Messages:
    267
    ...
    PHP:
    $name $player->getNameTag();
    If(
    $name == /*green*/) {}
     
  4. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    use this:
    PHP:
    if(strpos($player->getNameTag(), TextFormat::COLOR)) { #replace COLOR with the needed color
      #do whatever
    }
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.