<commit_before># pixi-multistyle-text

[![NPM](https://nodei.co/npm/pixi-multistyle-text.png)](https://nodei.co/npm/pixi-multistyle-text/)

Add a `MultiStyleText` object inside [pixi.js](https://github.com/GoodBoyDigital/pixi.js) to easily create text using different styles.

## Example

In the example below, we are defining 4 text styles.
`def` is the default style for the text, and the others matches the tags inside the text.

```js
var textSample = new PIXI.MultiStyleText("<pixi>Pixi.js</pixi> can has <multiline>multiline</multiline>\nand <multistyle>multi-styles</multistyle> text!",
    {
        def: { font: "35px Snippet", fill: "white" },
        multiline: { font: "35px Snippet", fill: "blue" },
        pixi: { font: "35px Snippet", fill: "#D90057" },
        multistyle: { font: "35px Snippet", fill: "red" }
    }
);
```

## Usage

### `text = new PIXI.MultiStyleText(text, [globalStyle,] textStyles)`

Creates a new Multi-Styles Text with the given options

#### `globalStyle`
Type: `[Object]`

- `align` {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text. Default left.
- `wordWrap` {boolean} Indicates if word wrap should be used. Default false.
- `wordWrapWidth` {Number} The width at which text will wrap. Default 100.

#### `textStyles`
Type: `[String:Object]`

Each key of this dictionary should match with a tag in the text. Use the key `def` for the default style.

The style object can have these properties:

- `font` {string} The style and size of the font. Default bold 20pt Arial.
- `fill` {object} A canvas fillstyle that will be used on the text. Can be a color, a gradient, or a pattern. Default black.
- `stroke` {object} A canvas fillstyle that will be used on the text stroke. Can be a color, a gradient, or a pattern. Default black.
- `strokeThickness` {number} A number that represents the thickness of the stroke. Default 0.
- `dropShadow` {boolean} Set a drop shadow for the text. Default false.
- `dropShadowColor` {object} A fill style to be used on the dropshadow. Can be a color, a gradient, or a pattern. Default black.
- `dropShadowAngle` {number} Set a angle of the drop shadow. Default Math.PI/4.
- `dropShadowDistance` {number} Set a distance of the drop shadow. Default 5.

## demo

- Open `demo/index.html` in a browser and you should see something like this:

![img](http://i.imgur.com/lQZeHZ1.jpg)

## License

MIT, see [LICENSE.md](http://github.com/tleunen/pixi-multistyle-text/blob/master/LICENSE.md) for details.<commit_msg>forgot to update readme<commit_after># pixi-multistyle-text

[![NPM](https://nodei.co/npm/pixi-multistyle-text.png)](https://nodei.co/npm/pixi-multistyle-text/)

Add a `MultiStyleText` object inside [pixi.js](https://github.com/GoodBoyDigital/pixi.js) to easily create text using different styles.

## Example

In the example below, we are defining 4 text styles.
`def` is the default style for the text, and the others matches the tags inside the text.

```js
var textSample = new PIXI.MultiStyleText("<pixi>Pixi.js</pixi> can has <multiline>multiline</multiline>\nand <multistyle>multi-styles</multistyle> text!",
    {
        def: { font: "35px Snippet", fill: "white" },
        multiline: { font: "35px Snippet", fill: "blue" },
        pixi: { font: "35px Snippet", fill: "#D90057" },
        multistyle: { font: "35px Snippet", fill: "red" }
    }
);
```

## Usage

### `text = new PIXI.MultiStyleText(text, textStyles [,alignmentStyle])`

Creates a new Multi-Styles Text with the given options

#### `textStyles`
Type: `[String:Object]`

Each key of this dictionary should match with a tag in the text. Use the key `def` for the default style.

The style object can have these properties:

- `font` {string} The style and size of the font. Default bold 20pt Arial.
- `fill` {object} A canvas fillstyle that will be used on the text. Can be a color, a gradient, or a pattern. Default black.
- `stroke` {object} A canvas fillstyle that will be used on the text stroke. Can be a color, a gradient, or a pattern. Default black.
- `strokeThickness` {number} A number that represents the thickness of the stroke. Default 0.
- `dropShadow` {boolean} Set a drop shadow for the text. Default false.
- `dropShadowColor` {object} A fill style to be used on the dropshadow. Can be a color, a gradient, or a pattern. Default black.
- `dropShadowAngle` {number} Set a angle of the drop shadow. Default Math.PI/4.
- `dropShadowDistance` {number} Set a distance of the drop shadow. Default 5.

#### `alignmentStyle`
Type: `[Object]`

- `align` {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text. Default left.
- `wordWrap` {boolean} Indicates if word wrap should be used. Default false.
- `wordWrapWidth` {Number} The width at which text will wrap. Default 100.

## demo

- Open `demo/index.html` in a browser and you should see something like this:

![img](http://i.imgur.com/lQZeHZ1.jpg)

## License

MIT, see [LICENSE.md](http://github.com/tleunen/pixi-multistyle-text/blob/master/LICENSE.md) for details.
{'fraction_non_alphanumeric': 0.125, 'fraction_numerical': 0.009040880503144654, 'mean_word_length': 4.018737672583827, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6140211', 'n_tokens_mistral': 1664, 'n_tokens_neox': 1601, 'n_words': 632}