Class Theme
Represents a TextMate theme for applying colors and styles to tokens
Implements
Inherited Members
Namespace: Unity.AppUI.TextMateLib
Assembly: Unity.AppUI.TextMateLib.dll
Syntax
public class Theme : IDisposable
Methods
Dispose()
Releases the native resources
Declaration
public void Dispose()
~Theme()
Finalizer to ensure resources are released
Declaration
protected ~Theme()
GetBackground(string, uint)
Gets the background color for a scope path
Declaration
public uint GetBackground(string scopePath, uint defaultColor = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| string | scopePath | The scope path |
| uint | defaultColor | Default color to return if scope not found (RGBA format: 0xRRGGBBAA) |
Returns
| Type | Description |
|---|---|
| uint | Color in RGBA format (0xRRGGBBAA) |
GetDefaultBackground()
Gets the default background color for the theme
Declaration
public uint GetDefaultBackground()
Returns
| Type | Description |
|---|---|
| uint | Color in RGBA format (0xRRGGBBAA) |
GetDefaultForeground()
Gets the default foreground color for the theme
Declaration
public uint GetDefaultForeground()
Returns
| Type | Description |
|---|---|
| uint | Color in RGBA format (0xRRGGBBAA) |
GetFontStyle(string, FontStyle)
Gets the font style for a scope path
Declaration
public FontStyle GetFontStyle(string scopePath, FontStyle defaultStyle = FontStyle.None)
Parameters
| Type | Name | Description |
|---|---|---|
| string | scopePath | The scope path |
| FontStyle | defaultStyle | Default style to return if scope not found |
Returns
| Type | Description |
|---|---|
| FontStyle | Font style flags |
GetForeground(string, uint)
Gets the foreground color for a scope path
Declaration
public uint GetForeground(string scopePath, uint defaultColor = 4294967295)
Parameters
| Type | Name | Description |
|---|---|---|
| string | scopePath | The scope path (e.g., "source.js string.quoted") |
| uint | defaultColor | Default color to return if scope not found (RGBA format: 0xRRGGBBAA) |
Returns
| Type | Description |
|---|---|
| uint | Color in RGBA format (0xRRGGBBAA) |
LoadFromFile(string)
Loads a theme from a JSON file
Declaration
public static Theme LoadFromFile(string themePath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | themePath | Path to the theme JSON file |
Returns
| Type | Description |
|---|---|
| Theme | A new Theme instance |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when themePath is null or empty |
| InvalidOperationException | Thrown when the theme fails to load |
LoadFromJson(string)
Loads a theme from a JSON string
Declaration
public static Theme LoadFromJson(string jsonContent)
Parameters
| Type | Name | Description |
|---|---|---|
| string | jsonContent | JSON content of the theme |
Returns
| Type | Description |
|---|---|
| Theme | A new Theme instance |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when jsonContent is null or empty |
| InvalidOperationException | Thrown when the theme fails to load |