figma_api/models/
color_stop.rs

1/*
2 * Figma API
3 *
4 * This is the OpenAPI specification for the [Figma REST API](https://www.figma.com/developers/api).  Note: we are releasing the OpenAPI specification as a beta given the large surface area and complexity of the REST API. If you notice any inaccuracies with the specification, please [file an issue](https://github.com/figma/rest-api-spec/issues).
5 *
6 * The version of the OpenAPI document: 0.31.0
7 * Contact: support@figma.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// ColorStop : A single color stop with its position along the gradient axis, color, and bound variables if any
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ColorStop {
17    /// Value between 0 and 1 representing position along gradient axis.
18    #[serde(rename = "position")]
19    pub position: f64,
20    /// Color attached to corresponding position.
21    #[serde(rename = "color")]
22    pub color: Box<models::Rgba>,
23    #[serde(rename = "boundVariables", skip_serializing_if = "Option::is_none")]
24    pub bound_variables: Option<Box<models::ColorStopBoundVariables>>,
25}
26
27impl ColorStop {
28    /// A single color stop with its position along the gradient axis, color, and bound variables if any
29    pub fn new(position: f64, color: models::Rgba) -> ColorStop {
30        ColorStop {
31            position,
32            color: Box::new(color),
33            bound_variables: None,
34        }
35    }
36}
37