1 #include "color_display.hpp" 2 3 #include <cppurses/painter/color.hpp> 4 #include <cppurses/widget/border.hpp> 5 6 using namespace cppurses; 7 8 namespace palette { 9 Color_patch(Color value)10Color_patch::Color_patch(Color value) { 11 this->set_color(value); 12 this->width_policy.maximum(5); 13 this->height_policy.maximum(2); 14 } 15 set_color(Color value)16void Color_patch::set_color(Color value) { 17 this->brush.set_background(value); 18 this->update(); 19 } 20 Color_display(Color color)21Color_display::Color_display(Color color) { 22 this->height_policy.maximum(3); 23 this->border.enable(); 24 this->border.segments.disable_all(); 25 this->border.segments.south.enable(); 26 this->set_color(color); 27 } 28 set_color(Color color)29void Color_display::set_color(Color color) { 30 text.name.set_contents(color_to_string(color)); 31 square.set_color(color); 32 } 33 } // namespace palette 34