pub struct Color { /* private fields */ }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§
Source§impl Color
impl Color
Sourcepub const ForeGround: Color
pub const ForeGround: Color
ForeGround, label colors
Sourcepub const Foreground: Color
pub const Foreground: Color
Foreground, label colors
Sourcepub const BackGround2: Color
pub const BackGround2: Color
BackGround2, Is the color inside input, output and text display widgets
Sourcepub const Background2: Color
pub const Background2: Color
Background2, Is the color inside input, output and text display widgets
Sourcepub const FrameDefault: Color
pub const FrameDefault: Color
FrameDefault
Sourcepub const BackGround: Color
pub const BackGround: Color
BackGround
Sourcepub const Background: Color
pub const Background: Color
Background
Sourcepub const DarkYellow: Color
pub const DarkYellow: Color
DarkYellow
Sourcepub const DarkMagenta: Color
pub const DarkMagenta: Color
DarkMagenta
Sourcepub const XtermBlack: Color
pub const XtermBlack: Color
ANSI/xterm Black, not part of FLTK’s colormap
Sourcepub const XtermGreen: Color
pub const XtermGreen: Color
ANSI/xterm Green, not part of FLTK’s colormap
Sourcepub const XtermYellow: Color
pub const XtermYellow: Color
ANSI/xterm Yellow, not part of FLTK’s colormap
Sourcepub const XtermMagenta: Color
pub const XtermMagenta: Color
ANSI/xterm Magenta, not part of FLTK’s colormap
Sourcepub const XtermWhite: Color
pub const XtermWhite: Color
ANSI/xterm White, not part of FLTK’s colormap
Sourcepub const XtermBgRed: Color
pub const XtermBgRed: Color
ANSI/xterm background Red, not part of FLTK’s colormap
Sourcepub const XtermBgGreen: Color
pub const XtermBgGreen: Color
ANSI/xterm background Green, not part of FLTK’s colormap
Sourcepub const XtermBgYellow: Color
pub const XtermBgYellow: Color
ANSI/xterm background Yelllow, not part of FLTK’s colormap
Sourcepub const XtermBgBlue: Color
pub const XtermBgBlue: Color
ANSI/xterm background Blue, not part of FLTK’s colormap
Sourcepub const XtermBgMagenta: Color
pub const XtermBgMagenta: Color
ANSI/xterm background Magenta, not part of FLTK’s colormap
Sourcepub const XtermBgCyan: Color
pub const XtermBgCyan: Color
ANSI/xterm background Cyan, not part of FLTK’s colormap
Sourcepub const XtermBgWhite: Color
pub const XtermBgWhite: Color
ANSI/xterm background White, not part of FLTK’s colormap
Sourcepub 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
Sourcepub 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.
Sourcepub 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)
Sourcepub fn to_hex_str(&self) -> String
pub fn to_hex_str(&self) -> String
Returns the color in hex string format
Sourcepub 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)
Sourcepub 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)
Sourcepub fn contrast(fg: Color, bg: Color) -> Color
pub fn contrast(fg: Color, bg: Color) -> Color
Returns a color that contrasts with the background color.
Sourcepub fn gray_scale(g: u8) -> Color
pub fn gray_scale(g: u8) -> Color
Returns the color closest to the passed grayscale value