resolveSolidColorAsCssValue
[ Function ]
public static resolveSolidColorAsCssValue(
colorObject: TcHmi.SolidColor
): string;
Converts a TcHmi.SolidColor value to a CSS value. Please note that the value must be a valid SolidColor. To check this, you can use TcHmi.isSolidColor.
This function also handles the special color "none", which can be set via engineering.
Parameter
Name | Type | Description |
---|---|---|
colorObject | Color value to be translated. |
Return value
Type | Description |
---|---|
CSS color |
Available from version 1.10 |
Sample - JavaScript
var myColor = {
color: 'red'
};
var newElem = $('<div class="testdiv"></div>');
if (TcHmi.isSolidColor(myColor)) {
var cssColor = TcHmi.StyleProvider.resolveSolidColorAsCssValue(myColor);
TcHmi.StyleProvider.setSimpleElementStyle(newElem, 'color', cssColor);
} else {
TcHmi.StyleProvider.setSimpleElementStyle(newElem, 'color', null);
}
Most applications can use high-level APIs such as TcHmi.StyleProvider.processTextColor or similar.