Struct Color
pub struct Color { /* private fields */ }
dep_fltk
only.Expand description
Defines colors used by FLTK.
Colors are stored as RGBI values, the last being the index for FLTK colors in this enum.
Colors in this enum don’t have an RGB stored. However, custom colors have an RGB, and don’t have an index.
The RGBI can be acquired by casting the color to u32 and formatting it to 0x{08x}
.
The last 2 digits are the hexadecimal representation of the color in this enum.
For example, Color::White, has a hex of 0x000000ff, ff being the 255 value of this enum.
A custom color like Color::from_u32(0x646464), will have an representation as 0x64646400,
of which the final 00 indicates that it is not stored in this enum.
For convenience, the fmt::Display trait is implemented so that the name of the Color is shown
when there is one, otherwise the RGB value is given.
Implementations§
§impl Color
impl Color
pub const ForeGround: Color
pub const ForeGround: Color
ForeGround, label colors
pub const Foreground: Color
pub const Foreground: Color
Foreground, label colors
pub const BackGround2: Color
pub const BackGround2: Color
BackGround2, Is the color inside input, output and text display widgets
pub const Background2: Color
pub const Background2: Color
Background2, Is the color inside input, output and text display widgets
pub const FrameDefault: Color
pub const FrameDefault: Color
FrameDefault
pub const BackGround: Color
pub const BackGround: Color
BackGround
pub const Background: Color
pub const Background: Color
Background
pub const DarkYellow: Color
pub const DarkYellow: Color
DarkYellow
pub const DarkMagenta: Color
pub const DarkMagenta: Color
DarkMagenta
pub const XtermBlack: Color
pub const XtermBlack: Color
ANSI/xterm Black, not part of FLTK’s colormap
pub const XtermGreen: Color
pub const XtermGreen: Color
ANSI/xterm Green, not part of FLTK’s colormap
pub const XtermYellow: Color
pub const XtermYellow: Color
ANSI/xterm Yellow, not part of FLTK’s colormap
pub const XtermMagenta: Color
pub const XtermMagenta: Color
ANSI/xterm Magenta, not part of FLTK’s colormap
pub const XtermWhite: Color
pub const XtermWhite: Color
ANSI/xterm White, not part of FLTK’s colormap
pub const XtermBgRed: Color
pub const XtermBgRed: Color
ANSI/xterm background Red, not part of FLTK’s colormap
pub const XtermBgGreen: Color
pub const XtermBgGreen: Color
ANSI/xterm background Green, not part of FLTK’s colormap
pub const XtermBgYellow: Color
pub const XtermBgYellow: Color
ANSI/xterm background Yelllow, not part of FLTK’s colormap
pub const XtermBgBlue: Color
pub const XtermBgBlue: Color
ANSI/xterm background Blue, not part of FLTK’s colormap
pub const XtermBgMagenta: Color
pub const XtermBgMagenta: Color
ANSI/xterm background Magenta, not part of FLTK’s colormap
pub const XtermBgCyan: Color
pub const XtermBgCyan: Color
ANSI/xterm background Cyan, not part of FLTK’s colormap
pub const XtermBgWhite: Color
pub const XtermBgWhite: Color
ANSI/xterm background White, not part of FLTK’s colormap
pub const TransparentBg: Color
pub const TransparentBg: Color
Special background color value that lets the Terminal widget’s box() color show through behind the text. Not part of FLTK’s colormap
pub fn from_rgba_tuple(tup: (u8, u8, u8, u8)) -> Color
pub fn from_rgba_tuple(tup: (u8, u8, u8, u8)) -> Color
Create color from RGBA using alpha compositing. Works for non-group types.
pub fn from_hex_str(col: &str) -> Result<Color, FltkError> ⓘ
pub fn from_hex_str(col: &str) -> Result<Color, FltkError> ⓘ
Return a Color from a hex color format (#xxxxxx
)
pub fn to_hex_str(&self) -> String ⓘ
pub fn to_hex_str(&self) -> String ⓘ
Returns the color in hex string format
pub fn gray_ramp(val: i32) -> Color
pub fn gray_ramp(val: i32) -> Color
Returns a gray color value from black (i == 0) to white (i == FL_NUM_GRAY - 1)
pub fn color_average(c1: Color, c2: Color, weight: f32) -> Color
pub fn color_average(c1: Color, c2: Color, weight: f32) -> Color
Returns a gray color value from black (i == 0) to white (i == FL_NUM_GRAY - 1)
pub fn contrast(fg: Color, bg: Color) -> Color
pub fn contrast(fg: Color, bg: Color) -> Color
Returns a color that contrasts with the background color.
pub fn gray_scale(g: u8) -> Color
pub fn gray_scale(g: u8) -> Color
Returns the color closest to the passed grayscale value
Trait Implementations§
§impl Ord for Color
impl Ord for Color
§impl PartialOrd for Color
impl PartialOrd for Color
impl Copy for Color
impl Eq for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId
of Self
using a custom hasher.Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more