public TextCharacter withModifier ( SGR modifier ) { if ( modifiers . contains ( modifier ) ) { return this ; } EnumSet < SGR > newSet = EnumSet . copyOf ( this . modifiers ) ; newSet . add ( modifier ) ; return new TextCharacter ( character , foregroundColor , backgroundColor , newSet ) ; }
Returns a copy of this TextCharacter with an additional SGR modifier . All of the currently active SGR codes will be carried over to the copy in addition to the one specified .