xtd 0.2.0
background_color.h
Go to the documentation of this file.
1 #pragma once
5 #include "console.h"
6 #include "object.h"
7 
9 namespace xtd {
22  class background_color final : public object {
23  public:
25 
33  explicit background_color(console_color color) : color(color) {}
35 
37  friend std::ostream& operator <<(std::ostream& os, const background_color& color) {
38  if (!console::is_output_redirected() && os.rdbuf() == console::out.rdbuf())
39  console::background_color(color.color);
40  return os;
41  }
43 
44  private:
45  console_color color ;
46  };
47 }
Represent background color output manipulator class.
Definition: background_color.h:22
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
background_color(console_color color)
Sets the background color of the console.
Definition: background_color.h:33
console_color
Specifies constants that define foreground and background colors for the console. ...
Definition: console_color.h:19
Contains xtd::object class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:32
static console_color background_color()
Gets the background color of the console.
Contains xtd::console class.
static bool is_output_redirected()
Gets a value that indicates whether the output stream has been redirected from the standard output st...
static std::ostream out
Gets the standard output stream. A std::basic_ostream<char_t> that represents the standard output str...
Definition: console.h:49