Skip to content

Commit

Permalink
rename sickle_ui_scaffold::theme::theme_colors::On to OnColor
Browse files Browse the repository at this point in the history
  • Loading branch information
eidloi committed Sep 14, 2024
1 parent 83ed461 commit 3c8c879
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 68 deletions.
2 changes: 1 addition & 1 deletion crates/sickle_ui_scaffold/src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub mod prelude {
AnimationLoop, AnimationSettings, AnimationState, InteractionStyle,
LoopedAnimationConfig,
},
theme_colors::{Accent, Container, On, Surface},
theme_colors::{Accent, Container, OnColor, Surface},
theme_data::{Contrast, Scheme, ThemeData},
typography::{FontScale, FontStyle, FontType, SizedFont},
ComponentThemePlugin, CustomThemeUpdate, DefaultTheme, DynamicStyleBuilder, PseudoTheme,
Expand Down
40 changes: 20 additions & 20 deletions crates/sickle_ui_scaffold/src/theme/theme_colors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub enum Container {
}

#[derive(Clone, Copy, Debug)]
pub enum On {
pub enum OnColor {
Primary,
PrimaryContainer,
PrimaryFixed,
Expand Down Expand Up @@ -384,26 +384,26 @@ impl SchemeColors {
}
}

pub fn on(&self, on: On) -> Color {
pub fn on(&self, on: OnColor) -> Color {
match on {
On::Primary => self.on_primary,
On::PrimaryContainer => self.on_primary_container,
On::PrimaryFixed => self.on_primary_fixed,
On::PrimaryFixedVariant => self.on_primary_fixed_variant,
On::Secondary => self.on_secondary,
On::SecondaryContainer => self.on_secondary_container,
On::SecondaryFixed => self.on_secondary_fixed,
On::SecondaryFixedVariant => self.on_secondary_fixed_variant,
On::Tertiary => self.on_tertiary,
On::TertiaryContainer => self.on_tertiary_container,
On::TertiaryFixed => self.on_tertiary_fixed,
On::TertiaryFixedVariant => self.on_tertiary_fixed_variant,
On::Error => self.on_error,
On::ErrorContainer => self.on_error_container,
On::Background => self.on_background,
On::Surface => self.on_surface,
On::SurfaceVariant => self.on_surface_variant,
On::InverseSurface => self.inverse_on_surface,
OnColor::Primary => self.on_primary,
OnColor::PrimaryContainer => self.on_primary_container,
OnColor::PrimaryFixed => self.on_primary_fixed,
OnColor::PrimaryFixedVariant => self.on_primary_fixed_variant,
OnColor::Secondary => self.on_secondary,
OnColor::SecondaryContainer => self.on_secondary_container,
OnColor::SecondaryFixed => self.on_secondary_fixed,
OnColor::SecondaryFixedVariant => self.on_secondary_fixed_variant,
OnColor::Tertiary => self.on_tertiary,
OnColor::TertiaryContainer => self.on_tertiary_container,
OnColor::TertiaryFixed => self.on_tertiary_fixed,
OnColor::TertiaryFixedVariant => self.on_tertiary_fixed_variant,
OnColor::Error => self.on_error,
OnColor::ErrorContainer => self.on_error_container,
OnColor::Background => self.on_background,
OnColor::Surface => self.on_surface,
OnColor::SurfaceVariant => self.on_surface_variant,
OnColor::InverseSurface => self.inverse_on_surface,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/dev_panels/entity_component_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl EntityComponentTag {
style_builder
.switch_target(EntityComponentTag::LABEL)
.sized_font(font)
.font_color(colors.on(On::Tertiary));
.font_color(colors.on(OnColor::Tertiary));
}

fn frame() -> impl Bundle {
Expand Down
10 changes: 5 additions & 5 deletions src/widgets/inputs/checkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ impl Checkbox {
)))
.animated()
.border_color(AnimatedVals {
idle: colors.on(On::SurfaceVariant),
hover: colors.on(On::Surface).into(),
idle: colors.on(OnColor::SurfaceVariant),
hover: colors.on(OnColor::Surface).into(),
..default()
})
.copy_from(theme_data.interaction_animation);
Expand All @@ -179,7 +179,7 @@ impl Checkbox {
.switch_target(Checkbox::CHECKMARK)
.size(Val::Px(theme_spacing.inputs.checkbox.checkmark_size))
.icon(theme_data.icons.checkmark.with(
colors.on(On::Primary),
colors.on(OnColor::Primary),
theme_spacing.inputs.checkbox.checkmark_size,
));

Expand All @@ -197,8 +197,8 @@ impl Checkbox {
.sized_font(font)
.animated()
.font_color(AnimatedVals {
idle: colors.on(On::SurfaceVariant),
hover: colors.on(On::Surface).into(),
idle: colors.on(OnColor::SurfaceVariant),
hover: colors.on(OnColor::Surface).into(),
..default()
})
.copy_from(theme_data.interaction_animation);
Expand Down
18 changes: 9 additions & 9 deletions src/widgets/inputs/dropdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ impl DropdownOption {
.sized_font(font)
.animated()
.font_color(AnimatedVals {
idle: colors.on(On::PrimaryContainer),
hover: colors.on(On::Primary).into(),
idle: colors.on(OnColor::PrimaryContainer),
hover: colors.on(OnColor::Primary).into(),
..default()
})
.copy_from(theme_data.interaction_animation);
Expand Down Expand Up @@ -426,8 +426,8 @@ impl Dropdown {
.sized_font(font)
.animated()
.font_color(AnimatedVals {
idle: colors.on(On::Primary),
hover: colors.on(On::PrimaryContainer).into(),
idle: colors.on(OnColor::Primary),
hover: colors.on(OnColor::PrimaryContainer).into(),
..default()
})
.copy_from(theme_data.interaction_animation);
Expand All @@ -440,12 +440,12 @@ impl Dropdown {
theme_data
.icons
.expand_more
.with(colors.on(On::Primary), theme_spacing.icons.small),
.with(colors.on(OnColor::Primary), theme_spacing.icons.small),
)
.animated()
.font_color(AnimatedVals {
idle: colors.on(On::Primary),
hover: colors.on(On::PrimaryContainer).into(),
idle: colors.on(OnColor::Primary),
hover: colors.on(OnColor::PrimaryContainer).into(),
..default()
})
.copy_from(theme_data.interaction_animation);
Expand Down Expand Up @@ -540,10 +540,10 @@ impl Dropdown {

style_builder
.switch_target(Dropdown::LABEL)
.font_color(colors.on(On::PrimaryContainer));
.font_color(colors.on(OnColor::PrimaryContainer));
style_builder
.switch_target(Dropdown::ICON)
.font_color(colors.on(On::PrimaryContainer));
.font_color(colors.on(OnColor::PrimaryContainer));

style_builder
.switch_target(Dropdown::PANEL)
Expand Down
16 changes: 8 additions & 8 deletions src/widgets/inputs/radio_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ impl RadioButton {
.visibility(Visibility::Inherited)
.animated()
.border_color(AnimatedVals {
idle: colors.on(On::SurfaceVariant),
hover: colors.on(On::Surface).into(),
idle: colors.on(OnColor::SurfaceVariant),
hover: colors.on(OnColor::Surface).into(),
..default()
})
.copy_from(theme_data.interaction_animation);
Expand All @@ -281,7 +281,7 @@ impl RadioButton {
style_builder
.switch_target(RadioButton::RADIOMARK)
.size(Val::Px(theme_spacing.inputs.radio_button.radiomark_size))
.background_color(colors.on(On::Primary))
.background_color(colors.on(OnColor::Primary))
.border_radius(BorderRadius::all(Val::Px(
theme_spacing.inputs.radio_button.radiomark_size,
)));
Expand All @@ -300,8 +300,8 @@ impl RadioButton {
.sized_font(font)
.animated()
.font_color(AnimatedVals {
idle: colors.on(On::SurfaceVariant),
hover: colors.on(On::Surface).into(),
idle: colors.on(OnColor::SurfaceVariant),
hover: colors.on(OnColor::Surface).into(),
..default()
})
.copy_from(theme_data.interaction_animation);
Expand All @@ -320,8 +320,8 @@ impl RadioButton {
.switch_target(RadioButton::RADIOMARK)
.animated()
.background_color(AnimatedVals {
idle: colors.on(On::Primary),
enter_from: colors.on(On::Surface).into(),
idle: colors.on(OnColor::Primary),
enter_from: colors.on(OnColor::Surface).into(),
..default()
})
.copy_from(theme_data.enter_animation);
Expand All @@ -338,7 +338,7 @@ impl RadioButton {

style_builder
.switch_target(RadioButton::LABEL)
.font_color(colors.on(On::SurfaceVariant));
.font_color(colors.on(OnColor::SurfaceVariant));
}

fn button(name: String) -> impl Bundle {
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/inputs/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ impl Slider {
style_builder
.switch_target(Slider::LABEL)
.sized_font(font.clone())
.font_color(colors.on(On::Surface));
.font_color(colors.on(OnColor::Surface));

if slider.config().label.is_none() {
style_builder
Expand Down Expand Up @@ -548,7 +548,7 @@ impl Slider {
style_builder
.switch_target(Slider::READOUT)
.sized_font(font.clone())
.font_color(colors.on(On::Surface));
.font_color(colors.on(OnColor::Surface));

style_builder
.switch_target(Slider::BAR)
Expand Down
16 changes: 8 additions & 8 deletions src/widgets/layout/floating_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ impl FloatingPanel {
.text
.get(FontStyle::Body, FontScale::Large, FontType::Regular),
)
.font_color(colors.on(On::Surface));
.font_color(colors.on(OnColor::Surface));

style_builder
.switch_target(FloatingPanel::CLOSE_BUTTON_CONTAINER)
Expand Down Expand Up @@ -737,12 +737,12 @@ impl FloatingPanel {
theme_data
.icons
.expand_more
.with(colors.on(On::Surface), theme_spacing.icons.small),
.with(colors.on(OnColor::Surface), theme_spacing.icons.small),
)
.animated()
.font_color(AnimatedVals {
idle: colors.on(On::SurfaceVariant),
hover: colors.on(On::Surface).into(),
idle: colors.on(OnColor::SurfaceVariant),
hover: colors.on(OnColor::Surface).into(),
..default()
})
.copy_from(theme_data.interaction_animation);
Expand All @@ -755,12 +755,12 @@ impl FloatingPanel {
theme_data
.icons
.close
.with(colors.on(On::Surface), theme_spacing.icons.small),
.with(colors.on(OnColor::Surface), theme_spacing.icons.small),
)
.animated()
.font_color(AnimatedVals {
idle: colors.on(On::SurfaceVariant),
hover: colors.on(On::Surface).into(),
idle: colors.on(OnColor::SurfaceVariant),
hover: colors.on(OnColor::Surface).into(),
..default()
})
.copy_from(theme_data.interaction_animation);
Expand Down Expand Up @@ -800,7 +800,7 @@ impl FloatingPanel {
theme_data
.icons
.chevron_right
.with(colors.on(On::Surface), theme_spacing.icons.small),
.with(colors.on(OnColor::Surface), theme_spacing.icons.small),
);
}

Expand Down
14 changes: 7 additions & 7 deletions src/widgets/layout/foldable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ impl Foldable {
theme_data
.icons
.expand_more
.with(colors.on(On::Surface), theme_spacing.icons.small),
.with(colors.on(OnColor::Surface), theme_spacing.icons.small),
)
.animated()
.font_color(AnimatedVals {
idle: colors.on(On::SurfaceVariant),
hover: colors.on(On::Surface).into(),
idle: colors.on(OnColor::SurfaceVariant),
hover: colors.on(OnColor::Surface).into(),
..default()
})
.copy_from(theme_data.interaction_animation);
Expand All @@ -173,8 +173,8 @@ impl Foldable {
.sized_font(font)
.animated()
.font_color(AnimatedVals {
idle: colors.on(On::SurfaceVariant),
hover: colors.on(On::Surface).into(),
idle: colors.on(OnColor::SurfaceVariant),
hover: colors.on(OnColor::Surface).into(),
..default()
})
.copy_from(theme_data.interaction_animation);
Expand All @@ -195,7 +195,7 @@ impl Foldable {
theme_data
.icons
.chevron_right
.with(colors.on(On::Surface), theme_spacing.icons.small),
.with(colors.on(OnColor::Surface), theme_spacing.icons.small),
);

style_builder
Expand All @@ -212,7 +212,7 @@ impl Foldable {
theme_data
.icons
.arrow_right
.with(colors.on(On::Surface), theme_spacing.icons.small),
.with(colors.on(OnColor::Surface), theme_spacing.icons.small),
);

style_builder
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/layout/tab_container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ impl Tab {
style_builder
.switch_target(Tab::LABEL)
.sized_font(font)
.font_color(colors.on(On::Surface));
.font_color(colors.on(OnColor::Surface));

style_builder
.switch_target(Tab::PANEL)
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/menus/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl Menu {
style_builder
.switch_target(Menu::LABEL)
.sized_font(font)
.font_color(colors.on(On::Surface));
.font_color(colors.on(OnColor::Surface));

style_builder
.switch_target(Menu::CONTAINER)
Expand Down Expand Up @@ -271,7 +271,7 @@ impl Menu {

style_builder
.switch_target(Menu::LABEL)
.font_color(colors.on(On::Surface));
.font_color(colors.on(OnColor::Surface));

style_builder
.switch_target(Menu::CONTAINER)
Expand Down
8 changes: 4 additions & 4 deletions src/widgets/menus/menu_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl MenuItem {
.copy_from(theme_data.interaction_animation);

let leading_icon = match leading_icon.is_codepoint() {
true => leading_icon.with(colors.on(On::SurfaceVariant), theme_spacing.icons.small),
true => leading_icon.with(colors.on(OnColor::SurfaceVariant), theme_spacing.icons.small),
false => leading_icon,
};
style_builder
Expand All @@ -246,7 +246,7 @@ impl MenuItem {
.switch_target(MenuItem::LABEL)
.margin(UiRect::horizontal(Val::Px(theme_spacing.gaps.small)))
.sized_font(font.clone())
.font_color(colors.on(On::Surface));
.font_color(colors.on(OnColor::Surface));

style_builder
.switch_target(MenuItem::SHORTCUT_CONTAINER)
Expand All @@ -258,10 +258,10 @@ impl MenuItem {
style_builder
.switch_target(MenuItem::SHORTCUT)
.sized_font(font)
.font_color(colors.on(On::SurfaceVariant));
.font_color(colors.on(OnColor::SurfaceVariant));

let trailing_icon = match trailing_icon.is_codepoint() {
true => trailing_icon.with(colors.on(On::SurfaceVariant), theme_spacing.icons.small),
true => trailing_icon.with(colors.on(OnColor::SurfaceVariant), theme_spacing.icons.small),
false => trailing_icon,
};
style_builder
Expand Down

0 comments on commit 3c8c879

Please sign in to comment.