mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-10-31 18:48:11 +08:00 
			
		
		
		
	Add colors.
+ example.
This commit is contained in:
		| @@ -1,8 +1,9 @@ | ||||
| add_subdirectory(color) | ||||
| add_subdirectory(frame) | ||||
| add_subdirectory(gauge) | ||||
| add_subdirectory(menu) | ||||
| add_subdirectory(menu2) | ||||
| add_subdirectory(print_key_press) | ||||
| add_subdirectory(separator) | ||||
| add_subdirectory(vbox_hbox) | ||||
| add_subdirectory(toggle) | ||||
| add_subdirectory(vbox_hbox) | ||||
|   | ||||
							
								
								
									
										4
									
								
								examples/color/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								examples/color/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| add_executable(color_main | ||||
|   main.cpp | ||||
| ) | ||||
| target_link_libraries(color_main PRIVATE ftxui) | ||||
							
								
								
									
										60
									
								
								examples/color/main.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								examples/color/main.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | ||||
| #include "ftxui/screen.hpp" | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include <iostream> | ||||
|  | ||||
| int main(int argc, const char *argv[]) | ||||
| { | ||||
|   using namespace ftxui; | ||||
|   using namespace ftxui::dom; | ||||
|   auto document = | ||||
|     hbox( | ||||
|       vbox( | ||||
|         color(Color::Default, text(L"Default")), | ||||
|         color(Color::Black, text(L"Black")), | ||||
|         color(Color::GrayDark, text(L"GrayDark")), | ||||
|         color(Color::GrayLight, text(L"GrayLight")), | ||||
|         color(Color::White, text(L"White")), | ||||
|         color(Color::Blue, text(L"Blue")), | ||||
|         color(Color::BlueLight, text(L"BlueLight")), | ||||
|         color(Color::Cyan, text(L"Cyan")), | ||||
|         color(Color::CyanLight, text(L"CyanLight")), | ||||
|         color(Color::Green, text(L"Green")), | ||||
|         color(Color::GreenLight, text(L"GreenLight")), | ||||
|         color(Color::Magenta, text(L"Magenta")), | ||||
|         color(Color::MagentaLight, text(L"MagentaLight")), | ||||
|         color(Color::Red, text(L"Red")), | ||||
|         color(Color::RedLight, text(L"RedLight")), | ||||
|         color(Color::Yellow, text(L"Yellow")), | ||||
|         color(Color::YellowLight, text(L"YellowLight")) | ||||
|       ), | ||||
|       vbox( | ||||
|         bgcolor(Color::Default, text(L"Default")), | ||||
|         bgcolor(Color::Black, text(L"Black")), | ||||
|         bgcolor(Color::GrayDark, text(L"GrayDark")), | ||||
|         bgcolor(Color::GrayLight, text(L"GrayLight")), | ||||
|         bgcolor(Color::White, text(L"White")), | ||||
|         bgcolor(Color::Blue, text(L"Blue")), | ||||
|         bgcolor(Color::BlueLight, text(L"BlueLight")), | ||||
|         bgcolor(Color::Cyan, text(L"Cyan")), | ||||
|         bgcolor(Color::CyanLight, text(L"CyanLight")), | ||||
|         bgcolor(Color::Green, text(L"Green")), | ||||
|         bgcolor(Color::GreenLight, text(L"GreenLight")), | ||||
|         bgcolor(Color::Magenta, text(L"Magenta")), | ||||
|         bgcolor(Color::MagentaLight, text(L"MagentaLight")), | ||||
|         bgcolor(Color::Red, text(L"Red")), | ||||
|         bgcolor(Color::RedLight, text(L"RedLight")), | ||||
|         bgcolor(Color::Yellow, text(L"Yellow")), | ||||
|         bgcolor(Color::YellowLight, text(L"YellowLight")) | ||||
|       ), | ||||
|       flex() | ||||
|     ); | ||||
|  | ||||
|   auto screen = ftxui::Screen::TerminalOutput(document); | ||||
|   Render(screen, document.get()); | ||||
|  | ||||
|   std::cout << screen.ToString(); | ||||
|  | ||||
|   getchar(); | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Arthur Sonzogni
					Arthur Sonzogni