Intelliprompt completion list background color

SyntaxEditor for Windows Forms Forum

Posted 9 months ago by Marc Beeson - Precision Mining
Version: 23.1.2
Avatar

I was wondering if there is a way to change the background colour of the intelliprompt completion list. I have seen with the WPF control it can sort of be changed by modifying the styles, but I can't see a way to do it the WinForms version.

Comments (2)

Answer - Posted 9 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

The background of the completion list, like most theme colors in our WinForms controls, can be changed by altering one of the colors of the associated color scheme. You can find more information about renders and color schemes at this topic.

For the completion list, it uses "KnownColor.Window" as the background. Currently, the only way to change one of the KnownColor values is to create your own WindowsColorScheme class and override the "GetKnownColor" method like this:

public class CustomColorScheme : WindowsColorScheme {
    public CustomColorScheme()
        : base(WindowsColorSchemeType.MetroLight) { // Initialize from any built-in color scheme
    }

    public override Color GetKnownColor(KnownColor color) {
        switch (color) {
            case KnownColor.Window:
                return Color.Yellow; // Custom color
            default:
                return base.GetKnownColor(color);
        }
    }
}

You can then update the global renderer like this, but this will impact all controls that use "KnownColor.Window" and is likely not what you want:

UIRendererManager.ColorScheme = new CustomColorScheme();

You can limit the impact of the color change by isolating it to SyntaxEditor's renderer. The following shows how you can make the custom color scheme the default for all SyntaxEditor instances without having to individual configure each one:

// Define a custom renderer factory
public class CustomSyntaxEditorRendererFactory : IUIRendererFactory {
    public IUIRenderer CreateRenderer() {
        // Use existing Metro renderer with custom color scheme
        var colorScheme = new CustomColorScheme();
        return new MetroSyntaxEditorRenderer(colorScheme);
    }
}

// During app startup, register the custom factory
UIRendererManager.RegisterRendererFactory(
    typeof(ISyntaxEditorRenderer),
    new CustomSyntaxEditorRendererFactory(),
    overwrite: true);

Note that there are still other UI elements in SyntaxEditor that use "KnownColor.Window", so the color will impact those as well.  For the MetroSyntaxEditorRenderer, that should be limited to NavigableSymbolSelector that uses the same color as its background.


Actipro Software Support

Posted 9 months ago by Marc Beeson - Precision Mining
Avatar

This is great! As usual, your response is excellent and very informative.

I was able to tidy up a couple of other outstanding theming issues with our dark skin. We had already extended the SyntaxEditor and was using a extended renderer, so it was easier to drop in the custom color theme, instead of registering a factory as suggested.

Very much appreciated for your quick response.

The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.