summaryrefslogtreecommitdiffstats
path: root/native/src/renderer
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--native/src/renderer.rs20
-rw-r--r--native/src/renderer/null.rs3
-rw-r--r--native/src/renderer/text.rs4
3 files changed, 17 insertions, 10 deletions
diff --git a/native/src/renderer.rs b/native/src/renderer.rs
index 382edb61..e48c701d 100644
--- a/native/src/renderer.rs
+++ b/native/src/renderer.rs
@@ -34,11 +34,6 @@ use crate::{Background, Color, Element, Rectangle, Vector};
/// A component that can take the state of a user interface and produce an
/// output for its users.
pub trait Renderer: Sized {
- /// The default styling attributes of the [`Renderer`].
- ///
- /// This type can be leveraged to implement style inheritance.
- type Defaults: Default;
-
/// Lays out the elements of a user interface.
///
/// You should override this if you need to perform any operations before or
@@ -71,3 +66,18 @@ pub struct Quad {
pub border_width: f32,
pub border_color: Color,
}
+
+/// The styling attributes of a [`Renderer`].
+#[derive(Debug, Clone, Copy, PartialEq)]
+pub struct Style {
+ /// The text color
+ pub text_color: Color,
+}
+
+impl Default for Style {
+ fn default() -> Self {
+ Style {
+ text_color: Color::BLACK,
+ }
+ }
+}
diff --git a/native/src/renderer/null.rs b/native/src/renderer/null.rs
index 960a5727..268248fd 100644
--- a/native/src/renderer/null.rs
+++ b/native/src/renderer/null.rs
@@ -5,7 +5,6 @@ use crate::pane_grid;
use crate::progress_bar;
use crate::radio;
use crate::renderer::{self, Renderer};
-use crate::scrollable;
use crate::slider;
use crate::text;
use crate::text_input;
@@ -26,8 +25,6 @@ impl Null {
}
impl Renderer for Null {
- type Defaults = ();
-
fn with_layer(
&mut self,
_bounds: Rectangle,
diff --git a/native/src/renderer/text.rs b/native/src/renderer/text.rs
index 5c189d89..9234c587 100644
--- a/native/src/renderer/text.rs
+++ b/native/src/renderer/text.rs
@@ -12,8 +12,8 @@ pub trait Text: Renderer {
pub struct Section<'a, Font> {
pub content: &'a str,
pub bounds: Rectangle,
- pub size: Option<f32>,
- pub color: Option<Color>,
+ pub size: f32,
+ pub color: Color,
pub font: Font,
pub horizontal_alignment: alignment::Horizontal,
pub vertical_alignment: alignment::Vertical,