inno-setupvisual-and-installer

Setting the colour syntax used in Visual & Installer to match Inno Setup 6


I am setting up Visual & Installer colour syntax to look and feel more like Inno Setup 6 because it is just more comfortable on my eyes (particularly with my colourblindness).

As mentioned here:

All colors can be customized - there are many elements supported: Keywords, Comments, Parameters, Variables, Constants, labels, Preprocessor and many more... Configure them easily in Tools -> Options -> Environment -> Fonts and Colors dialog

So I have been working my way through the available properties:

Colours

So far I have come up with (by doing a screen grab from Inno and interrogating the colours):

I don't know how close I am to the official Inno Setup colours. Can someone confirm this anywhere?

Specifically though, I am not sure which parts of the script are represented by:

I want to determine what colour Inno Setup is using for them.

Update

I tried to identify these tokens in my script (Identifier, Parameter) by setting the background colour to something bright and I saw no such elements. I restarted Visual Studio to be sure. So I am not sure what is happening?


Solution

  • Default Inno Setup IDE (Compil32.exe)

    It does not support the changing of the syntax colors. They are hard-coded in sources. So only way how to change them is to recompile the Inno Setup from sources. Their colors are defined here.

    Important Note: The colors are different for each Theme the IDE uses.

    See this file to understand how the colors are applied to specific items.

    Visual & Installer for Visual Studio IDE

    Colors can be completely adjusted in Options dialog, section Fonts and Colors. They do NOT match the official Inno Setup color, the V&I is not an exact copy of Inno IDE, feel free to adjust colors to match your needs.

    Important Note: It is hard to compare the colors, because the IDEs have different mechanism how the syntax highlighting works! Not everything that is a Keyword in Inno IDE is a Keyword in V&I etc.

    Parameter and Identifiers

    The colors for Parameters and Identifiers are currently not used and are reserved for future use.

    For completeness here are the default colors used in Visual & Installer - Visual Studio:

    if (mDarkTheme)
    {
      // Parameters /*1*/ to /*X*/ are used in InnoSetupScanner.cs
      mColorableItems = new ColorableItem[]
      {                    
        /*1*/ new LanguageColorableItem(Name + " - Keyword",        Name + " - Keyword",        COLORINDEX.CI_BLUE,             COLORINDEX.CI_USERTEXT_BK, System.Drawing.Color.FromArgb((int)LanguageColorableItem.clrYelGold), System.Drawing.Color.Empty, FONTFLAGS.FF_DEFAULT),
        /*2*/ new LanguageColorableItem(Name + " - Comment",        Name + " - Comment",        COLORINDEX.CI_DARKGREEN,        COLORINDEX.CI_USERTEXT_BK, System.Drawing.Color.FromArgb((int)LanguageColorableItem.clrLtGreen), System.Drawing.Color.Empty, FONTFLAGS.FF_DEFAULT),
        /*3*/ new LanguageColorableItem(Name + " - Identifier",     Name + " - Identifier",     COLORINDEX.CI_SYSPLAINTEXT_FG,  COLORINDEX.CI_USERTEXT_BK, System.Drawing.Color.FromArgb((int)LanguageColorableItem.clrDkWhite), System.Drawing.Color.Empty, FONTFLAGS.FF_DEFAULT),
        /*4*/ new LanguageColorableItem(Name + " - String",         Name + " - String",         COLORINDEX.CI_MAROON,           COLORINDEX.CI_USERTEXT_BK, System.Drawing.Color.FromArgb((int)LanguageColorableItem.clrTeal), System.Drawing.Color.Empty, FONTFLAGS.FF_DEFAULT),
        /*5*/ new LanguageColorableItem(Name + " - Number",         Name + " - Number",         COLORINDEX.CI_LIGHTGRAY,        COLORINDEX.CI_USERTEXT_BK),
        /*6*/ new LanguageColorableItem(Name + " - Parameter",      Name + " - Parameter",      COLORINDEX.CI_BLUE ,            COLORINDEX.CI_USERTEXT_BK, System.Drawing.Color.FromArgb((int)LanguageColorableItem.clrYelGold), System.Drawing.Color.Empty, FONTFLAGS.FF_DEFAULT),
        /*7*/ new LanguageColorableItem(Name + " - Constant",       Name + " - Constant",       COLORINDEX.CI_MAROON,           COLORINDEX.CI_USERTEXT_BK, System.Drawing.Color.FromArgb((int)LanguageColorableItem.clrLtMaroon), System.Drawing.Color.Empty, FONTFLAGS.FF_DEFAULT),
        /*8*/ new LanguageColorableItem(Name + " - Preprocessor",   Name + " - Preprocessor",   COLORINDEX.CI_RED,              COLORINDEX.CI_USERTEXT_BK),
        /*9*/ new LanguageColorableItem(Name + " - Pascal",         Name + " - Pascal",         COLORINDEX.CI_BLUE,             COLORINDEX.CI_USERTEXT_BK, System.Drawing.Color.FromArgb((int)LanguageColorableItem.clrLtPurple), System.Drawing.Color.Empty, FONTFLAGS.FF_DEFAULT),
        /*10*/new LanguageColorableItem(Name + " - Section",        Name + " - Section",        COLORINDEX.CI_DARKGRAY,         COLORINDEX.CI_USERTEXT_BK, FONTFLAGS.FF_BOLD),
        /*11*/new LanguageColorableItem(Name + " - Flag",           Name + " - Flag",           COLORINDEX.CI_BLACK,            COLORINDEX.CI_USERTEXT_BK, System.Drawing.Color.FromArgb((int)LanguageColorableItem.clrOrange), System.Drawing.Color.Empty, FONTFLAGS.FF_DEFAULT)
      };
    }
    else
    {
      // Parameters /*1*/ to /*X*/ are used in InnoSetupScanner.cs
      mColorableItems = new ColorableItem[]
      {                    
        /*1*/ new LanguageColorableItem(Name + " - Keyword",        Name + " - Keyword",        COLORINDEX.CI_BLUE,             COLORINDEX.CI_USERTEXT_BK),
        /*2*/ new LanguageColorableItem(Name + " - Comment",        Name + " - Comment",        COLORINDEX.CI_DARKGREEN,        COLORINDEX.CI_USERTEXT_BK),
        /*3*/ new LanguageColorableItem(Name + " - Identifier",     Name + " - Identifier",     COLORINDEX.CI_SYSPLAINTEXT_FG,  COLORINDEX.CI_USERTEXT_BK),
        /*4*/ new LanguageColorableItem(Name + " - String",         Name + " - String",         COLORINDEX.CI_MAROON,           COLORINDEX.CI_USERTEXT_BK, System.Drawing.Color.FromArgb((int)LanguageColorableItem.clrTeal), System.Drawing.Color.Empty, FONTFLAGS.FF_DEFAULT),
        /*5*/ new LanguageColorableItem(Name + " - Number",         Name + " - Number",         COLORINDEX.CI_DARKBLUE,         COLORINDEX.CI_USERTEXT_BK),
        /*6*/ new LanguageColorableItem(Name + " - Parameter",      Name + " - Parameter",      COLORINDEX.CI_BLUE ,            COLORINDEX.CI_USERTEXT_BK),
        /*7*/ new LanguageColorableItem(Name + " - Constant",       Name + " - Constant",       COLORINDEX.CI_MAROON,           COLORINDEX.CI_USERTEXT_BK),
        /*8*/ new LanguageColorableItem(Name + " - Preprocessor",   Name + " - Preprocessor",   COLORINDEX.CI_RED,              COLORINDEX.CI_USERTEXT_BK),
        /*9*/ new LanguageColorableItem(Name + " - Pascal",         Name + " - Pascal",         COLORINDEX.CI_BLUE,             COLORINDEX.CI_USERTEXT_BK),
        /*10*/new LanguageColorableItem(Name + " - Section",        Name + " - Section",        COLORINDEX.CI_BLACK,            COLORINDEX.CI_USERTEXT_BK, FONTFLAGS.FF_BOLD),
        /*11*/new LanguageColorableItem(Name + " - Flag",           Name + " - Flag",           COLORINDEX.CI_BLACK,            COLORINDEX.CI_USERTEXT_BK, System.Drawing.Color.FromArgb((int)LanguageColorableItem.clrOrange), System.Drawing.Color.Empty, FONTFLAGS.FF_DEFAULT)
      };
    }
    
    
    public enum COLORINDEX
    {
      CI_USERTEXT_FG = 0,
      CI_SYSTEXT_FG = 0,
      CI_USERTEXT_BK = 1,
      CI_SYSTEXT_BK = 1,
      CI_FIRSTFIXEDCOLOR = 2,
      CI_BLACK = 2,
      CI_WHITE = 3,
      CI_MAROON = 4,
      CI_DARKGREEN = 5,
      CI_BROWN = 6,
      CI_DARKBLUE = 7,
      CI_PURPLE = 8,
      CI_AQUAMARINE = 9,
      CI_LIGHTGRAY = 10,
      CI_DARKGRAY = 11,
      CI_RED = 12,
      CI_GREEN = 13,
      CI_YELLOW = 14,
      CI_BLUE = 15,
      CI_MAGENTA = 16,
      CI_CYAN = 17,
      CI_LASTFIXEDCOLOR = 17,
      CI_SYSSEL_FG = 18,
      CI_SYSSEL_BK = 19,
      CI_SYSINACTSEL_FG = 20,
      CI_SYSINACTSEL_BK = 21,
      CI_SYSWIDGETMGN_BK = 22,
      CI_SYSPLAINTEXT_FG = 23,
      CI_SYSPLAINTEXT_BK = 24,
      CI_PALETTESIZE = 25,
      CI_FORBIDCUSTOMIZATION = 26
    }
    
    from namespace namespace Microsoft.VisualStudio.TextManager.Interop
    
    public class LanguageColorableItem : ColorableItem
    {
      // Default colors (for Dark Theme mostly)
      public const int clrLtGreen     = unchecked((int)0xFF93C763);
      public const int clrDkWhite     = unchecked((int)0xFFE0E2E4);
      public const int clrYelGold     = unchecked((int)0xFFFFCD22);
      public const int clrLtPurple    = unchecked((int)0xFFA082BD);
      public const int clrLtMaroon    = unchecked((int)0xFFA0522D);
      public const int clrOrange      = unchecked((int)0xFFFF8040);
      public const int clrTeal        = unchecked((int)0xFF4A9595);
    }
    
    public class ColorableItem : IVsColorableItem, IVsHiColorItem, IVsMergeableUIItem
    {
    }
    
    from namespace Microsoft.VisualStudio.Package
    

    Update

    Following provided by @ajtruckle.

    The Inno Setup colour constants (from the source code link above) are:

      MRed = $3D29CC;            { Azure DevOps }
      MGreen = $339933;          { Azure DevOps }
      MBlue = $D47800;           { Azure DevOps }   
      MOrange = $5E88E5;         { Azure DevOps }
      MPurple = $933B77;         { Azure DevOps }
      MYellow = $1DCBF2;         { Azure DevOps }
      MTeal = $B0C94E;           { Visual Studio 2017 }
      MGray = $707070;           { Inno Setup 5 }
    

    The colour codes above appear to be BGR. Taking that into account these appear to be the equivalent colour mappings for Visual and Installer:

    Visual and Installer specific: