コード例 #1
0
        // Build a new coloured theme based on SC's default theme
        // and then set it as the program's default theme.
        private void SetUpCustomColors()
        {
            // Create a set of default colours that we will modify
            CustomColors = SadConsole.UI.Themes.Library.Default.Colors.Clone();

            // Pick a couple of background colours that we will apply to all consoles.
            Color backgroundColor = new Color(CustomColors.Black, "Black");

            // Set background colour for controls consoles and their controls
            CustomColors.ControlHostBackground   = backgroundColor;
            CustomColors.ControlBackgroundNormal = backgroundColor;

            // Generate background colours for dark and light themes based on
            // the default background colour.
            //CustomColors.ControlH = (backgroundColor * 1.3f).FillAlpha();
            //CustomColors.ControlBackDark = (backgroundColor * 0.7f).FillAlpha();

            // Set a color for currently selected controls. This should always
            // be different from the background colour.
            CustomColors.ControlBackgroundSelected = new Color(CustomColors.GrayDark, "Grey");

            // Rebuild all objects' themes with the custom colours we picked above.
            CustomColors.RebuildAppearances();

            // Now set all of these colours as default for SC's default theme.
            SadConsole.UI.Themes.Library.Default.Colors = CustomColors;
        }
コード例 #2
0
            public override void RefreshTheme(SadConsole.UI.Colors colors, ControlBase control)
            {
                if (colors == null)
                {
                    colors = control.FindThemeColors();
                }

                ControlThemeState.Normal                   =
                    ControlThemeState.MouseOver            =
                        ControlThemeState.MouseDown        =
                            ControlThemeState.Focused      =
                                ControlThemeState.Disabled =
                                    new SadConsole.ColoredGlyph(textColor, colorValue);

                _colorsLastUsed = colors;
            }