-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
text within textarea is bugged to always be black until new cursive r…
…elease
- Loading branch information
Showing
4 changed files
with
36 additions
and
4 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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
mod menu_bar; | ||
mod tab_bar; | ||
mod text_area; | ||
|
||
pub use menu_bar::menu_bar; | ||
pub use tab_bar::tab_bar; | ||
pub use text_area::text_area; |
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 |
---|---|---|
@@ -1,11 +1,19 @@ | ||
use cursive::{view::{Nameable, Resizable}, views::{TextView, TextArea, PaddedView}, Cursive}; | ||
use crate::views::text_area; | ||
|
||
use cursive::{ | ||
view::{Nameable, Resizable}, | ||
views::{PaddedView, TextView}, | ||
Cursive, | ||
}; | ||
use cursive_tabs::TabPanel; | ||
|
||
pub fn tab_bar(siv: &mut Cursive) { | ||
let panel = TabPanel::new() | ||
.with_tab(TextView::new("This is the first view!").with_name("First")) | ||
.with_tab(TextView::new("This is the second view!").with_name("Second")) | ||
.with_tab(PaddedView::lrtb(1, 1, 1, 1, TextArea::new()).with_name("4")); | ||
.with_tab( | ||
PaddedView::lrtb(1, 1, 1, 1, text_area(siv.current_theme().clone())).with_name("4"), | ||
); | ||
|
||
siv.add_layer(panel.full_screen()); | ||
} |
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,22 @@ | ||
use crate::theme::to_color; | ||
|
||
use blaze_core::colors::Palette; | ||
use cursive::{ | ||
theme::{PaletteColor, Theme}, | ||
views::{TextArea, ThemedView}, | ||
}; | ||
|
||
pub fn text_area(theme: Theme) -> ThemedView<TextArea> { | ||
ThemedView::new(custom_theme(theme), TextArea::new()) | ||
} | ||
|
||
fn custom_theme(current_theme: Theme) -> Theme { | ||
let mut theme = current_theme.clone(); | ||
let palette = Palette::new(false); | ||
|
||
//theme.palette[PaletteColor::Secondary] = to_color(palette.secondary.default); | ||
theme.palette[PaletteColor::Secondary] = to_color(palette.text.default); // TODO remove when cursive is 0.21 | ||
theme.palette[PaletteColor::View] = to_color(palette.text.default); //lib bug, the text should show up as white | ||
|
||
theme | ||
} |