1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

Move Color32 constants from mod color to struct Color32

This commit is contained in:
Emil Ernerfeldt
2021-01-02 17:18:41 +01:00
parent 64dd186daf
commit 029a85c1fc
20 changed files with 77 additions and 62 deletions

View File

@@ -213,7 +213,7 @@ impl BoxPainting {
response.rect,
self.corner_radius,
Color32::gray(64),
Stroke::new(self.stroke_width, WHITE),
Stroke::new(self.stroke_width, Color32::WHITE),
);
}
});
@@ -388,7 +388,11 @@ impl Tree {
}
fn children_ui(&mut self, ui: &mut Ui, depth: usize) -> Action {
if depth > 0 && ui.add(Button::new("delete").text_color(color::RED)).clicked {
if depth > 0
&& ui
.add(Button::new("delete").text_color(Color32::RED))
.clicked
{
return Action::Delete;
}

View File

@@ -11,7 +11,7 @@ impl Default for Painting {
fn default() -> Self {
Self {
lines: Default::default(),
stroke: Stroke::new(1.0, color::LIGHT_BLUE),
stroke: Stroke::new(1.0, Color32::LIGHT_BLUE),
}
}
}

View File

@@ -48,7 +48,7 @@ impl Scrolls {
const ALIGNS: [Align; 3] = [Align::Min, Align::Center, Align::Max];
ui.columns(3, |cols| {
for (i, col) in cols.iter_mut().enumerate() {
col.colored_label(WHITE, TITLES[i]);
col.colored_label(Color32::WHITE, TITLES[i]);
let mut scroll_area = ScrollArea::from_max_height(200.0).id_source(i);
if scroll_offset {
self.tracking = false;
@@ -62,7 +62,8 @@ impl Scrolls {
ui.vertical(|ui| {
for item in 1..=50 {
if self.tracking && item == self.track_item {
let response = ui.colored_label(YELLOW, format!("Item {}", item));
let response =
ui.colored_label(Color32::YELLOW, format!("Item {}", item));
response.scroll_to_me(ALIGNS[i]);
} else {
ui.label(format!("Item {}", item));
@@ -80,7 +81,10 @@ impl Scrolls {
ui.min_rect().height() - ui.clip_rect().height() + 2.0 * margin,
)
});
col.colored_label(WHITE, format!("{:.0}/{:.0}", current_scroll, max_scroll));
col.colored_label(
Color32::WHITE,
format!("{:.0}/{:.0}", current_scroll, max_scroll),
);
}
});
}