1

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):

  • Comment: 0 / 153 / 69
  • Constant: 160 / 82 / 45
  • Flag: 192 / 192 / 192 (Silver)
  • Identifier
  • Keyword: 0 / 120 / 234
  • Number: 255 / 136 / 74
  • Parameter
  • Pascal: 0 / 123 / 234
  • Preprocessor: 169 / 42 / 28
  • Section: 245 / 245 / 245 (Whitesmoke)
  • String: 255 / 236 / 74

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:

  • Identifier
  • Parameter

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?

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164

1 Answers1

1

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.

  • Parameters are actually keywords in [Files] section and they are colored with Keyword color currently: Parameters
  • Identifiers are internal representation of Variables, Functions, Procedures etc. and they are colored accordingly.

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:

  • Comment — Green — RGB(51, 153, 51)
  • Keyword — Blue — RGB(0, 120, 212)
  • Number — Orange — RGB(229, 136, 94)
  • Pascal — Blue — RGB(0, 120, 212)
  • Preprocessor — Red — RGB(204, 41, 61)
  • String — Orange — RGB(229, 136, 94)

Visual and Installer specific:

  • Constant
  • Flag
  • Section
  • Parameter — Not yet in use (usage as described above)
  • Identifier — Not yet in use (usage as described above)
Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
Slappy
  • 5,250
  • 1
  • 23
  • 29
  • Thanks. I don’t want to change the Inno colours, I just wanted to determine what the hardcoded values were. In Inno I use the dark theme. I have clicked the links to the code but it is not clear to me. – Andrew Truckle Jun 24 '20 at 04:36
  • See my edit answer with color definitions (however system colors in Visual Studio are just enumed). – Slappy Jun 24 '20 at 04:38
  • Thanks for clarifying that the Parameter and Identifier vales are not yet used. Can you show an example of an Identifier? – Andrew Truckle Jun 24 '20 at 04:39
  • I updated your answer to include my findings for others benefit. Things are better for me now. Thanks. – Andrew Truckle Jun 24 '20 at 07:48
  • For some reason a lot of my colours have "reset". I don't know why. They all went one colour! So I have reset teh ones I knwo from this answer but I don't know what the non-Inno colours were. – Andrew Truckle Dec 26 '20 at 15:39
  • See this MSDN article for COLORINDEX enum: https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.textmanager.interop.colorindex?view=visualstudiosdk-2019 However other VS/Win versions may have colors set differently. – Slappy Dec 31 '20 at 06:13
  • But I am referring to your Inno Setup colours. Several of them have "defaults" from Inno Setup (as we have in the answer). But several are *your* own defaults. Those are the ones I need to fix. This has nothign to do with MS I don't think. – Andrew Truckle Dec 31 '20 at 12:13