Deprecate color::srgba function. Use Color32::from_rgb etc instead.
This commit is contained in:
parent
73f3d8cf46
commit
64dd186daf
5 changed files with 23 additions and 18 deletions
|
@ -23,6 +23,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
|
||||
* `RepaintSignal` now implements `Sync` so it can be sent to a background thread.
|
||||
|
||||
### Deprecated
|
||||
|
||||
* Deprecated `color::srgba`.
|
||||
|
||||
|
||||
## 0.6.0 - 2020-12-26
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -48,8 +48,8 @@ impl Widgets {
|
|||
ui.add(crate::__egui_github_link_file_line!());
|
||||
|
||||
ui.horizontal_wrapped_for_text(TextStyle::Body, |ui| {
|
||||
ui.add(Label::new("Text can have").text_color(srgba(110, 255, 110, 255)));
|
||||
ui.colored_label(srgba(128, 140, 255, 255), "color"); // Shortcut version
|
||||
ui.add(Label::new("Text can have").text_color(Color32::from_rgb(110, 255, 110)));
|
||||
ui.colored_label(Color32::from_rgb(128, 140, 255), "color"); // Shortcut version
|
||||
ui.label("and tooltips.").on_hover_text(
|
||||
"This is a multiline tooltip that demonstrates that you can easily add tooltips to any element.\nThis is the second line.\nThis is the third.",
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue