示例#1
0
        /// <summary>
        /// Invokes an action with predefined colors on the console.
        /// </summary>
        /// <param name="printing"></param>
        /// <param name="textColor"></param>
        /// <param name="backColor"></param>
        public static void InvokeWithColors(Action printing, FColor textColor, FColor backColor)
        {
            lock (lockP)
            {
                ConsoleColor previousBackColor = GetBackground();
                SetBackground(backColor.MatchColor(previousBackColor));

                InvokeWithColors(printing, textColor);

                SetBackground(previousBackColor);
            }
        }
示例#2
0
        /// <summary>
        /// Prints the string value with the specified colors.
        /// </summary>
        /// <param name="value"></param>
        /// <param name="textColor"></param>
        /// <param name="backColor"></param>
        public static void Print(object value, FColor textColor, FColor backColor)
        {
            lock (lockP)
            {
                ConsoleColor previousBackColor = GetBackground();
                SetBackground(backColor.MatchColor(previousBackColor));

                Print(value, textColor);

                SetBackground(previousBackColor);
            }
        }
示例#3
0
        /// <summary>
        ///
        /// Invokes an action with predefined colors on the console.
        /// </summary>
        /// <param name="printing"></param>
        /// <param name="textColor"></param>
        public static void InvokeWithColors(Action printing, FColor textColor)
        {
            lock (lockP)
            {
                ConsoleColor previousColor = GetForeground();
                SetForeground(textColor.MatchColor(previousColor));

                printing?.Invoke();

                SetForeground(previousColor);
            }
        }
示例#4
0
        /// <summary>
        /// Prints the string representation of the value with the specified text color.
        /// </summary>
        /// <param name="value"></param>
        /// <param name="textColor"></param>
        public static void Print(object value, FColor textColor)
        {
            lock (lockP)
            {
                ConsoleColor previousColor = GetForeground();
                SetForeground(textColor.MatchColor(previousColor));

                Print(value);

                SetForeground(previousColor);
            }
        }