Upgrade SAO theming #43

Merged
mars merged 17 commits from upgrade-sao-theming into main 2022-11-18 23:53:17 +00:00
1 changed files with 6 additions and 7 deletions
Showing only changes of commit ce7d641795 - Show all commits

View File

@ -224,6 +224,7 @@ pub struct TabMenu {
impl TabMenu { impl TabMenu {
const HEAD_RADIUS: f32 = 5.0; const HEAD_RADIUS: f32 = 5.0;
const HEAD_HEIGHT: f32 = 15.0; const HEAD_HEIGHT: f32 = 15.0;
const HEAD_COLOR: Color = THEME.palette.surface;
const TAB_WIDTH: f32 = 15.0; const TAB_WIDTH: f32 = 15.0;
const TAB_HEIGHT: f32 = 25.0; const TAB_HEIGHT: f32 = 25.0;
const TAB_NUM: usize = 6; const TAB_NUM: usize = 6;
@ -235,9 +236,9 @@ impl TabMenu {
radius: Self::HEAD_HEIGHT * 0.25, radius: Self::HEAD_HEIGHT * 0.25,
spacing: Self::HEAD_HEIGHT * 0.1, spacing: Self::HEAD_HEIGHT * 0.1,
thickness: Self::HEAD_HEIGHT * 0.05, thickness: Self::HEAD_HEIGHT * 0.05,
body_color: Color::WHITE, body_color: Self::HEAD_COLOR,
ring_color: Color::BLACK, ring_color: THEME.palette.black,
icon_color: Color::BLACK, icon_color: THEME.palette.black,
}; };
const HEAD_BUTTON_MARGIN: f32 = Self::HEAD_HEIGHT / 2.0; const HEAD_BUTTON_MARGIN: f32 = Self::HEAD_HEIGHT / 2.0;
@ -348,20 +349,18 @@ impl Container for TabMenu {
} }
fn draw(&mut self, ctx: &DrawContext) { fn draw(&mut self, ctx: &DrawContext) {
let head_color = Color::WHITE;
ctx.draw_partially_rounded_rect( ctx.draw_partially_rounded_rect(
CornerFlags::BOTTOM_RIGHT, CornerFlags::BOTTOM_RIGHT,
self.separator_rect, self.separator_rect,
Self::INNER_RADIUS, Self::INNER_RADIUS,
head_color, Self::HEAD_COLOR,
); );
ctx.draw_partially_rounded_rect( ctx.draw_partially_rounded_rect(
CornerFlags::TOP, CornerFlags::TOP,
self.head_rect, self.head_rect,
Self::HEAD_RADIUS, Self::HEAD_RADIUS,
head_color, Self::HEAD_COLOR,
); );
} }
} }