Frame library for C# console applications.
- Overview
- Features
- Getting Started
- Contributing
- Bug / Issue Reporting
- License
- Contact
- Acknowledgments
The Frame library is a C# library designed to create customizable frames in console applications. It allows developers to easily add borders, colors, and text to their console output, enhancing the visual appeal of command-line interfaces.
- Customizable Borders: Choose from various border characters to create unique frames.
- Color Support: Set foreground and background colors for both the frame and text.
To get started with the Frame library, you will need to install the library in your .NET project. You can do this using NuGet Package Manager or by adding the package reference directly to your project file.
- .NET 9.0 or later
To use the Frame library, you will need to download and then add a reference to the library in your project. Follow the instructions below to install the library and get started.
You can install the Form library using the NuGet Package Manager Console. Open the console and run the following command:
Install-Package TirsvadCLI.Frame
- Open your project in Visual Studio.
- Right-click on your project in the Solution Explorer and select "Manage NuGet Packages".
- Search for "TirsvadCLI.Frame" in the NuGet Package Manager.
- Click "Install" to add the library to your project.
You can also install the Frame library using the .NET CLI. Open a terminal and run the following command:
dotnet add package TirsvadCLI.Frame
If you want to clone the repository and build the library from source, you can do so using Git. Make sure you have Git installed on your machine. Then, run the following command in your terminal:
git clone git@github.com:TirsvadCLI/Dotnet.Lib.Frame.git
In the example you can see how to use the Frame class.
The Frame
class provides several methods to create and customize frames in console applications.
Below is a list of the public methods and their descriptions:
-
Frame()
- Initializes a frame with default dimensions, border characters, and colors.
-
Frame(int windowWidth, int windowHeight, int? frameWidth = null, int? frameHeight = null, char leftTop = '╔', char rightTop = '╗', char leftBottom = '╚', char rightBottom = '╝', char horizontal = '═', char vertical = '║')
- Creates a frame with specified dimensions and optional custom border characters.
-
Frame(int windowWidth, int windowHeight, string[] frameText, int? frameWidth = null, int? frameHeight = null, char leftTop = '╔', char rightTop = '╗', char leftBottom = '╚', char rightBottom = '╝', char horizontal = '═', char vertical = '║')
- Creates a frame with text inside and optional custom dimensions and border characters.
-
SetStartPosition((int Left, int Top) startPosition)
- Sets the starting position of the frame on the console.
-
SetColorBg(ConsoleColor color)
- Sets the background color for both the frame and text.
-
SetColorFg(ConsoleColor color)
- Sets the foreground color for both the frame and text.
-
SetTextColorBg(ConsoleColor color)
- Sets the background color of the text inside the frame.
-
SetTextColorFg(ConsoleColor color)
- Sets the foreground color of the text inside the frame.
-
SetFrameColorBg(ConsoleColor color)
- Sets the background color of the frame.
-
SetFrameColorFg(ConsoleColor color)
- Sets the foreground color of the frame.
-
SetFrameText(string title)
- Sets a single line of text inside the frame.
-
SetFrameText(List<string> title)
- Sets multiple lines of text inside the frame.
-
Render(bool center = false)
- Renders the frame on the console. If
center
istrue
, the frame is centered on the screen.
- Renders the frame on the console. If
-
FrameText(ICollection<string> texts, bool centerText = false)
- Frames the provided text and optionally centers it.
-
CenterText(string text, int width)
- Centers a single line of text within the specified width.
These methods allow you to create visually appealing and customizable frames for console applications. For usage examples, refer to the Example section.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
If you encounter a bug or have an issue to report, please follow these steps:
-
Go to the Issues Page
Navigate to the GitHub Issues page. -
Click "New Issue"
Click the green "New Issue" button to create a new issue. -
Provide Details
- Title: Write a concise and descriptive title for the issue.
- Description: Include the following details:
- Steps to reproduce the issue.
- Expected behavior.
- Actual behavior.
- Environment details (e.g., OS, .NET version, etc.).
- Attachments: Add screenshots, logs, or any other relevant files if applicable.
- Submit the Issue
Once all details are filled in, click "Submit new issue" to report it.
Your feedback is valuable and helps improve the project!
Distributed under the GPL-3.0 License.
Jens Tirsvad Nielsen - LinkedIn
- Microsoft .NET - The framework used for this project.
- NuGet - For package management and distribution.
- GitHub - For version control and collaboration.
- Shields.io - For creating the badges used in this README.
- Visual Studio - For providing a powerful IDE for .NET development.
- Stack Overflow - For community support and answers to programming questions.
- Contributors - Thanks to all contributors who have helped improve this project.