colorfull

This commit is contained in:
2025-07-09 18:07:53 +02:00
parent 1e9e142b05
commit 7df52db28a
3 changed files with 22 additions and 16 deletions

View File

@@ -36,9 +36,9 @@ use kira::{
use crate::utils::delta_to_string; use crate::utils::delta_to_string;
fn main() -> iced::Result { fn main() -> iced::Result {
let polytheme: Theme = { let polytheme: Theme = {
let back = Color::from_rgb8(0x25, 0x26, 0x27); let back = Color::from_rgb8(39, 63, 79);
let text = Color::from_rgb8(0xD3, 0xD4, 0xD9); let text = Color::from_rgb8(0xD3, 0xD4, 0xD9);
let prim = Color::from_rgb8(0x4B, 0x88, 0xA2); let prim = Color::from_rgb8(230, 82, 31);
let succ = Color::from_rgb8(0xFF, 0xF9, 0xFB); let succ = Color::from_rgb8(0xFF, 0xF9, 0xFB);
let dan = Color::from_rgb8(0xBB, 0x0A, 0x21); let dan = Color::from_rgb8(0xBB, 0x0A, 0x21);

View File

@@ -176,22 +176,13 @@ impl canvas::Program<Message> for Music {
iced::Point { x: x, y: 0.0 }, iced::Point { x: x, y: 0.0 },
frame.size(), frame.size(),
if toggle_color { if toggle_color {
Color::from_rgb(0.3, 0.3, 0.3) Color::from_rgb8(27, 60, 83)
} else { } else {
Color::from_rgb(0.1, 0.1, 0.1) Color::from_rgb8(69, 104, 130)
}, },
); );
toggle_color = !toggle_color; toggle_color = !toggle_color;
} }
frame.stroke_rectangle(
iced::Point { x: 0.0, y: 0.0 },
frame.size(),
Stroke {
width: 16.0,
..Stroke::default()
},
);
let x = self.current_delta / self.length * w + 8.; let x = self.current_delta / self.length * w + 8.;
frame.stroke_rectangle( frame.stroke_rectangle(
iced::Point::new(x, 0.), iced::Point::new(x, 0.),
@@ -201,7 +192,16 @@ impl canvas::Program<Message> for Music {
}, },
Stroke { Stroke {
width: 4.0, width: 4.0,
style: Style::Solid(Color::from_rgb(1.0, 0.0, 0.0)), style: Style::Solid(Color::from_rgba(1.0, 0.0, 0.0, 1.)),
..Stroke::default()
},
);
frame.stroke_rectangle(
iced::Point { x: 0.0, y: 0.0 },
frame.size(),
Stroke {
width: 16.0,
style: Style::Solid(Color::from_rgb8(207, 74, 28)),
..Stroke::default() ..Stroke::default()
}, },
); );

View File

@@ -67,13 +67,18 @@ impl<Message> canvas::Program<Message> for PolygonFrame {
let radius = frame.size().width.min(frame.size().height) / 2.0 - 32.0; let radius = frame.size().width.min(frame.size().height) / 2.0 - 32.0;
let mut vec = Vector::new(0.0, -radius); let mut vec = Vector::new(0.0, -radius);
let c = frame.center(); let c = frame.center();
frame.fill_rectangle(
iced::Point { x: 0., y: 0. },
frame.size(),
Color::from_rgb8(27, 60, 83),
);
// Draw Circle // Draw Circle
let circle = canvas::Path::circle(frame.center(), radius); let circle = canvas::Path::circle(frame.center(), radius);
frame.stroke( frame.stroke(
&circle, &circle,
Stroke { Stroke {
width: 6.0, width: 6.0,
style: Style::Solid(Color::from_rgba(0.0, 0.0, 0.0, 1.0)), style: Style::Solid(Color::from_rgb8(210, 193, 182)),
..Stroke::default() ..Stroke::default()
}, },
); );
@@ -100,7 +105,7 @@ impl<Message> canvas::Program<Message> for PolygonFrame {
} }
// Draw the red dot on the current position // Draw the red dot on the current position
let dot = canvas::Path::circle(frame.center() + vec.rotate(self.teta), 5.0); let dot = canvas::Path::circle(frame.center() + vec.rotate(self.teta), 10.0);
frame.fill(&dot, Color::from_rgb(1.0, 0.0, 0.0)); frame.fill(&dot, Color::from_rgb(1.0, 0.0, 0.0));
// Draw the frame // Draw the frame
@@ -109,6 +114,7 @@ impl<Message> canvas::Program<Message> for PolygonFrame {
frame.size(), frame.size(),
Stroke { Stroke {
width: 16.0, width: 16.0,
style: Style::Solid(Color::from_rgb8(207, 74, 28)),
..Stroke::default() ..Stroke::default()
}, },
); );