Class InteractableColorTheme
Theme Engine that can set colors on a Renderer or text object based on state changes This Theme will try to set color on first available text object in order of TextMesh, Text, TextMeshPro, and TextMeshProUGUI object If no text-based component can be found, then will fall back to first Renderer component found on the initialized GameObject and target the color shader property provided in the ThemeDefinition.
Inheritance
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.UI
Assembly: cs.temp.dll.dll
Syntax
public class InteractableColorTheme : InteractableShaderTheme
Constructors
InteractableColorTheme()
Declaration
public InteractableColorTheme()
InteractableColorTheme()
Declaration
public InteractableColorTheme()
Fields
DefaultShaderProperty
Declaration
protected const string DefaultShaderProperty = "_Color"
Field Value
Type | Description |
---|---|
String |
DefaultShaderProperty
Declaration
protected const string DefaultShaderProperty = "_Color"
Field Value
Type | Description |
---|---|
String |
Methods
GetDefaultThemeDefinition()
Declaration
public override ThemeDefinition GetDefaultThemeDefinition()
Returns
Type | Description |
---|---|
ThemeDefinition |
Overrides
GetDefaultThemeDefinition()
Declaration
public override ThemeDefinition GetDefaultThemeDefinition()
Returns
Type | Description |
---|---|
ThemeDefinition |
Overrides
GetProperty(ThemeStateProperty)
Declaration
public override ThemePropertyValue GetProperty(ThemeStateProperty property)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property |
Returns
Type | Description |
---|---|
ThemePropertyValue |
Overrides
GetProperty(ThemeStateProperty)
Declaration
public override ThemePropertyValue GetProperty(ThemeStateProperty property)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property |
Returns
Type | Description |
---|---|
ThemePropertyValue |
Overrides
HasTextComponentOnObject(GameObject)
Looks to see if a text component exists on the host
Declaration
public static bool HasTextComponentOnObject(GameObject host)
Parameters
Type | Name | Description |
---|---|---|
GameObject | host | GameObject to test |
Returns
Type | Description |
---|---|
Boolean | true if host is not null and contains a text-type component, false otherwise |
HasTextComponentOnObject(GameObject)
Looks to see if a text component exists on the host
Declaration
public static bool HasTextComponentOnObject(GameObject host)
Parameters
Type | Name | Description |
---|---|---|
GameObject | host | GameObject to test |
Returns
Type | Description |
---|---|
Boolean | true if host is not null and contains a text-type component, false otherwise |
Init(GameObject, ThemeDefinition)
Declaration
public override void Init(GameObject host, ThemeDefinition settings)
Parameters
Type | Name | Description |
---|---|---|
GameObject | host | |
ThemeDefinition | settings |
Overrides
Init(GameObject, ThemeDefinition)
Declaration
public override void Init(GameObject host, ThemeDefinition settings)
Parameters
Type | Name | Description |
---|---|---|
GameObject | host | |
ThemeDefinition | settings |
Overrides
SetValue(ThemeStateProperty, Int32, Single)
Declaration
public override void SetValue(ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Overrides
SetValue(ThemeStateProperty, Int32, Single)
Declaration
public override void SetValue(ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Overrides
TryGetRendererColor(ThemeStateProperty, out Color)
Try to get color from the renderer return true, no text components exists, so falling back to base
Declaration
protected bool TryGetRendererColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to set |
Returns
Type | Description |
---|---|
Boolean | true if successfully set color on Renderer |
TryGetRendererColor(ThemeStateProperty, out Color)
Try to get color from the renderer return true, no text components exists, so falling back to base
Declaration
protected bool TryGetRendererColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to set |
Returns
Type | Description |
---|---|
Boolean | true if successfully set color on Renderer |
TryGetTextColor(ThemeStateProperty, out Color)
Try to get a color from UI Text if no color is found, a text component does not exist on this object
Declaration
protected bool TryGetTextColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to get, returns white if no Text component found |
Returns
Type | Description |
---|---|
Boolean | true if successfully get color on Text |
TryGetTextColor(ThemeStateProperty, out Color)
Try to get a color from UI Text if no color is found, a text component does not exist on this object
Declaration
protected bool TryGetTextColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to get, returns white if no Text component found |
Returns
Type | Description |
---|---|
Boolean | true if successfully get color on Text |
TryGetTextMeshColor(ThemeStateProperty, out Color)
Try to get color from TextMesh If no color is found, not TextMesh on this object
Declaration
protected bool TryGetTextMeshColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to get, returns white if no TextMesh component found |
Returns
Type | Description |
---|---|
Boolean | true if successfully get color on TextMesh |
TryGetTextMeshColor(ThemeStateProperty, out Color)
Try to get color from TextMesh If no color is found, not TextMesh on this object
Declaration
protected bool TryGetTextMeshColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to get, returns white if no TextMesh component found |
Returns
Type | Description |
---|---|
Boolean | true if successfully get color on TextMesh |
TryGetTextMeshProColor(ThemeStateProperty, out Color)
Try to get color from TextMeshPro If no color is found, TextMeshPro is not on the object
Declaration
protected bool TryGetTextMeshProColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to get, returns white if no TextMesh component found |
Returns
Type | Description |
---|---|
Boolean | true if successfully get color on TextMeshPro |
TryGetTextMeshProColor(ThemeStateProperty, out Color)
Try to get color from TextMeshPro If no color is found, TextMeshPro is not on the object
Declaration
protected bool TryGetTextMeshProColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to get, returns white if no TextMesh component found |
Returns
Type | Description |
---|---|
Boolean | true if successfully get color on TextMeshPro |
TryGetTextMeshProUGUIColor(ThemeStateProperty, out Color)
Try to get color from TextMeshProUGUI If no color is found, TextMeshProUGUI is not on the object
Declaration
protected bool TryGetTextMeshProUGUIColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to get, returns white if no TextMeshProUGUI component found |
Returns
Type | Description |
---|---|
Boolean | true if successfully get color on TextMeshProUGUI |
TryGetTextMeshProUGUIColor(ThemeStateProperty, out Color)
Try to get color from TextMeshProUGUI If no color is found, TextMeshProUGUI is not on the object
Declaration
protected bool TryGetTextMeshProUGUIColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to get, returns white if no TextMeshProUGUI component found |
Returns
Type | Description |
---|---|
Boolean | true if successfully get color on TextMeshProUGUI |
TrySetRendererColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on a renderer should just return true - falling back to base
Declaration
protected bool TrySetRendererColor(Color color, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color to try to set |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if successfully set color on Renderer |
TrySetRendererColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on a renderer should just return true - falling back to base
Declaration
protected bool TrySetRendererColor(Color color, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color to try to set |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if successfully set color on Renderer |
TrySetTextColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on UI Text If false, no UI Text was found
Declaration
protected bool TrySetTextColor(Color color, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color to try to set |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if successfully set color on Text |
TrySetTextColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on UI Text If false, no UI Text was found
Declaration
protected bool TrySetTextColor(Color color, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color to try to set |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if successfully set color on Text |
TrySetTextMeshColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on TextMesh If false, no TextMesh was found
Declaration
protected bool TrySetTextMeshColor(Color color, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color to try to set |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if successfully set color on TextMesh |
TrySetTextMeshColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on TextMesh If false, no TextMesh was found
Declaration
protected bool TrySetTextMeshColor(Color color, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color to try to set |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if successfully set color on TextMesh |
TrySetTextMeshProColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on TextMeshPro If false, no TextMeshPro was found
Declaration
protected bool TrySetTextMeshProColor(Color color, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color to try to set |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if successfully set color on TextMeshPro |
TrySetTextMeshProColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on TextMeshPro If false, no TextMeshPro was found
Declaration
protected bool TrySetTextMeshProColor(Color color, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color to try to set |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if successfully set color on TextMeshPro |
TrySetTextMeshProUGUIColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on TextMeshProUGUI If false, no TextMeshProUGUI was found
Declaration
protected bool TrySetTextMeshProUGUIColor(Color color, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color to try to set |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if successfully set color on TextMeshProUGUI |
TrySetTextMeshProUGUIColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on TextMeshProUGUI If false, no TextMeshProUGUI was found
Declaration
protected bool TrySetTextMeshProUGUIColor(Color color, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color to try to set |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if successfully set color on TextMeshProUGUI |