yew_scroll_area/
color.rs

1use yew::prelude::*;
2
3/// Color struct for ScrollArea's scrollbar.
4#[derive(Debug, Clone, Copy, PartialEq, Properties)]
5pub struct Color {
6    pub r: u8,
7    pub g: u8,
8    pub b: u8,
9    pub a: f64,
10}
11impl Color {
12    pub fn rgba(r: u8, g: u8, b: u8, a: f64) -> Self {
13        Self { r, g, b, a }
14    }
15
16    pub fn black() -> Self {
17        Self::rgba(0, 0, 0, 1.0)
18    }
19
20    pub fn white() -> Self {
21        Self::rgba(255, 255, 255, 1.0)
22    }
23}
24impl Default for Color {
25    fn default() -> Self {
26        Self::black()
27    }
28}