fix: Navigation button theming
This commit is contained in:
parent
4a899189e6
commit
702ea033af
2 changed files with 9 additions and 8 deletions
|
|
@ -694,19 +694,15 @@ impl svg::StyleSheet for Theme {
|
|||
/*
|
||||
* TODO: Text
|
||||
*/
|
||||
#[derive(Clone, Copy)]
|
||||
#[derive(Clone, Copy, Default)]
|
||||
pub enum Text {
|
||||
Accent,
|
||||
#[default]
|
||||
Default,
|
||||
Color(Color),
|
||||
Custom(fn(&Theme) -> text::Appearance),
|
||||
}
|
||||
|
||||
impl Default for Text {
|
||||
fn default() -> Self {
|
||||
Self::Default
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Color> for Text {
|
||||
fn from(color: Color) -> Self {
|
||||
Text::Color(color)
|
||||
|
|
@ -718,6 +714,9 @@ impl text::StyleSheet for Theme {
|
|||
|
||||
fn appearance(&self, style: Self::Style) -> text::Appearance {
|
||||
match style {
|
||||
Text::Accent => text::Appearance {
|
||||
color: Some(self.cosmic().accent.base.into())
|
||||
},
|
||||
Text::Default => Default::default(),
|
||||
Text::Color(c) => text::Appearance { color: Some(c) },
|
||||
Text::Custom(f) => f(self),
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ impl<Message: Clone> Component<Message, Renderer> for HeaderBar<Message> {
|
|||
fn view(&self, _state: &Self::State) -> Element<Self::Event> {
|
||||
let nav_button = {
|
||||
let text = widget::text(&self.nav_title)
|
||||
.style(theme::Text::Accent)
|
||||
.vertical_alignment(Vertical::Center)
|
||||
.width(Length::Shrink)
|
||||
.height(Length::Fill);
|
||||
|
|
@ -81,6 +82,7 @@ impl<Message: Clone> Component<Message, Renderer> for HeaderBar<Message> {
|
|||
},
|
||||
24,
|
||||
)
|
||||
.style(theme::Svg::Accent)
|
||||
.width(Length::Units(24))
|
||||
.height(Length::Fill);
|
||||
|
||||
|
|
@ -88,7 +90,7 @@ impl<Message: Clone> Component<Message, Renderer> for HeaderBar<Message> {
|
|||
.padding(4)
|
||||
.spacing(4)
|
||||
.apply(widget::button)
|
||||
.style(theme::Button::Primary)
|
||||
.style(theme::Button::Secondary)
|
||||
.on_press(HeaderEvent::ToggleSidebar)
|
||||
.apply(widget::container)
|
||||
.center_y()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue