Skip to content

Commit

Permalink
Fixed Tab_bar colors
Browse files Browse the repository at this point in the history
  • Loading branch information
genusistimelord committed Jun 20, 2024
1 parent 2eef504 commit 4eb561d
Showing 1 changed file with 16 additions and 38 deletions.
54 changes: 16 additions & 38 deletions src/style/tab_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,24 +108,17 @@ pub fn primary(theme: &Theme, status: Status) -> Style {

/// The dark theme of a [`TabBar`](crate::widgets::tab_bar::TabBar).
#[must_use]
pub fn dark(theme: &Theme, status: Status) -> Style {
let mut base = Style::default();
let palette = theme.extended_palette();

base.tab_label_border_color = [0.3, 0.3, 0.3].into();
base.icon_color = Color::WHITE;
base.text_color = Color::WHITE;
pub fn dark(_theme: &Theme, status: Status) -> Style {
let mut base = Style {
tab_label_background: Background::Color([0.1, 0.1, 0.1].into()),
tab_label_border_color: [0.3, 0.3, 0.3].into(),
icon_color: Color::WHITE,
text_color: Color::WHITE,
..Default::default()
};

match status {
Status::Disabled => {
base.tab_label_background = Background::Color([0.13, 0.13, 0.13].into());
}
Status::Hovered => {
base.tab_label_background = Background::Color(palette.primary.strong.color);
}
_ => {
base.tab_label_background = Background::Color([0.1, 0.1, 0.1].into());
}
if status == Status::Disabled {
base.tab_label_background = Background::Color([0.13, 0.13, 0.13].into());
}

base
Expand All @@ -135,26 +128,18 @@ pub fn dark(theme: &Theme, status: Status) -> Style {
#[must_use]
pub fn red(_theme: &Theme, status: Status) -> Style {
let mut base = Style {
tab_label_background: Background::Color([0.0, 0.0, 1.0].into()),
tab_label_border_color: [0.0, 0.0, 1.0].into(),
tab_label_background: Background::Color([1.0, 0.0, 0.0].into()),
tab_label_border_color: Color::TRANSPARENT,
tab_label_border_width: 0.0,
icon_color: Color::WHITE,
text_color: Color::WHITE,
..Default::default()
};

match status {
Status::Disabled => {
base.tab_label_background = Background::Color([0.13, 0.13, 0.13].into());
base.icon_color = Color::BLACK;
base.text_color = Color::BLACK;
}
Status::Hovered => {
base.tab_label_background = Background::Color([1.0, 0.0, 0.0].into());
}
_ => {
base.tab_label_background = Background::Color([0.1, 0.1, 0.1].into());
}
if status == Status::Disabled {
base.tab_label_background = Background::Color([0.13, 0.13, 0.13].into());
base.icon_color = Color::BLACK;
base.text_color = Color::BLACK;
}

base
Expand All @@ -174,9 +159,6 @@ pub fn blue(_theme: &Theme, status: Status) -> Style {
if status == Status::Disabled {
base.tab_label_background = Background::Color([0.5, 0.5, 1.0].into());
base.tab_label_border_color = [0.5, 0.5, 1.0].into();
} else {
base.tab_label_background = Background::Color([0.0, 0.0, 1.0].into());
base.tab_label_border_color = [0.0, 0.0, 1.0].into();
}

base
Expand All @@ -194,14 +176,10 @@ pub fn green(_theme: &Theme, status: Status) -> Style {

match status {
Status::Disabled => {
base.tab_label_background = Background::Color([0.5, 0.5, 1.0].into());
base.icon_color = [0.7, 0.7, 0.7].into();
base.text_color = [0.7, 0.7, 0.7].into();
base.tab_label_border_color = [0.7, 0.7, 0.7].into();
}
Status::Hovered => {
base.tab_label_border_color = [0.0, 0.0, 1.0].into();
}
_ => {
base.tab_label_border_color = [0.0, 0.5, 0.0].into();
}
Expand Down

0 comments on commit 4eb561d

Please sign in to comment.