InfoConnect API Guide
Attachmate.Reflection.Emulation.OpenSystems Namespace / IThemeColor Interface / GetColorRGB Method
An integer value between 0 and 15. This value is associated with an RGB color in the color map.
Example


In This Topic
    GetColorRGB Method
    In This Topic
    Gets the RGB value assigned to an integer in the theme color map.
    Syntax
    'Declaration
     
    
    Function GetColorRGB( _
       ByVal color As Integer _
    ) As String
    'Usage
     
    
    Dim instance As IThemeColor
    Dim color As Integer
    Dim value As String
     
    value = instance.GetColorRGB(color)
    string GetColorRGB( 
       int color
    )

    Parameters

    color
    An integer value between 0 and 15. This value is associated with an RGB color in the color map.

    Return Value

    A comma-separated string that includes the RGB values of the color.
    Remarks

    Example
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Diagnostics;
    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();
                
            //Create a View to make the session visible                
                IFrame frame = (IFrame)app.GetObject("Frame");
                frame.CreateView(terminal);
     
                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);
     
                //Get the RGB values of the background and foregraound colors 
                string background = screenColor.GetColorRGB(bgColor);
                string foreground = screenColor.GetColorRGB(fgColor);
     
                //Write the RGB values for the background and foreground colors to the console
                Console.WriteLine("This is the background color: " + background);
                Console.WriteLine("This is the foreground color: " + foreground);
     
            }
        }
    }
    See Also