Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Attachmate.Reflection.Objects.Emulation.OpenSystems Library / ThemeColor Object / GetBackgroundColorAsInt Method
The host text attribute to get the mapped color for.This is a TextColorMappingAttribute Enumeration value.
Example
In This Topic
    GetBackgroundColorAsInt Method
    In This Topic
    Gets the integer value that the background color of a given terminal attribute is mapped to in the theme color map.
    Syntax
    expression.GetBackgroundColorAsInt( _
       ByVal attr As TextColorMappingAttribute _
    ) As Integer
    where expression is a variable that represents a ThemeColor Object

    Parameters

    attr
    The host text attribute to get the mapped color for.This is a TextColorMappingAttribute Enumeration value.

    Return Value

    The integer value that the background color of the specified attribute is mapped to in the color map.
    Remarks

    In Open Systems sessions, screen colors are mapped to integer values in a color map. Although you can select from only one of 16 colors, you can change the actual screen colors to any RGB values by changing the RGB values of the color map.

    For example, if the screen foreground color of normal text is mapped to 0 in the map (which has a default color of Black), you can change the default RGB value mapped to 0 to another RGB value.

    You can use this approach to change the actual screen foreground and background colors to any RGB colors. Use this method to get the integer value the background color is mapped to. Then use the SetColorRGB Method method to change that color to any RGB value.

    You can view the theme color map in the user interface by clicking Color Map, under Text Color Mapping in the Modify Theme dialog box.

    The default color mapped to each integer value is shown below.

    The Theme Color Map

    Integer Default Colors for Non-Graphic Terminals Default Colors for Regis Graphics Terminals
    0 Black Black
    1 Dark Red Blue
    2 Dark Green Red
    3 Dark Yellow Green
    4 Dark Blue Magenta
    5 Dark Magenta Cyan
    6 Dark Cyan Yellow
    7 Dark Grey Grey
    8 Grey Dark Grey
    9 Red Dark Blue
    10 Green Dark Red
    11 Yellow Dark Green
    12 Blue Dark Magenta
    13 Magenta Dark Cyan
    14 Cyan Dark Yellow
    15 White Light Grey

    Example
    Set screen foreground and background colors
    Public Sub TestColors()
     
        Dim foregroundColorInt As Integer
        Dim backgroundColorInt As Integer
               
        Dim ScreenColor As Attachmate_Reflection_Objects_Emulation_OpenSystems.ThemeColor
            
        Set ScreenColor = ThisTerminal.Theme.color
        
        Rem Get the integer that is associated with the screen foreground and background colors
        foregroundColorInt = ScreenColor.GetForegroundColorAsInt(TextColorMappingAttribute_Plain)
        
        backgroundColorInt = ScreenColor.GetBackgroundColorAsInt(TextColorMappingAttribute_Plain)
        
        Rem Set the screen foreground and background colors by changing the color map
        ScreenColor.SetColorRGB foregroundColorInt, 250, 150, 200
        
        ScreenColor.SetColorRGB backgroundColorInt, 250, 50, 120
     
    End Sub
    See Also