ferroui_controls_color_picker/lib.rs
1//! ferroui-controls-color-picker
2//!
3//! The colour picker library: the drop-down [`ColorPicker`], the
4//! [`ColorView`] it presents, the primitives they are built from
5//! ([`ColorSpectrum`](primitives::ColorSpectrum),
6//! [`ColorSlider`](primitives::ColorSlider),
7//! [`ColorPreviewer`](primitives::ColorPreviewer)), the colour palettes, the
8//! value converters of their control themes and the automation peer of the
9//! spectrum.
10//!
11//! The control themes are not part of the base themes: an application
12//! includes the styles of the library for its theme, as upstream:
13//!
14//! ```xml
15//! <StyleInclude Source="ferres://FerroUI.Controls.ColorPicker/Themes/Fluent/Fluent.xaml" />
16//! ```
17//!
18//! The theme documents are compiled by the build of the crate (`build.rs`):
19//! [`register_types`] registers the loader table of the compiled markup,
20//! which answers a load of a document of the assembly
21//! `FerroUI.Controls.ColorPicker` by its URI, and the build of an application
22//! whose markup is compiled links an include of the styles to their compiled
23//! markup. A compiled document is not an asset of the assembly, as upstream's
24//! compiler removes a compiled resource; with the feature `document-assets`
25//! the documents are embedded as assets too, which is what lets a document
26//! loaded at run time include them (`build.rs` says why). The crate does not
27//! link the run-time XAML loader.
28
29// The compiled markup names the types of the crate by the name of the crate, as the markup
30// of any other crate does.
31extern crate self as ferroui_controls_color_picker;
32
33// `compiled_xaml` (the compiled markup of the theme documents) and `compiled_markup` (the
34// loader table of the crate and `register()`), which the build script generates.
35ferroui_markup_xaml::include_compiled_xaml!();
36
37mod alpha_component_position;
38#[cfg(any(test, feature = "document-assets"))]
39mod assets;
40pub mod automation;
41mod color_changed_event_args;
42mod color_component;
43mod color_model;
44mod color_palettes;
45mod color_picker;
46mod color_previewer;
47mod color_slider;
48mod color_spectrum;
49mod color_view;
50pub mod converters;
51mod helpers;
52mod hsv_component;
53mod markup_types;
54mod register_types;
55mod rgb_component;
56mod rust_paths;
57
58pub use alpha_component_position::AlphaComponentPosition;
59pub use color_changed_event_args::ColorChangedEventArgs;
60pub use color_component::ColorComponent;
61pub use color_model::ColorModel;
62pub use color_palettes::{
63 FlatColor, FlatColorPalette, FlatHalfColorPalette, FluentColorPalette, IColorPalette, MaterialColor,
64 MaterialColorPalette, MaterialHalfColorPalette, SixteenColorPalette,
65};
66pub use color_picker::ColorPicker;
67pub use color_spectrum::{ColorSpectrumComponents, ColorSpectrumShape};
68pub use color_view::{ColorView, ColorViewImpl, ColorViewTab};
69pub use hsv_component::HsvComponent;
70pub use register_types::{register_types, ASSEMBLY};
71pub use rgb_component::RgbComponent;
72
73/// The primitives of the colour picker (namespace `FerroUI.Controls.Primitives`).
74pub mod primitives {
75 pub use crate::color_previewer::{ColorPreviewer, ColorPreviewerImpl};
76 pub use crate::color_slider::{ColorSlider, ColorSliderImpl};
77 pub use crate::color_spectrum::ColorSpectrum;
78 pub use crate::helpers::ColorHelper;
79
80 /// The converters of the primitives (namespace
81 /// `FerroUI.Controls.Primitives.Converters`).
82 pub mod converters {
83 pub use crate::converters::accent_color_converter::AccentColorConverter;
84 pub use crate::converters::contrast_brush_converter::ContrastBrushConverter;
85 }
86}
87
88#[cfg(test)]
89mod tests;