Add Style variant support to application::StyleSheet
This commit is contained in:
parent
fa55dff61d
commit
bb07d017e8
11 changed files with 148 additions and 43 deletions
|
|
@ -12,7 +12,8 @@ use iced_glow::glow;
|
|||
use iced_glow::{Backend, Renderer, Settings, Viewport};
|
||||
use iced_glutin::conversion;
|
||||
use iced_glutin::glutin;
|
||||
use iced_glutin::{program, Clipboard, Debug, Size};
|
||||
use iced_glutin::renderer;
|
||||
use iced_glutin::{program, Clipboard, Color, Debug, Size};
|
||||
|
||||
pub fn main() {
|
||||
env_logger::init();
|
||||
|
|
@ -126,6 +127,9 @@ pub fn main() {
|
|||
),
|
||||
&mut renderer,
|
||||
&iced_glow::Theme::Dark,
|
||||
&renderer::Style {
|
||||
text_color: Color::WHITE,
|
||||
},
|
||||
&mut clipboard,
|
||||
&mut debug,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@ use controls::Controls;
|
|||
use scene::Scene;
|
||||
|
||||
use iced_wgpu::{wgpu, Backend, Renderer, Settings, Viewport};
|
||||
use iced_winit::{conversion, futures, program, winit, Clipboard, Debug, Size};
|
||||
use iced_winit::{
|
||||
conversion, futures, program, renderer, winit, Clipboard, Color, Debug,
|
||||
Size,
|
||||
};
|
||||
|
||||
use winit::{
|
||||
dpi::PhysicalPosition,
|
||||
|
|
@ -189,6 +192,7 @@ pub fn main() {
|
|||
),
|
||||
&mut renderer,
|
||||
&iced_wgpu::Theme::Dark,
|
||||
&renderer::Style { text_color: Color::WHITE },
|
||||
&mut clipboard,
|
||||
&mut debug,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -6,13 +6,15 @@
|
|||
//! Inspired by the example found in the MDN docs[1].
|
||||
//!
|
||||
//! [1]: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations#An_animated_solar_system
|
||||
use iced::application;
|
||||
use iced::canvas::{self, Cursor, Path, Stroke};
|
||||
use iced::executor;
|
||||
use iced::theme::{self, Theme};
|
||||
use iced::time;
|
||||
use iced::window;
|
||||
use iced::{
|
||||
Application, Canvas, Color, Command, Element, Length, Point, Rectangle,
|
||||
Settings, Size, Subscription, Theme, Vector,
|
||||
Settings, Size, Subscription, Vector,
|
||||
};
|
||||
|
||||
use std::time::Instant;
|
||||
|
|
@ -77,6 +79,13 @@ impl Application for SolarSystem {
|
|||
fn theme(&self) -> Theme {
|
||||
Theme::Dark
|
||||
}
|
||||
|
||||
fn style(&self) -> theme::Application {
|
||||
theme::Application::Custom(|_theme| application::Appearance {
|
||||
background_color: Color::BLACK,
|
||||
text_color: Color::WHITE,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue