livesplit_core/settings/gradient.rs
1use super::Color;
2use serde::{Deserialize, Serialize};
3
4/// Describes a Gradient for coloring a region with more than just a single
5/// color.
6#[derive(Debug, Copy, Clone, Default, Serialize, Deserialize, PartialEq)]
7pub enum Gradient {
8 /// Don't use any color, keep it transparent.
9 #[default]
10 Transparent,
11 /// Use a single color instead of a full gradient.
12 Plain(Color),
13 /// Use a vertical gradient (Top, Bottom).
14 Vertical(Color, Color),
15 /// Use a horizontal gradient (Left, Right).
16 Horizontal(Color, Color),
17}
18
19/// Describes an extended form of a gradient, specifically made for use with
20/// lists. It allows specifying different coloration for the rows in a list.
21#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq)]
22pub enum ListGradient {
23 /// Use the same gradient for every row in the list.
24 Same(Gradient),
25 /// Alternate between two colors for each row (Even Index, Odd Index).
26 Alternating(Color, Color),
27}
28
29impl Default for ListGradient {
30 fn default() -> Self {
31 ListGradient::Same(Gradient::Transparent)
32 }
33}