-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
karm-text: Allow text to be colored.
- Loading branch information
1 parent
c721aee
commit 1eda808
Showing
7 changed files
with
161 additions
and
59 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#pragma once | ||
|
||
#include <karm-kira/titlebar.h> | ||
#include <karm-ui/layout.h> | ||
#include <mdi/text-box.h> | ||
|
||
#include "model.h" | ||
|
||
namespace Hideo::Zoo { | ||
|
||
static inline Page PAGE_RICHTEXT{ | ||
Mdi::TEXT_BOX, | ||
"Rich Text"s, | ||
"An area that displays text with various styles and formatting options.", | ||
[] { | ||
auto prose = makeStrong<Text::Prose>(Ui::TextStyles::bodyMedium()); | ||
|
||
prose->append("This is a simple text with no formatting.\n"s); | ||
|
||
prose->append("We can change color: "s); | ||
|
||
prose->pushSpan(); | ||
prose->spanColor(Gfx::RED); | ||
prose->append("red"s); | ||
prose->popSpan(); | ||
prose->append(", "s); | ||
|
||
prose->pushSpan(); | ||
prose->spanColor(Gfx::GREEN); | ||
prose->append(" green"s); | ||
prose->popSpan(); | ||
prose->append(", "s); | ||
|
||
prose->pushSpan(); | ||
prose->spanColor(Gfx::BLUE); | ||
prose->append("blue"s); | ||
prose->popSpan(); | ||
|
||
prose->append(".\n"s); | ||
|
||
return Ui::text(prose) | Ui::center(); | ||
}, | ||
}; | ||
|
||
} // namespace Hideo::Zoo |
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
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
Oops, something went wrong.