# TextStyle
Class
## About
`TextStyle` describes one character's appearance, link information, and optional semantic suggestion-tag metadata. Besides bold, italic, underline, and strikethrough, a character can be inline `Code`, a `Keyboard` key, `Highlight`ed, and `Superscript` or `Subscript`; these export to HTML as ```, ``, ``, ``, and ``. Editable content stores a style for each character. During export, neighboring characters with matching values are combined into one run.
## Methods
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| Clone | (None) | TextStyle | Returns an independent copy of this character style. |
| FromJSON | data As JSONItem | (None) | Restores state from JSON data. |
| HTMLCSS | (None) | String | Returns the supported character style as CSS declarations. |
| ToJSON | (None) | JSONItem | Returns a JSON representation of this object's persistent state. |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| BackgroundColor | Color | (None) | Gets or sets the background color. |
| Bold | Boolean | (None) | Gets or sets whether bold formatting is applied. |
| Code | Boolean | (None) | Gets or sets whether the character is inline code, drawn in a monospaced font on a tinted background and exported as <code>. |
| FontName | String | (None) | Gets or sets the font name. An empty name is Automatic and follows the editor's FontName. |
| FontSize | Double | (None) | Gets or sets the font size. Zero is Default and follows the editor's FontSize. |
| HasBackgroundColor | Boolean | (None) | Gets or sets whether background color is enabled. |
| HasLinkColor | Boolean | (None) | Gets or sets whether the explicit link color is enabled. |
| Highlight | Boolean | (None) | Gets or sets whether the character is highlighted with the editor's highlight color and exported as <mark>. A background color set with HasBackgroundColor takes its place. |
| Italic | Boolean | (None) | Gets or sets whether italic formatting is applied. |
| Keyboard | Boolean | (None) | Gets or sets whether the character is a keyboard key, drawn in a monospaced font on a key-like background and exported as <kbd>. |
| LinkColor | Color | &c0066CC | Gets or sets the explicit link color. |
| LinkTarget | String | (None) | Gets or sets the HTML browsing-context target for this link. |
| LinkTitle | String | (None) | Gets or sets the link title. |
| LinkURL | String | (None) | Gets or sets the link url. |
| Strikethrough | Boolean | (None) | Gets or sets the strike through. |
| Subscript | Boolean | (None) | Gets or sets whether the character is subscript, drawn smaller and lowered and exported as <sub>. Setting it through the editor clears Superscript. |
| SuggestionBackgroundColor | Color | &cDBEAFE | Gets or sets the background color of a semantic suggestion tag. |
| SuggestionBorderColor | Color | &c93C5FD | Gets or sets the border color of a semantic suggestion tag. |
| SuggestionIdentifier | String | (None) | Gets or sets the stable application identifier of a semantic suggestion tag. |
| SuggestionProviderIdentifier | String | (None) | Gets or sets the stable provider identifier of a semantic suggestion tag. |
| SuggestionTextColor | Color | &c1E40AF | Gets or sets the text color of a semantic suggestion tag. |
| Superscript | Boolean | (None) | Gets or sets whether the character is superscript, drawn smaller and raised and exported as <sup>. Setting it through the editor clears Subscript. |
| TextColor | Color | &c000000 | Gets or sets the foreground color used to draw text. |
| Underline | Boolean | (None) | Gets or sets whether underline formatting is applied. |
## Notes
Styles are value-like mutable objects and should be cloned when independent ownership is required.
### JSON Format
The JSON object preserves `fontName`, numeric `fontSize`, and the Boolean `bold`, `italic`, `underline`, `strikethrough`, `code`, `highlight`, `keyboard`, `superscript`, `subscript`, `hasBackgroundColor`, and `hasLinkColor` values. JSON written before the inline formats existed has no `code`, `highlight`, `keyboard`, `superscript`, or `subscript` names, and they default to `False`. `linkURL`, `linkTitle`, and `linkTarget` are strings. Semantic tags use `suggestionProviderIdentifier`, `suggestionIdentifier`, `suggestionTextColor`, `suggestionBackgroundColor`, and `suggestionBorderColor`.
`textColor`, `linkColor`, `backgroundColor`, and the three `suggestion*Color` values are objects with integer `red`, `green`, `blue`, and `alpha` members using the native Xojo `Color` component values from 0 through 255. `backgroundColor` remains serialized even when `hasBackgroundColor` is `False`, but it is not rendered until that flag is enabled. `linkColor` is similarly used only when `hasLinkColor` is `True`; otherwise the editor uses its standard link color.
### Links and Colors
A link consists of `LinkURL`, optional `LinkTitle`, and optional `LinkTarget` HTML browsing-context metadata. Text and background colors retain alpha and export as CSS `rgba()` values. `HasBackgroundColor` distinguishes an intentional transparent or colored highlight from the absence of highlighting.