1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Split out ecolor crate (#2399)

* split out ecolor crate

* split up ecolor crate in lots of modules

* add changelog notes

* add readme to ecolor

* put clippy::manual_range_contains on cranky allow list

* fix hex color issues

* doc fixes

* more hex_color fixes

* Document features

* Rename hex_color module to avoid warning

* Sort the feature names

* fix link in CHANGELOG.md

* better wording

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
Andreas Reich
2022-12-06 20:42:25 +01:00
committed by GitHub
parent e30ac7f91a
commit 5effc68ba4
29 changed files with 1229 additions and 1101 deletions

View File

@@ -328,17 +328,19 @@ pub mod widgets;
pub use accesskit;
pub use epaint;
pub use epaint::ecolor;
pub use epaint::emath;
pub use emath::{lerp, pos2, remap, remap_clamp, vec2, Align, Align2, NumExt, Pos2, Rect, Vec2};
#[cfg(feature = "color-hex")]
pub use epaint::hex_color;
pub use ecolor::hex_color;
pub use ecolor::{Color32, Rgba};
pub use emath::{lerp, pos2, remap, remap_clamp, vec2, Align, Align2, NumExt, Pos2, Rect, Vec2};
pub use epaint::{
color, mutex,
mutex,
text::{FontData, FontDefinitions, FontFamily, FontId, FontTweak},
textures::{TextureFilter, TextureOptions, TexturesDelta},
ClippedPrimitive, Color32, ColorImage, FontImage, ImageData, Mesh, PaintCallback,
PaintCallbackInfo, Rgba, Rounding, Shape, Stroke, TextureHandle, TextureId,
ClippedPrimitive, ColorImage, FontImage, ImageData, Mesh, PaintCallback, PaintCallbackInfo,
Rounding, Shape, Stroke, TextureHandle, TextureId,
};
pub mod text {

View File

@@ -448,6 +448,6 @@ impl Painter {
fn tint_shape_towards(shape: &mut Shape, target: Color32) {
epaint::shape_transform::adjust_colors(shape, &|color| {
*color = crate::color::tint_color_towards(*color, target);
*color = crate::ecolor::tint_color_towards(*color, target);
});
}

View File

@@ -2,7 +2,7 @@
#![allow(clippy::if_same_then_else)]
use crate::{color::*, emath::*, FontFamily, FontId, Response, RichText, WidgetText};
use crate::{ecolor::*, emath::*, FontFamily, FontId, Response, RichText, WidgetText};
use epaint::{Rounding, Shadow, Stroke};
use std::collections::BTreeMap;
@@ -495,7 +495,7 @@ impl Visuals {
}
pub fn weak_text_color(&self) -> Color32 {
crate::color::tint_color_towards(self.text_color(), self.window_fill())
crate::ecolor::tint_color_towards(self.text_color(), self.window_fill())
}
#[inline(always)]

View File

@@ -6,7 +6,7 @@ use std::sync::Arc;
use epaint::mutex::{RwLock, RwLockReadGuard, RwLockWriteGuard};
use crate::{
color::*, containers::*, epaint::text::Fonts, layout::*, menu::MenuState, placer::Placer,
containers::*, ecolor::*, epaint::text::Fonts, layout::*, menu::MenuState, placer::Placer,
widgets::*, *,
};

View File

@@ -2,7 +2,7 @@
use crate::util::fixed_cache::FixedCache;
use crate::*;
use epaint::{color::*, *};
use epaint::{ecolor::*, *};
fn contrast_color(color: impl Into<Rgba>) -> Color32 {
if color.into().intensity() < 0.5 {

View File

@@ -7,8 +7,8 @@ use std::{
};
use crate::*;
use epaint::color::Hsva;
use epaint::util::FloatOrd;
use epaint::Hsva;
use items::PlotItem;
use legend::LegendWidget;