Skip to content

[API Proposal]: Add overloads to Console.Write that also take a ConsoleColor parameter #61731

Description

@FilipToth

Background and motivation

This API proposal should just make it easier to write things of different colors to the console. Right now, we have to call three methods to do so. This is how we would do that now:

Console.ForegroundColor = ConsoleColor.Blue;
Console.Write("Hello!");
Console.ResetColor();

This is what I propose:

Console.Write(ConsoleColor.Blue, "Hello!");

This isn't anything critical, it's just some sugar to make writing code a little bit easier.

API Proposal

namespace System
{
    public static class Console
    {
        public void Write(ConsoleColor color, String value);
    }
}

I would suggest having an overload for Write and WriteLine.

API Usage

System.Console.WriteLine(ConsoleColor.Red, "Red text!");

Alternative Designs

No response

Risks

I do not see any risks associated with this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions