[go: up one dir, main page]

Struct egui_web::backend::Color32[]

pub struct Color32(_);

This format is used for space-efficient color representation (32 bits).

Instead of manipulating this directly it is often better to first convert it to either [Rgba] or [Hsva].

Internally this uses 0-255 gamma space sRGBA color with premultiplied alpha. Alpha channel is in linear space.

Implementations

impl Color32

pub const TRANSPARENT: Color32

pub const BLACK: Color32

pub const LIGHT_GRAY: Color32

pub const GRAY: Color32

pub const WHITE: Color32

pub const RED: Color32

pub const YELLOW: Color32

pub const GREEN: Color32

pub const BLUE: Color32

pub const LIGHT_BLUE: Color32

pub const GOLD: Color32

pub const fn from_rgb(r: u8, g: u8, b: u8) -> Color32

pub const fn from_rgb_additive(r: u8, g: u8, b: u8) -> Color32

pub const fn from_rgba_premultiplied(r: u8, g: u8, b: u8, a: u8) -> Color32

From sRGBA with premultiplied alpha.

pub fn from_rgba_unmultiplied(r: u8, g: u8, b: u8, a: u8) -> Color32

From sRGBA WITHOUT premultiplied alpha.

pub const fn new(r: u8, g: u8, b: u8, a: u8) -> Color32

👎 Deprecated:

Use from_rgb(..), from_rgba_premultiplied(..) or from_srgba_unmultiplied(..)

pub const fn from_gray(l: u8) -> Color32

pub const fn from_black_alpha(a: u8) -> Color32

pub fn from_white_alpha(a: u8) -> Color32

pub const fn from_additive_luminance(l: u8) -> Color32

pub fn is_opaque(&self) -> bool

pub fn r(&self) -> u8

pub fn g(&self) -> u8

pub fn b(&self) -> u8

pub fn a(&self) -> u8

pub fn to_opaque(self) -> Color32

Returns an opaque version of self

pub fn to_array(&self) -> [u8; 4]

Premultiplied RGBA

pub fn to_tuple(&self) -> (u8, u8, u8, u8)

Premultiplied RGBA

pub fn linear_multiply(self, factor: f32) -> Color32

Multiply with 0.5 to make color half as opaque.

Trait Implementations

impl Clone for Color32

impl Copy for Color32

impl Debug for Color32

impl Default for Color32

impl Eq for Color32

impl From<Hsva> for Color32

impl From<HsvaGamma> for Color32

impl From<Rgba> for Color32

impl Hash for Color32

impl Index<usize> for Color32

type Output = u8

The returned type after indexing.

impl IndexMut<usize> for Color32

impl PartialEq<Color32> for Color32

impl StructuralEq for Color32

impl StructuralPartialEq for Color32

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CallHasher for T where
    T: Hash + ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.