xtd 0.2.0
xtd::reset_color Class Referencefinal

Definition

Represent reset color output manipulator class.

Namespace
xtd
Library
xtd.core
See also
xtd::console::reset_color method.
Examples
The following example saves the values of the xtd::console_color enumeration to an array and stores the current values of the xtd::background_color and xtd::foreground_color properties to variables. It then changes the foreground color to each color in the xtd::console_color enumeration except to the color that matches the current background, and it changes the background color to each color in the xtd::console_color enumeration except to the color that matches the current foreground. (If the foreground color is the same as the background color, the text isn't visible.) Finally, it calls the xtd::reset_color class to restore the original console colors.
#include <xtd/background_color>
#include <xtd/foreground_color>
#include <xtd/reset_color>
using namespace std;
using namespace xtd;
auto main()->int {
const auto logo = vector {
u8"████████████████████████████████████████████████████████████",
u8"██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████",
u8"██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████",
u8"██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░██████████",
u8"██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████████",
u8"██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████████",
u8"██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████████",
u8"███████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░█████████████",
u8"██████████████████████████████████████████████████████████████████████",
u8"██████████████████████████████████████████████████████████████████████",
u8"██████████████████████████▀▄▄▄▄▀███████▀▄▄▄▄▀█████████████████████████",
u8"███████████████████████████▀▀▀▀███████▀▀▀▀▀███████████████████████████",
u8"██████████████████████████ ▀████ ▀█████████████████████████",
u8"███████████ ▐ ▀▀ ▐ ██████████",
u8"█████████ ▐ ███ ▌▐ ███ ▐ █████████",
u8"█████████ ▐ █▄▄▌ ▌▐ ▐▄▄█ ▐ █████████",
u8"█████████ ▐▄ ▀▀ ▄▀ ▀▄ ▀▀ ▄▀ █████████",
u8"█████████ ▀▀▄▄▀ ▀▀▄▄▀ █████████",
u8"█████████ █████████",
u8"█████████ █▄ ▌ █████████",
u8"█████████ ▌▀▀▄ ▄██ █████████",
u8"█████████ ▐ ▀▀▄▄▄▄▄▄█▀ █▌ █████████",
u8"█████████ ▐ ▄█ █████████",
u8"█████████ █ ▄█ █████████",
u8"█████████ ▀▄ █▀ █████████",
u8"█████████ ▀▄▄▄▄██▀ █████████",
u8"█████████ █████████",
u8"█████████ █████████",
u8"█████████ █████████",
u8"█████████ █████████",
u8"█████████ █████████",
u8"██████████████████████████████████████████████████████████████████",
};
for (auto index = 0ul; index < logo.size(); ++index)
cout << (index == 0 || index == logo.size() - 1 ? " " : " ") << background_color(console_color::white) << foreground_color(console_color::dark_blue) << logo[index] << reset_color() << endl;
cout << foreground_color(console_color::dark_blue) << " Gammasoft " << endl;
cout << foreground_color(console_color::dark_gray) << " More than thirty years of passion for high technology especially in development" << endl;
cout << " (c++, c#, objective-c, ...)." << reset_color() << endl;
}
// This code produces the following output with colors:
//
// ████████████████████████████████████████████████████████████
// ██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████
// ██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████
// ██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░██████████
// ██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████████
// ██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████████
// ██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████████
// ███████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░█████████████
// ██████████████████████████████████████████████████████████████████████
// ██████████████████████████████████████████████████████████████████████
// ██████████████████████████▀▄▄▄▄▀███████▀▄▄▄▄▀█████████████████████████
// ███████████████████████████▀▀▀▀███████▀▀▀▀▀███████████████████████████
// ██████████████████████████ ▀████ ▀█████████████████████████
// ███████████ ▐ ▀▀ ▐ ██████████
// █████████ ▐ ███ ▌▐ ███ ▐ █████████
// █████████ ▐ █▄▄▌ ▌▐ ▐▄▄█ ▐ █████████
// █████████ ▐▄ ▀▀ ▄▀ ▀▄ ▀▀ ▄▀ █████████
// █████████ ▀▀▄▄▀ ▀▀▄▄▀ █████████
// █████████ █████████
// █████████ █▄ ▌ █████████
// █████████ ▌▀▀▄ ▄██ █████████
// █████████ ▐ ▀▀▄▄▄▄▄▄█▀ █▌ █████████
// █████████ ▐ ▄█ █████████
// █████████ █ ▄█ █████████
// █████████ ▀▄ █▀ █████████
// █████████ ▀▄▄▄▄██▀ █████████
// █████████ █████████
// █████████ █████████
// █████████ █████████
// █████████ █████████
// █████████ █████████
// ██████████████████████████████████████████████████████████████████
// Gammasoft
// More than thirty years of passion for high technology especially in development
// (c++, c#, objective-c, ...).
Examples:
console_background_color2.cpp, console_background_color3.cpp, console_color3.cpp, console_color4.cpp, hello_world_console2.cpp, and hello_world_console3.cpp.

Constructors

 reset_color ()=default
 Initialize a new insttance of xtd::reset_coloor class. More...
 

Additional Inherited Members

- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object. More...
 
bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object. More...
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type. More...
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance. More...
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const noexcept
 Creates a shallow copy of the current object. More...
 
virtual xtd::ustring to_string () const noexcept
 Returns a sxd::ustring that represents the current object. More...
 
- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal. More...
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance. More...
 

Constructor & Destructor Documentation

◆ reset_color()

xtd::reset_color::reset_color ( )
default

Initialize a new insttance of xtd::reset_coloor class.

Examples
The following example saves the values of the xtd::console_color enumeration to an array and stores the current values of the xtd::background_color and xtd::foreground_color properties to variables. It then changes the foreground color to each color in the xtd::console_color enumeration except to the color that matches the current background, and it changes the background color to each color in the xtd::console_color enumeration except to the color that matches the current foreground. (If the foreground color is the same as the background color, the text isn't visible.) Finally, it calls the xtd::reset_color class to restore the original console colors.
#include <xtd/background_color>
#include <xtd/foreground_color>
#include <xtd/reset_color>
using namespace std;
using namespace xtd;
auto main()->int {
const auto logo = vector {
u8"████████████████████████████████████████████████████████████",
u8"██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████",
u8"██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████",
u8"██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░██████████",
u8"██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████████",
u8"██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████████",
u8"██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████████",
u8"███████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░█████████████",
u8"██████████████████████████████████████████████████████████████████████",
u8"██████████████████████████████████████████████████████████████████████",
u8"██████████████████████████▀▄▄▄▄▀███████▀▄▄▄▄▀█████████████████████████",
u8"███████████████████████████▀▀▀▀███████▀▀▀▀▀███████████████████████████",
u8"██████████████████████████ ▀████ ▀█████████████████████████",
u8"███████████ ▐ ▀▀ ▐ ██████████",
u8"█████████ ▐ ███ ▌▐ ███ ▐ █████████",
u8"█████████ ▐ █▄▄▌ ▌▐ ▐▄▄█ ▐ █████████",
u8"█████████ ▐▄ ▀▀ ▄▀ ▀▄ ▀▀ ▄▀ █████████",
u8"█████████ ▀▀▄▄▀ ▀▀▄▄▀ █████████",
u8"█████████ █████████",
u8"█████████ █▄ ▌ █████████",
u8"█████████ ▌▀▀▄ ▄██ █████████",
u8"█████████ ▐ ▀▀▄▄▄▄▄▄█▀ █▌ █████████",
u8"█████████ ▐ ▄█ █████████",
u8"█████████ █ ▄█ █████████",
u8"█████████ ▀▄ █▀ █████████",
u8"█████████ ▀▄▄▄▄██▀ █████████",
u8"█████████ █████████",
u8"█████████ █████████",
u8"█████████ █████████",
u8"█████████ █████████",
u8"█████████ █████████",
u8"██████████████████████████████████████████████████████████████████",
};
for (auto index = 0ul; index < logo.size(); ++index)
cout << (index == 0 || index == logo.size() - 1 ? " " : " ") << background_color(console_color::white) << foreground_color(console_color::dark_blue) << logo[index] << reset_color() << endl;
cout << foreground_color(console_color::dark_blue) << " Gammasoft " << endl;
cout << foreground_color(console_color::dark_gray) << " More than thirty years of passion for high technology especially in development" << endl;
cout << " (c++, c#, objective-c, ...)." << reset_color() << endl;
}
// This code produces the following output with colors:
//
// ████████████████████████████████████████████████████████████
// ██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████
// ██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████
// ██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░██████████
// ██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████████
// ██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████████
// ██████████████████████████████░░░░░░░░░░░░░░░░░░░░░░████░░████████████
// ███████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░█████████████
// ██████████████████████████████████████████████████████████████████████
// ██████████████████████████████████████████████████████████████████████
// ██████████████████████████▀▄▄▄▄▀███████▀▄▄▄▄▀█████████████████████████
// ███████████████████████████▀▀▀▀███████▀▀▀▀▀███████████████████████████
// ██████████████████████████ ▀████ ▀█████████████████████████
// ███████████ ▐ ▀▀ ▐ ██████████
// █████████ ▐ ███ ▌▐ ███ ▐ █████████
// █████████ ▐ █▄▄▌ ▌▐ ▐▄▄█ ▐ █████████
// █████████ ▐▄ ▀▀ ▄▀ ▀▄ ▀▀ ▄▀ █████████
// █████████ ▀▀▄▄▀ ▀▀▄▄▀ █████████
// █████████ █████████
// █████████ █▄ ▌ █████████
// █████████ ▌▀▀▄ ▄██ █████████
// █████████ ▐ ▀▀▄▄▄▄▄▄█▀ █▌ █████████
// █████████ ▐ ▄█ █████████
// █████████ █ ▄█ █████████
// █████████ ▀▄ █▀ █████████
// █████████ ▀▄▄▄▄██▀ █████████
// █████████ █████████
// █████████ █████████
// █████████ █████████
// █████████ █████████
// █████████ █████████
// ██████████████████████████████████████████████████████████████████
// Gammasoft
// More than thirty years of passion for high technology especially in development
// (c++, c#, objective-c, ...).

The documentation for this class was generated from the following file: