mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
Reflect default in colorspaces in bevy_color
(#12528)
# Objective - For some reason, we don't reflect the Default trait in colorspaces ## Solution - Reflect it. ---
This commit is contained in:
parent
e9dc270d68
commit
7002b24379
11 changed files with 22 additions and 22 deletions
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
Alpha, Hsla, Hsva, Hwba, Laba, Lcha, LinearRgba, Oklaba, Oklcha, Srgba, StandardColor, Xyza,
|
||||
};
|
||||
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
|
||||
use bevy_reflect::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// An enumerated type that can represent any of the color types in this crate.
|
||||
|
@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
|
|||
#[doc = include_str!("../docs/diagrams/model_graph.svg")]
|
||||
/// </div>
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize, Default)]
|
||||
pub enum Color {
|
||||
/// A color in the sRGB color space with alpha.
|
||||
Srgba(Srgba),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{Alpha, Hsva, Hwba, Lcha, LinearRgba, Luminance, Mix, Srgba, StandardColor, Xyza};
|
||||
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
|
||||
use bevy_reflect::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Color in Hue-Saturation-Lightness (HSL) color space with alpha.
|
||||
|
@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
|
|||
#[doc = include_str!("../docs/diagrams/model_graph.svg")]
|
||||
/// </div>
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize, Default)]
|
||||
pub struct Hsla {
|
||||
/// The hue channel. [0.0, 360.0]
|
||||
pub hue: f32,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{Alpha, Hwba, Lcha, LinearRgba, Srgba, StandardColor, Xyza};
|
||||
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
|
||||
use bevy_reflect::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Color in Hue-Saturation-Value (HSV) color space with alpha.
|
||||
|
@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
|
|||
#[doc = include_str!("../docs/diagrams/model_graph.svg")]
|
||||
/// </div>
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize, Default)]
|
||||
pub struct Hsva {
|
||||
/// The hue channel. [0.0, 360.0]
|
||||
pub hue: f32,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//!
|
||||
//! [_HWB - A More Intuitive Hue-Based Color Model_]: https://web.archive.org/web/20240226005220/http://alvyray.com/Papers/CG/HWB_JGTv208.pdf
|
||||
use crate::{Alpha, Lcha, LinearRgba, Srgba, StandardColor, Xyza};
|
||||
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
|
||||
use bevy_reflect::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Color in Hue-Whiteness-Blackness (HWB) color space with alpha.
|
||||
|
@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
|
|||
#[doc = include_str!("../docs/diagrams/model_graph.svg")]
|
||||
/// </div>
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize, Default)]
|
||||
pub struct Hwba {
|
||||
/// The hue channel. [0.0, 360.0]
|
||||
pub hue: f32,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
Alpha, Hsla, Hsva, Hwba, LinearRgba, Luminance, Mix, Oklaba, Srgba, StandardColor, Xyza,
|
||||
};
|
||||
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
|
||||
use bevy_reflect::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Color in LAB color space, with alpha
|
||||
|
@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize};
|
|||
#[doc = include_str!("../docs/diagrams/model_graph.svg")]
|
||||
/// </div>
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize, Default)]
|
||||
pub struct Laba {
|
||||
/// The lightness channel. [0.0, 1.5]
|
||||
pub lightness: f32,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{Alpha, Laba, LinearRgba, Luminance, Mix, Srgba, StandardColor, Xyza};
|
||||
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
|
||||
use bevy_reflect::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Color in LCH color space, with alpha
|
||||
|
@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
|
|||
#[doc = include_str!("../docs/diagrams/model_graph.svg")]
|
||||
/// </div>
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize, Default)]
|
||||
pub struct Lcha {
|
||||
/// The lightness channel. [0.0, 1.5]
|
||||
pub lightness: f32,
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::ops::{Div, Mul};
|
|||
|
||||
use crate::{color_difference::EuclideanDistance, Alpha, Luminance, Mix, StandardColor};
|
||||
use bevy_math::Vec4;
|
||||
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
|
||||
use bevy_reflect::prelude::*;
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize};
|
|||
#[doc = include_str!("../docs/diagrams/model_graph.svg")]
|
||||
/// </div>
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize, Default)]
|
||||
#[repr(C)]
|
||||
pub struct LinearRgba {
|
||||
/// The red channel. [0.0, 1.0]
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::{
|
|||
color_difference::EuclideanDistance, Alpha, Hsla, Hsva, Hwba, Lcha, LinearRgba, Luminance, Mix,
|
||||
Srgba, StandardColor, Xyza,
|
||||
};
|
||||
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
|
||||
use bevy_reflect::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Color in Oklab color space, with alpha
|
||||
|
@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize};
|
|||
#[doc = include_str!("../docs/diagrams/model_graph.svg")]
|
||||
/// </div>
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize, Default)]
|
||||
pub struct Oklaba {
|
||||
/// The 'l' channel. [0.0, 1.0]
|
||||
pub l: f32,
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::{
|
|||
color_difference::EuclideanDistance, Alpha, Hsla, Hsva, Hwba, Laba, Lcha, LinearRgba,
|
||||
Luminance, Mix, Oklaba, Srgba, StandardColor, Xyza,
|
||||
};
|
||||
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
|
||||
use bevy_reflect::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Color in Oklch color space, with alpha
|
||||
|
@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize};
|
|||
#[doc = include_str!("../docs/diagrams/model_graph.svg")]
|
||||
/// </div>
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize, Default)]
|
||||
pub struct Oklcha {
|
||||
/// The 'lightness' channel. [0.0, 1.0]
|
||||
pub lightness: f32,
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::ops::{Div, Mul};
|
|||
use crate::color_difference::EuclideanDistance;
|
||||
use crate::{Alpha, LinearRgba, Luminance, Mix, StandardColor, Xyza};
|
||||
use bevy_math::Vec4;
|
||||
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
|
||||
use bevy_reflect::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
|
||||
|
@ -13,7 +13,7 @@ use thiserror::Error;
|
|||
#[doc = include_str!("../docs/diagrams/model_graph.svg")]
|
||||
/// </div>
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize, Default)]
|
||||
pub struct Srgba {
|
||||
/// The red channel. [0.0, 1.0]
|
||||
pub red: f32,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{Alpha, LinearRgba, Luminance, Mix, StandardColor};
|
||||
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
|
||||
use bevy_reflect::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// [CIE 1931](https://en.wikipedia.org/wiki/CIE_1931_color_space) color space, also known as XYZ, with an alpha channel.
|
||||
|
@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
|
|||
#[doc = include_str!("../docs/diagrams/model_graph.svg")]
|
||||
/// </div>
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize)]
|
||||
#[reflect(PartialEq, Serialize, Deserialize, Default)]
|
||||
pub struct Xyza {
|
||||
/// The x-axis. [0.0, 1.0]
|
||||
pub x: f32,
|
||||
|
|
Loading…
Reference in a new issue