mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Deprecate color::srgba function. Use Color32::from_rgb etc instead.
This commit is contained in:
@@ -25,6 +25,7 @@ impl std::ops::IndexMut<usize> for Color32 {
|
||||
}
|
||||
|
||||
// TODO: remove ?
|
||||
#[deprecated = "Replaced by Color32::from_rgb… family of functions."]
|
||||
pub const fn srgba(r: u8, g: u8, b: u8, a: u8) -> Color32 {
|
||||
Color32::from_rgba_premultiplied(r, g, b, a)
|
||||
}
|
||||
@@ -108,16 +109,16 @@ impl Color32 {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
pub const TRANSPARENT: Color32 = srgba(0, 0, 0, 0);
|
||||
pub const BLACK: Color32 = srgba(0, 0, 0, 255);
|
||||
pub const LIGHT_GRAY: Color32 = srgba(220, 220, 220, 255);
|
||||
pub const GRAY: Color32 = srgba(160, 160, 160, 255);
|
||||
pub const WHITE: Color32 = srgba(255, 255, 255, 255);
|
||||
pub const RED: Color32 = srgba(255, 0, 0, 255);
|
||||
pub const GREEN: Color32 = srgba(0, 255, 0, 255);
|
||||
pub const BLUE: Color32 = srgba(0, 0, 255, 255);
|
||||
pub const YELLOW: Color32 = srgba(255, 255, 0, 255);
|
||||
pub const LIGHT_BLUE: Color32 = srgba(140, 160, 255, 255);
|
||||
pub const TRANSPARENT: Color32 = Color32::from_rgba_premultiplied(0, 0, 0, 0);
|
||||
pub const BLACK: Color32 = Color32::from_rgb(0, 0, 0);
|
||||
pub const LIGHT_GRAY: Color32 = Color32::from_rgb(220, 220, 220);
|
||||
pub const GRAY: Color32 = Color32::from_rgb(160, 160, 160);
|
||||
pub const WHITE: Color32 = Color32::from_rgb(255, 255, 255);
|
||||
pub const RED: Color32 = Color32::from_rgb(255, 0, 0);
|
||||
pub const GREEN: Color32 = Color32::from_rgb(0, 255, 0);
|
||||
pub const BLUE: Color32 = Color32::from_rgb(0, 0, 255);
|
||||
pub const YELLOW: Color32 = Color32::from_rgb(255, 255, 0);
|
||||
pub const LIGHT_BLUE: Color32 = Color32::from_rgb(140, 160, 255);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
use {
|
||||
super::{
|
||||
color::{self, srgba, Color32, Rgba, TRANSPARENT},
|
||||
color::{self, Color32, Rgba, TRANSPARENT},
|
||||
*,
|
||||
},
|
||||
crate::math::*,
|
||||
@@ -929,7 +929,7 @@ pub fn tessellate_paint_commands(
|
||||
rect: *clip_rect,
|
||||
corner_radius: 0.0,
|
||||
fill: Default::default(),
|
||||
stroke: Stroke::new(2.0, srgba(150, 255, 150, 255)),
|
||||
stroke: Stroke::new(2.0, Color32::from_rgb(150, 255, 150)),
|
||||
},
|
||||
triangles,
|
||||
)
|
||||
|
||||
@@ -303,28 +303,28 @@ impl Default for Widgets {
|
||||
bg_fill: Rgba::luminance_alpha(0.10, 0.5).into(),
|
||||
bg_stroke: Stroke::new(2.0, WHITE),
|
||||
corner_radius: 4.0,
|
||||
fg_fill: srgba(120, 120, 200, 255),
|
||||
fg_fill: Color32::from_rgb(120, 120, 200),
|
||||
fg_stroke: Stroke::new(2.0, WHITE),
|
||||
},
|
||||
hovered: WidgetVisuals {
|
||||
bg_fill: Rgba::luminance_alpha(0.06, 0.5).into(),
|
||||
bg_stroke: Stroke::new(1.0, Rgba::white_alpha(0.5)),
|
||||
corner_radius: 4.0,
|
||||
fg_fill: srgba(100, 100, 150, 255),
|
||||
fg_fill: Color32::from_rgb(100, 100, 150),
|
||||
fg_stroke: Stroke::new(1.5, Color32::gray(240)),
|
||||
},
|
||||
inactive: WidgetVisuals {
|
||||
bg_fill: Rgba::luminance_alpha(0.04, 0.5).into(),
|
||||
bg_stroke: Stroke::new(1.0, Rgba::white_alpha(0.06)), // default window outline. Should be pretty readable
|
||||
corner_radius: 4.0,
|
||||
fg_fill: srgba(60, 60, 80, 255),
|
||||
fg_fill: Color32::from_rgb(60, 60, 80),
|
||||
fg_stroke: Stroke::new(1.0, Color32::gray(200)), // Should NOT look grayed out!
|
||||
},
|
||||
disabled: WidgetVisuals {
|
||||
bg_fill: Rgba::luminance_alpha(0.02, 0.5).into(),
|
||||
bg_stroke: Stroke::new(0.5, Color32::gray(70)),
|
||||
corner_radius: 4.0,
|
||||
fg_fill: srgba(50, 50, 50, 255),
|
||||
fg_fill: Color32::from_rgb(50, 50, 50),
|
||||
fg_stroke: Stroke::new(1.0, Color32::gray(140)), // Should look grayed out
|
||||
},
|
||||
noninteractive: WidgetVisuals {
|
||||
|
||||
Reference in New Issue
Block a user