src/Clio/Styling/Style.php
public function initialize(TerminalStateInterface $state) {
        
        // both bold and underscore will have a value of true or false (not undefined
        $this->setBold($state->isBold());
        $this->setUnderscore($state->isUnderscore());
        
        // for colors, if the color is not valid, then it will stay undefined in this context
        
        // get the text color
        $textColor = $state->getTextColor();
        
        // if the text color is valid
        if ($textColor->isValid()) {
            
            // set it 
            $this->setTextColor($textColor);
        
        } else {
            
            // the text color is not valid, null out the text color
            $this->setTextColor(null);
        }
        
        // get the fill color
        $fillColor = $state->getFillColor();
        
        // if the fill color is valid
        if ($fillColor->isValid()) {
            
            // set it
            $this->setFillColor($fillColor);
            
        } else {

            // the fill color is not valid, null out the fill color
            $this->setFillColor(null);
        }
        
        // chaining
        return $this;
        
        
    }
public function initialize(TerminalStateInterface $state) {
        
        // both bold and underscore will have a value of true or false (not undefined
        $this->setBold($state->isBold());
        $this->setUnderscore($state->isUnderscore());
        
        // for colors, if the color is not valid, then it will stay undefined in this context
        
        // get the text color
        $textColor = $state->getTextColor();
        
        // if the text color is valid
        if ($textColor->isValid()) {
            
            // set it 
            $this->setTextColor($textColor);
        
        } else {
            
            // the text color is not valid, null out the text color
            $this->setTextColor(null);
        }
        
        // get the fill color
        $fillColor = $state->getFillColor();
        
        // if the fill color is valid
        if ($fillColor->isValid()) {
            
            // set it
            $this->setFillColor($fillColor);
            
        } else {

            // the fill color is not valid, null out the fill color
            $this->setFillColor(null);
        }
        
        // chaining
        return $this;
        
        
    }
Initialize a style to the state of a terminal

@param TerminalStateInterface $state
@return $this