Created
June 9, 2021 17:27
-
-
Save retupmoca/68a4852a28b7cf6d2c39a90d7670212f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "ftxui/dom/elements.hpp" | |
#include "ftxui/screen/screen.hpp" | |
#include "ftxui/screen/string.hpp" | |
int main(void) { | |
using namespace ftxui; | |
// plain UTF-8 output of a random combining character: | |
// https://www.fileformat.info/info/unicode/char/0303/index.htm | |
std::cout << "done\xcc\x83:\n"; | |
auto summary = [&] { | |
auto content = vbox({ | |
// converted UTF-8 | |
hbox({text(to_wstring(std::string("- done\xcc\x83: "))), text(L"3") | bold}) | color(Color::Green), | |
// UTF-16 / UCS-2 | |
hbox({text(L"- active\x0303: "), text(L"2") | bold}) | color(Color::RedLight), | |
hbox({text(L"- queue: "), text(L"9") | bold}) | color(Color::Red), | |
}); | |
return window(text(L" Summary "), content); | |
}; | |
auto document = // | |
vbox({ | |
hbox({ | |
summary(), | |
summary(), | |
summary() | flex, | |
}), | |
summary(), | |
summary(), | |
}); | |
// Limit the size of the document to 80 char. | |
document = document | size(WIDTH, LESS_THAN, 80); | |
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document)); | |
Render(screen, document); | |
std::cout << screen.ToString() << std::endl; | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment