InfoConnect API Guide
Attachmate.Reflection.Emulation.OpenSystems Namespace / IThemeColor Interface / SetColorRGB Method

The integer value (between 0 and 15) that you want to change the mapping for in the color map. See the Remarks for more about how colors are mapped.

An integer value that specifies the degree of red saturation (red RGB value) for the new color. This can be any value between 0 and 255.
An integer value that specifies the degree of green saturation (green RGB value) for the new color. This can be any value between 0 and 255.
An integer value that specifies the degree of blue saturation (blue RGB value) for the new color. This can be any value between 0 and 255.
Example


In This Topic
    SetColorRGB Method
    In This Topic
    Sets a default color in the theme color map to a new custom color.
    Syntax
    'Declaration
     
    
    Sub SetColorRGB( _
       ByVal color As Integer, _
       ByVal red As Integer, _
       ByVal green As Integer, _
       ByVal blue As Integer _
    ) 
    'Usage
     
    
    Dim instance As IThemeColor
    Dim color As Integer
    Dim red As Integer
    Dim green As Integer
    Dim blue As Integer
     
    instance.SetColorRGB(color, red, green, blue)
    void SetColorRGB( 
       int color,
       int red,
       int green,
       int blue
    )

    Parameters

    color

    The integer value (between 0 and 15) that you want to change the mapping for in the color map. See the Remarks for more about how colors are mapped.

    red
    An integer value that specifies the degree of red saturation (red RGB value) for the new color. This can be any value between 0 and 255.
    green
    An integer value that specifies the degree of green saturation (green RGB value) for the new color. This can be any value between 0 and 255.
    blue
    An integer value that specifies the degree of blue saturation (blue RGB value) for the new color. This can be any value between 0 and 255.
    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 or background color to any RGB color. Use the GetBackgroundColorAsInt Method or GetForegroundColorAsInt Method methods to get the integer value that is mapped to the screen color and then use this method to change the mapping for 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
    This sample changes the screen background and foreground colors
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Attachmate.Reflection.Framework;
    using Attachmate.Reflection.Emulation.OpenSystems;
    using Attachmate.Reflection.UserInterface;
     
    namespace CreateASession
    {
        class Program
        {
            static void Main(string[] args)
            {
                //Start a visible instance of InfoConnect or get the instance running at the given channel name
                Application app = MyReflection.CreateApplication("myWorkspace", true);
     
                //Create a terminal for an Open Systems session
                ITerminal terminal = (ITerminal)app.CreateControl(new Guid("{BE835A80-CAB2-40d2-AFC0-6848E486BF58}"));
     
                //Specify the connection type, host name (or IP address), and connect.
                IConnectionSettingsTelnet conn = (IConnectionSettingsTelnet)terminal.ConnectionSettings;
                conn.HostAddress = "sylvester";
                terminal.Connect();
     
                IThemeColor screenColor = terminal.Theme.Color;
     
                //Get integers that are mapped to the background and foreground colors
                int bgColor = screenColor.GetBackgroundColorAsInt(TextColorMappingAttribute.Plain);
                int fgColor = screenColor.GetForegroundColorAsInt(TextColorMappingAttribute.Plain);
     
                //Set the colors that are mapped to these values
                screenColor.SetColorRGB(bgColor, 255, 0,0);
                screenColor.SetColorRGB(fgColor, 0, 0, 255);
     
                //Create a View to make the session visible                
                IFrame frame = (IFrame)app.GetObject("Frame");
                frame.CreateView(terminal);
            }
        }
    }
    See Also