Skip to main content

egui_charts/icons/
mod.rs

1//! Embedded SVG icons for chart controls and host UI.
2//!
3//! Use [`icons`] for built-in glyphs or [`Icon`] and [`crate::icon_from_path`] to embed
4//! an application SVG. The chart installs the icon image loaders when shown.
5//!
6//! ```
7//! use egui_charts::icons::icons;
8//!
9//! # egui::__run_test_ui(|ui| {
10//! ui.add(icons::SETTINGS.as_image(egui::Vec2::splat(20.0)));
11//! # });
12//! ```
13
14mod icon;
15mod loader;
16
17pub use icon::Icon;
18pub(crate) use loader::install as install_loader;
19
20/// Macro to embed an SVG icon at compile time.
21///
22/// The path is relative to the `assets/icons/` directory of the crate that invokes the macro.
23///
24/// # Example
25///
26/// ```
27/// use egui_charts::icon_from_path;
28/// use egui_charts::icons::Icon;
29///
30/// const ERASER: Icon = icon_from_path!("lines/eraser.svg");
31/// ```
32#[macro_export]
33macro_rules! icon_from_path {
34    ($path:literal) => {
35        $crate::icons::Icon::new(
36            $path,
37            include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/assets/icons/", $path)),
38        )
39    };
40}
41
42/// Pre-defined icon constants - all icons embedded at compile time.
43pub mod icons {
44    use super::Icon;
45
46    // Cursors
47    /// Crosshair SVG icon.
48    pub const CROSSHAIR: Icon = crate::icon_from_path!("lines/cursor-cross.svg");
49    /// Dot SVG icon.
50    pub const DOT: Icon = crate::icon_from_path!("lines/cursor-dot.svg");
51    /// Arrow SVG icon.
52    pub const ARROW: Icon = crate::icon_from_path!("lines/cursor-arrow.svg");
53    /// Pointer with a halo for presenting a position on the chart.
54    pub const DEMONSTRATION: Icon = crate::icon_from_path!("lines/cursor-demonstration.svg");
55    /// Wand with sparks for the trail that follows the pointer while the button is held.
56    pub const MAGIC_CURSOR: Icon = crate::icon_from_path!("lines/cursor-magic.svg");
57    /// Eraser SVG icon.
58    pub const ERASER: Icon = crate::icon_from_path!("lines/eraser.svg");
59
60    // Lines and channels
61    /// Trend line SVG icon.
62    pub const TREND_LINE: Icon = crate::icon_from_path!("lines/trend-line.svg");
63    /// Ray SVG icon.
64    pub const RAY: Icon = crate::icon_from_path!("lines/ray.svg");
65    /// Info line SVG icon.
66    pub const INFO_LINE: Icon = crate::icon_from_path!("lines/info-line.svg");
67    /// Extended SVG icon.
68    pub const EXTENDED: Icon = crate::icon_from_path!("lines/extended-line.svg");
69    /// Trend angle SVG icon.
70    pub const TREND_ANGLE: Icon = crate::icon_from_path!("lines/trend-angle.svg");
71    /// Horizontal line SVG icon.
72    pub const HORIZONTAL_LINE: Icon = crate::icon_from_path!("lines/horizontal-line.svg");
73    /// Horizontal ray SVG icon.
74    pub const HORIZONTAL_RAY: Icon = crate::icon_from_path!("lines/horizontal-ray.svg");
75    /// Vertical line SVG icon.
76    pub const VERTICAL_LINE: Icon = crate::icon_from_path!("lines/vertical-line.svg");
77    /// Cross line SVG icon.
78    pub const CROSS_LINE: Icon = crate::icon_from_path!("lines/cross-line.svg");
79    /// Parallel channel SVG icon.
80    pub const PARALLEL_CHANNEL: Icon = crate::icon_from_path!("lines/parallel-channel.svg");
81    /// Regression trend SVG icon.
82    pub const REGRESSION_TREND: Icon = crate::icon_from_path!("lines/regression-trend.svg");
83    /// Flat top or bottom channel SVG icon.
84    pub const FLAT_BOTTOM: Icon = crate::icon_from_path!("lines/flat-top-bottom.svg");
85    /// Disjoint angle SVG icon.
86    pub const DISJOINT_ANGLE: Icon = crate::icon_from_path!("lines/disjoint-channel.svg");
87
88    // Pitchforks and Gann
89    /// Pitchfork SVG icon.
90    pub const PITCHFORK: Icon = crate::icon_from_path!("pitchforks-gann/pitchfork.svg");
91    /// Schiff pitchfork SVG icon.
92    pub const SCHIFF_PITCHFORK: Icon =
93        crate::icon_from_path!("pitchforks-gann/schiff-pitchfork.svg");
94    /// Modified Schiff pitchfork SVG icon.
95    pub const SCHIFF_PITCHFORK2: Icon =
96        crate::icon_from_path!("pitchforks-gann/modified-schiff-pitchfork.svg");
97    /// Inside pitchfork SVG icon.
98    pub const INSIDE_PITCHFORK: Icon =
99        crate::icon_from_path!("pitchforks-gann/inside-pitchfork.svg");
100    /// Pitchfan SVG icon.
101    pub const PITCHFAN: Icon = crate::icon_from_path!("pitchforks-gann/pitchfan.svg");
102    /// Gann box SVG icon.
103    pub const GANN_SQUARE: Icon = crate::icon_from_path!("pitchforks-gann/gann-box.svg");
104    /// Gann square SVG icon.
105    pub const GANN_COMPLEX: Icon = crate::icon_from_path!("pitchforks-gann/gann-square.svg");
106    /// Fixed Gann square SVG icon.
107    pub const GANN_FIXED: Icon = crate::icon_from_path!("pitchforks-gann/gann-square-fixed.svg");
108    /// Gann fan SVG icon.
109    pub const GANN_FAN: Icon = crate::icon_from_path!("pitchforks-gann/gann-fan.svg");
110
111    // Fibonacci
112    /// Fibonacci retracement SVG icon.
113    pub const FIB_RETRACEMENT: Icon = crate::icon_from_path!("fibonacci/fib-retracement.svg");
114    /// Fibonacci extension SVG icon.
115    pub const FIB_EXTENSION: Icon = crate::icon_from_path!("fibonacci/fib-extension.svg");
116    /// Fibonacci channel SVG icon.
117    pub const FIB_CHANNEL: Icon = crate::icon_from_path!("fibonacci/fib-channel.svg");
118    /// Fibonacci time zone SVG icon.
119    pub const FIB_TIME_ZONE: Icon = crate::icon_from_path!("fibonacci/fib-time-zone.svg");
120    /// Fibonacci speed resistance fan SVG icon.
121    pub const FIB_SPEED_RESISTANCE_FAN: Icon =
122        crate::icon_from_path!("fibonacci/fib-speed-fan.svg");
123    /// Trend based fibonacci time SVG icon.
124    pub const TREND_BASED_FIB_TIME: Icon =
125        crate::icon_from_path!("fibonacci/trend-based-fib-time.svg");
126    /// Fibonacci circles SVG icon.
127    pub const FIB_CIRCLES: Icon = crate::icon_from_path!("fibonacci/fib-circles.svg");
128    /// Fibonacci spiral SVG icon.
129    pub const FIB_SPIRAL: Icon = crate::icon_from_path!("fibonacci/fib-spiral.svg");
130    /// Fibonacci speed resistance arcs SVG icon.
131    pub const FIB_SPEED_RESISTANCE_ARCS: Icon =
132        crate::icon_from_path!("fibonacci/fib-speed-arcs.svg");
133    /// Fibonacci wedge SVG icon.
134    pub const FIB_WEDGE: Icon = crate::icon_from_path!("fibonacci/fib-wedge.svg");
135
136    // Patterns and Elliott waves
137    /// XABCD pattern SVG icon.
138    pub const XABCD_PATTERN: Icon = crate::icon_from_path!("patterns-elliott/xabcd.svg");
139    /// Cypher pattern SVG icon.
140    pub const CYPHER_PATTERN: Icon = crate::icon_from_path!("patterns-elliott/cypher.svg");
141    /// Head and shoulders SVG icon.
142    pub const HEAD_AND_SHOULDERS: Icon =
143        crate::icon_from_path!("patterns-elliott/head-and-shoulders.svg");
144    /// ABCD SVG icon.
145    pub const ABCD: Icon = crate::icon_from_path!("patterns-elliott/abcd.svg");
146    /// Triangle pattern SVG icon.
147    pub const TRIANGLE_PATTERN: Icon =
148        crate::icon_from_path!("patterns-elliott/triangle-pattern.svg");
149    /// Three drives SVG icon.
150    pub const THREE_DRIVERS: Icon = crate::icon_from_path!("patterns-elliott/three-drives.svg");
151    /// Elliott impulse SVG icon.
152    pub const ELLIOTT_IMPULSE: Icon =
153        crate::icon_from_path!("patterns-elliott/elliott-impulse.svg");
154    /// Elliott correction SVG icon.
155    pub const ELLIOTT_CORRECTION: Icon =
156        crate::icon_from_path!("patterns-elliott/elliott-correction.svg");
157    /// Elliott triangle SVG icon.
158    pub const ELLIOTT_TRIANGLE: Icon =
159        crate::icon_from_path!("patterns-elliott/elliott-triangle.svg");
160    /// Elliott double combo SVG icon.
161    pub const ELLIOTT_DOUBLE_COMBO: Icon =
162        crate::icon_from_path!("patterns-elliott/elliott-double-combo.svg");
163    /// Elliott triple combo SVG icon.
164    pub const ELLIOTT_TRIPLE_COMBO: Icon =
165        crate::icon_from_path!("patterns-elliott/elliott-triple-combo.svg");
166
167    // Projection, volume, measurers and cycles
168    /// Long position SVG icon.
169    pub const LONG_POSITION: Icon =
170        crate::icon_from_path!("projection-volume-measure/long-position.svg");
171    /// Short position SVG icon.
172    pub const SHORT_POSITION: Icon =
173        crate::icon_from_path!("projection-volume-measure/short-position.svg");
174    /// Prediction SVG icon.
175    pub const PREDICTION: Icon = crate::icon_from_path!("projection-volume-measure/forecast.svg");
176    /// Bars pattern SVG icon.
177    pub const BARS_PATTERN: Icon =
178        crate::icon_from_path!("projection-volume-measure/bars-pattern.svg");
179    /// Ghost feed SVG icon.
180    pub const GHOST_FEED: Icon = crate::icon_from_path!("projection-volume-measure/ghost-feed.svg");
181    /// Projection SVG icon.
182    pub const PROJECTION: Icon = crate::icon_from_path!("projection-volume-measure/projection.svg");
183    /// Anchored vwap SVG icon.
184    pub const ANCHORED_VWAP: Icon =
185        crate::icon_from_path!("projection-volume-measure/anchored-vwap.svg");
186    /// Fixed range volume profile SVG icon.
187    pub const FIXED_RANGE_VOLUME_PROFILE: Icon =
188        crate::icon_from_path!("projection-volume-measure/fixed-range-volume-profile.svg");
189    /// Anchored volume profile SVG icon.
190    pub const ANCHORED_VOLUME_PROFILE: Icon =
191        crate::icon_from_path!("projection-volume-measure/anchored-volume-profile.svg");
192    /// Measure SVG icon.
193    pub const MEASURE: Icon = crate::icon_from_path!("projection-volume-measure/measure.svg");
194    /// Price range SVG icon.
195    pub const PRICE_RANGE: Icon =
196        crate::icon_from_path!("projection-volume-measure/price-range.svg");
197    /// Date range SVG icon.
198    pub const DATE_RANGE: Icon = crate::icon_from_path!("projection-volume-measure/date-range.svg");
199    /// Date and price range SVG icon.
200    pub const DATE_AND_PRICE_RANGE: Icon =
201        crate::icon_from_path!("projection-volume-measure/date-price-range.svg");
202    /// Circle lines SVG icon.
203    pub const CIRCLE_LINES: Icon =
204        crate::icon_from_path!("projection-volume-measure/cyclic-lines.svg");
205    /// Time cycles SVG icon.
206    pub const TIME_CYCLES: Icon =
207        crate::icon_from_path!("projection-volume-measure/time-cycles.svg");
208    /// Sine line SVG icon.
209    pub const SINE_LINE: Icon = crate::icon_from_path!("projection-volume-measure/sine-line.svg");
210
211    // Shapes, brushes and annotations
212    /// Brush SVG icon.
213    pub const BRUSH: Icon = crate::icon_from_path!("shapes-annotations/brush.svg");
214    /// Highlighter SVG icon.
215    pub const HIGHLIGHTER: Icon = crate::icon_from_path!("shapes-annotations/highlighter.svg");
216    /// Paintbrush SVG icon.
217    pub const PAINTBRUSH: Icon = crate::icon_from_path!("shapes-annotations/paintbrush.svg");
218    /// Arrow marker SVG icon.
219    pub const ARROW_MARKER: Icon = crate::icon_from_path!("shapes-annotations/arrow-marker.svg");
220    /// Arrow line SVG icon.
221    pub const ARROW_LINE: Icon = crate::icon_from_path!("shapes-annotations/arrow.svg");
222    /// Arrow mark up SVG icon.
223    pub const ARROW_MARK_UP: Icon = crate::icon_from_path!("shapes-annotations/arrow-mark-up.svg");
224    /// Arrow mark down SVG icon.
225    pub const ARROW_MARK_DOWN: Icon =
226        crate::icon_from_path!("shapes-annotations/arrow-mark-down.svg");
227    /// Arrow mark left SVG icon.
228    pub const ARROW_MARK_LEFT: Icon =
229        crate::icon_from_path!("shapes-annotations/arrow-mark-left.svg");
230    /// Arrow mark right SVG icon.
231    pub const ARROW_MARK_RIGHT: Icon =
232        crate::icon_from_path!("shapes-annotations/arrow-mark-right.svg");
233    /// Rect SVG icon.
234    pub const RECT: Icon = crate::icon_from_path!("shapes-annotations/rectangle.svg");
235    /// Rotated rect SVG icon.
236    pub const ROTATED_RECT: Icon =
237        crate::icon_from_path!("shapes-annotations/rotated-rectangle.svg");
238    /// Path SVG icon.
239    pub const PATH: Icon = crate::icon_from_path!("shapes-annotations/path.svg");
240    /// Circle SVG icon.
241    pub const CIRCLE: Icon = crate::icon_from_path!("shapes-annotations/circle.svg");
242    /// Ellipse SVG icon.
243    pub const ELLIPSE: Icon = crate::icon_from_path!("shapes-annotations/ellipse.svg");
244    /// Polyline SVG icon.
245    pub const POLYLINE: Icon = crate::icon_from_path!("shapes-annotations/polyline.svg");
246    /// Triangle SVG icon.
247    pub const TRIANGLE: Icon = crate::icon_from_path!("shapes-annotations/triangle.svg");
248    /// Sector SVG icon.
249    pub const SECTOR: Icon = crate::icon_from_path!("shapes-annotations/sector.svg");
250    /// Arc SVG icon.
251    pub const ARC: Icon = crate::icon_from_path!("shapes-annotations/arc.svg");
252    /// Bezier quadro SVG icon.
253    pub const BEZIER_QUADRO: Icon = crate::icon_from_path!("shapes-annotations/curve.svg");
254    /// Bezier cubic SVG icon.
255    pub const BEZIER_CUBIC: Icon = crate::icon_from_path!("shapes-annotations/double-curve.svg");
256    /// Text SVG icon.
257    pub const TEXT: Icon = crate::icon_from_path!("shapes-annotations/text.svg");
258    /// Anchored text SVG icon.
259    pub const ANCHORED_TEXT: Icon = crate::icon_from_path!("shapes-annotations/anchored-text.svg");
260    /// Note SVG icon.
261    pub const NOTE: Icon = crate::icon_from_path!("shapes-annotations/note.svg");
262    /// Price note SVG icon.
263    pub const PRICE_NOTE: Icon = crate::icon_from_path!("shapes-annotations/price-note.svg");
264    /// Anchored note SVG icon.
265    pub const ANCHORED_NOTE: Icon = crate::icon_from_path!("shapes-annotations/anchored-note.svg");
266    /// Callout SVG icon.
267    pub const CALLOUT: Icon = crate::icon_from_path!("shapes-annotations/callout.svg");
268    /// Comment SVG icon.
269    pub const COMMENT: Icon = crate::icon_from_path!("shapes-annotations/comment.svg");
270    /// Price label SVG icon.
271    pub const PRICE_LABEL: Icon = crate::icon_from_path!("shapes-annotations/price-label.svg");
272    /// Signpost SVG icon.
273    pub const SIGNPOST: Icon = crate::icon_from_path!("shapes-annotations/signpost.svg");
274    /// Flag mark SVG icon.
275    pub const FLAG_MARK: Icon = crate::icon_from_path!("shapes-annotations/flag-mark.svg");
276    /// Table SVG icon.
277    pub const TABLE: Icon = crate::icon_from_path!("shapes-annotations/table.svg");
278    /// Image SVG icon.
279    pub const IMAGE: Icon = crate::icon_from_path!("shapes-annotations/image.svg");
280    /// Post SVG icon.
281    pub const POST: Icon = crate::icon_from_path!("shapes-annotations/post.svg");
282    /// Ideas SVG icon.
283    pub const IDEAS: Icon = crate::icon_from_path!("shapes-annotations/idea.svg");
284    /// Sticker SVG icon.
285    pub const STICKER: Icon = crate::icon_from_path!("shapes-annotations/sticker.svg");
286    /// Emoji icon SVG icon.
287    pub const EMOJI_ICON: Icon = crate::icon_from_path!("shapes-annotations/emoji.svg");
288
289    // Chart types
290    /// Chart bars SVG icon.
291    pub const CHART_BARS: Icon = crate::icon_from_path!("chart-types/chart-bars.svg");
292    /// Chart candles SVG icon.
293    pub const CHART_CANDLES: Icon = crate::icon_from_path!("chart-types/chart-candles.svg");
294    /// Chart hollow candles SVG icon.
295    pub const CHART_HOLLOW_CANDLES: Icon =
296        crate::icon_from_path!("chart-types/chart-hollow-candles.svg");
297    /// Chart volume candles SVG icon.
298    pub const CHART_VOLUME_CANDLES: Icon =
299        crate::icon_from_path!("chart-types/chart-volume-candles.svg");
300    /// Chart line SVG icon.
301    pub const CHART_LINE: Icon = crate::icon_from_path!("chart-types/chart-line.svg");
302    /// Chart line markers SVG icon.
303    pub const CHART_LINE_MARKERS: Icon =
304        crate::icon_from_path!("chart-types/chart-line-markers.svg");
305    /// Chart step line SVG icon.
306    pub const CHART_STEP_LINE: Icon = crate::icon_from_path!("chart-types/chart-step-line.svg");
307    /// Chart area SVG icon.
308    pub const CHART_AREA: Icon = crate::icon_from_path!("chart-types/chart-area.svg");
309    /// Chart hlc area SVG icon.
310    pub const CHART_HLC_AREA: Icon = crate::icon_from_path!("chart-types/chart-hlc-area.svg");
311    /// Chart baseline SVG icon.
312    pub const CHART_BASELINE: Icon = crate::icon_from_path!("chart-types/chart-baseline.svg");
313    /// Chart columns SVG icon.
314    pub const CHART_COLUMNS: Icon = crate::icon_from_path!("chart-types/chart-columns.svg");
315    /// Chart high low SVG icon.
316    pub const CHART_HIGH_LOW: Icon = crate::icon_from_path!("chart-types/chart-high-low.svg");
317    /// Chart tpo SVG icon.
318    pub const CHART_TPO: Icon = crate::icon_from_path!("chart-types/chart-tpo.svg");
319    /// Chart volume footprint SVG icon.
320    pub const CHART_VOLUME_FOOTPRINT: Icon =
321        crate::icon_from_path!("chart-types/chart-volume-footprint.svg");
322    /// Chart session volume profile SVG icon.
323    pub const CHART_SESSION_VOLUME_PROFILE: Icon =
324        crate::icon_from_path!("chart-types/chart-session-volume-profile.svg");
325    /// Chart line break SVG icon.
326    pub const CHART_LINE_BREAK: Icon = crate::icon_from_path!("chart-types/chart-line-break.svg");
327    /// Chart kagi SVG icon.
328    pub const CHART_KAGI: Icon = crate::icon_from_path!("chart-types/chart-kagi.svg");
329    /// Chart range SVG icon.
330    pub const CHART_RANGE: Icon = crate::icon_from_path!("chart-types/chart-range.svg");
331    /// Chart point figure SVG icon.
332    pub const CHART_POINT_FIGURE: Icon =
333        crate::icon_from_path!("chart-types/chart-point-figure.svg");
334    /// Chart renko SVG icon.
335    pub const CHART_RENKO: Icon = crate::icon_from_path!("chart-types/chart-renko.svg");
336    /// Chart heikin ashi SVG icon.
337    pub const CHART_HEIKIN_ASHI: Icon = crate::icon_from_path!("chart-types/chart-heikin-ashi.svg");
338
339    // Interface
340    /// Menu SVG icon.
341    pub const MENU: Icon = crate::icon_from_path!("ui/menu.svg");
342    /// Settings SVG icon.
343    pub const SETTINGS: Icon = crate::icon_from_path!("ui/settings.svg");
344    /// Camera SVG icon.
345    pub const CAMERA: Icon = crate::icon_from_path!("ui/camera.svg");
346    /// Plus SVG icon.
347    pub const PLUS: Icon = crate::icon_from_path!("ui/plus.svg");
348    /// Circled plus for adding a comparison series.
349    pub const COMPARE_ADD: Icon = crate::icon_from_path!("ui/compare-add.svg");
350    /// Indicators SVG icon.
351    pub const INDICATORS: Icon = crate::icon_from_path!("ui/indicators.svg");
352    /// Alerts SVG icon.
353    pub const ALERTS: Icon = crate::icon_from_path!("ui/alert.svg");
354    /// Replay SVG icon.
355    pub const REPLAY: Icon = crate::icon_from_path!("ui/replay.svg");
356    /// Undo SVG icon.
357    pub const UNDO: Icon = crate::icon_from_path!("ui/undo.svg");
358    /// Redo SVG icon.
359    pub const REDO: Icon = crate::icon_from_path!("ui/redo.svg");
360    /// Minus SVG icon.
361    pub const MINUS: Icon = crate::icon_from_path!("ui/minus.svg");
362    /// Check SVG icon.
363    pub const CHECK: Icon = crate::icon_from_path!("ui/check.svg");
364    /// Chevron down SVG icon.
365    pub const CHEVRON_DOWN: Icon = crate::icon_from_path!("ui/chevron-down.svg");
366    /// Chevron up SVG icon.
367    pub const CHEVRON_UP: Icon = crate::icon_from_path!("ui/chevron-up.svg");
368    /// Chevron left SVG icon.
369    pub const CHEVRON_LEFT: Icon = crate::icon_from_path!("ui/chevron-left.svg");
370    /// Chevron right SVG icon.
371    pub const CHEVRON_RIGHT: Icon = crate::icon_from_path!("ui/chevron-right.svg");
372    /// Fullscreen SVG icon.
373    pub const FULLSCREEN: Icon = crate::icon_from_path!("ui/fullscreen.svg");
374    /// Theme toggle SVG icon.
375    pub const THEME_TOGGLE: Icon = crate::icon_from_path!("ui/theme-toggle.svg");
376    /// Quick search SVG icon.
377    pub const QUICK_SEARCH: Icon = crate::icon_from_path!("ui/search.svg");
378    /// Magnifier with a lightning bolt for Quick Search, the command search.
379    pub const COMMAND_SEARCH: Icon = crate::icon_from_path!("ui/quick-search.svg");
380    /// Hex nut for the top toolbar's chart settings.
381    pub const SETTINGS_NUT: Icon = crate::icon_from_path!("ui/settings-nut.svg");
382    /// Light bulb with a plus for publishing the chart.
383    pub const PUBLISH: Icon = crate::icon_from_path!("ui/publish.svg");
384    /// Widget bar calendar SVG icon.
385    pub const WIDGET_BAR_CALENDAR: Icon = crate::icon_from_path!("ui/calendar.svg");
386    /// Go to date SVG icon.
387    pub const GO_TO_DATE: Icon = crate::icon_from_path!("ui/go-to-date.svg");
388    /// Widget bar help SVG icon.
389    pub const WIDGET_BAR_HELP: Icon = crate::icon_from_path!("ui/help.svg");
390    /// Info SVG icon.
391    pub const INFO: Icon = crate::icon_from_path!("ui/info.svg");
392    /// Success SVG icon.
393    pub const SUCCESS: Icon = crate::icon_from_path!("ui/success.svg");
394    /// Warning SVG icon.
395    pub const WARNING: Icon = crate::icon_from_path!("ui/warning.svg");
396    /// Status error SVG icon.
397    pub const STATUS_ERROR: Icon = crate::icon_from_path!("ui/error.svg");
398    /// Stacked layers for the widget bar object panel.
399    pub const WIDGET_BAR_LAYERS: Icon = crate::icon_from_path!("ui/widget-bar-layers.svg");
400    /// Bulleted list for the widget bar watchlist.
401    pub const WIDGET_BAR_WATCHLIST: Icon = crate::icon_from_path!("ui/widget-bar-watchlist.svg");
402    /// Four-point sparkle for the widget bar highlights.
403    pub const WIDGET_BAR_HIGHLIGHTS: Icon = crate::icon_from_path!("ui/highlights.svg");
404    /// Funnel for the widget bar screener.
405    pub const WIDGET_BAR_SCREENER: Icon = crate::icon_from_path!("ui/screener.svg");
406    /// Flame for the widget bar hotlists.
407    pub const WIDGET_BAR_HOTLISTS: Icon = crate::icon_from_path!("ui/hotlists.svg");
408    /// Folded newspaper for the widget bar news.
409    pub const WIDGET_BAR_NEWS: Icon = crate::icon_from_path!("ui/news.svg");
410    /// Bell for the widget bar notifications.
411    pub const WIDGET_BAR_NOTIFICATIONS: Icon = crate::icon_from_path!("ui/notifications.svg");
412    /// Two speech bubbles for the widget bar chats.
413    pub const WIDGET_BAR_CHATS: Icon = crate::icon_from_path!("ui/chats.svg");
414    /// Grid of filled squares for the widget bar products launcher.
415    pub const WIDGET_BAR_PRODUCTS: Icon = crate::icon_from_path!("ui/products.svg");
416    /// Object tree SVG icon.
417    pub const OBJECT_TREE: Icon = crate::icon_from_path!("ui/object-tree.svg");
418    /// Eye SVG icon.
419    pub const EYE: Icon = crate::icon_from_path!("ui/eye.svg");
420    /// Eye hide SVG icon.
421    pub const EYE_HIDE: Icon = crate::icon_from_path!("ui/eye-off.svg");
422    /// Lock SVG icon.
423    pub const LOCK: Icon = crate::icon_from_path!("ui/lock.svg");
424    /// Unlock SVG icon.
425    pub const UNLOCK: Icon = crate::icon_from_path!("ui/unlock.svg");
426    /// Zoom in SVG icon.
427    pub const ZOOM_IN: Icon = crate::icon_from_path!("ui/zoom-in.svg");
428    /// Zoom out SVG icon.
429    pub const ZOOM_OUT: Icon = crate::icon_from_path!("ui/zoom-out.svg");
430    /// Move vertical SVG icon.
431    pub const MOVE_VERTICAL: Icon = crate::icon_from_path!("ui/move-vertical.svg");
432    /// Percent SVG icon.
433    pub const PERCENT: Icon = crate::icon_from_path!("ui/percent.svg");
434    /// Rotate ccw SVG icon.
435    pub const ROTATE_CCW: Icon = crate::icon_from_path!("ui/rotate-ccw.svg");
436    /// Pencil and lock for keeping the drawing tool active.
437    pub const DRAWING_KEEP: Icon = crate::icon_from_path!("ui/drawing-keep.svg");
438    /// Upright horseshoe magnet for the drawing rail.
439    pub const DRAWING_MAGNET: Icon = crate::icon_from_path!("ui/drawing-magnet.svg");
440    /// Magnet SVG icon.
441    pub const MAGNET: Icon = crate::icon_from_path!("ui/magnet.svg");
442    /// Trash SVG icon.
443    pub const TRASH: Icon = crate::icon_from_path!("ui/trash.svg");
444    /// Duplicate SVG icon.
445    pub const DUPLICATE: Icon = crate::icon_from_path!("ui/duplicate.svg");
446    /// Star empty SVG icon.
447    pub const STAR_EMPTY: Icon = crate::icon_from_path!("ui/star.svg");
448    /// Star filled SVG icon.
449    pub const STAR_FILLED: Icon = crate::icon_from_path!("ui/star-filled.svg");
450    /// Layout grid SVG icon.
451    pub const LAYOUT_GRID: Icon = crate::icon_from_path!("ui/layout-grid.svg");
452    /// Single chart pane for choosing the chart layout.
453    pub const LAYOUT_SINGLE: Icon = crate::icon_from_path!("ui/layout-single.svg");
454    // One glyph per multi-chart preset, the cells arranged as `ChartLayoutMode` tiles them.
455    /// Layout two horizontal SVG icon.
456    pub const LAYOUT_TWO_HORIZONTAL: Icon = crate::icon_from_path!("ui/layout-2-columns.svg");
457    /// Layout two vertical SVG icon.
458    pub const LAYOUT_TWO_VERTICAL: Icon = crate::icon_from_path!("ui/layout-2-rows.svg");
459    /// Layout three SVG icon.
460    pub const LAYOUT_THREE: Icon = crate::icon_from_path!("ui/layout-3.svg");
461    /// Three columns.
462    pub const LAYOUT_THREE_HORIZONTAL: Icon = crate::icon_from_path!("ui/layout-3-columns.svg");
463    /// Three rows.
464    pub const LAYOUT_THREE_VERTICAL: Icon = crate::icon_from_path!("ui/layout-3-rows.svg");
465    /// One chart in the left half, two stacked in the right half.
466    pub const LAYOUT_THREE_LARGE_LEFT: Icon = crate::icon_from_path!("ui/layout-3-large-left.svg");
467    /// Two charts stacked in the left half, one in the right half.
468    pub const LAYOUT_THREE_LARGE_RIGHT: Icon =
469        crate::icon_from_path!("ui/layout-3-large-right.svg");
470    /// One chart in the top half, two side by side in the bottom half.
471    pub const LAYOUT_THREE_LARGE_TOP: Icon = crate::icon_from_path!("ui/layout-3-large-top.svg");
472    /// Layout four SVG icon.
473    pub const LAYOUT_FOUR: Icon = crate::icon_from_path!("ui/layout-4.svg");
474    /// Four columns.
475    pub const LAYOUT_FOUR_HORIZONTAL: Icon = crate::icon_from_path!("ui/layout-4-columns.svg");
476    /// Four rows.
477    pub const LAYOUT_FOUR_VERTICAL: Icon = crate::icon_from_path!("ui/layout-4-rows.svg");
478    /// One chart in the left half, three stacked in the right half.
479    pub const LAYOUT_FOUR_LARGE_LEFT: Icon = crate::icon_from_path!("ui/layout-4-large-left.svg");
480    /// Three charts stacked in the left half, one in the right half.
481    pub const LAYOUT_FOUR_LARGE_RIGHT: Icon = crate::icon_from_path!("ui/layout-4-large-right.svg");
482    /// One chart in the top half, three side by side in the bottom half.
483    pub const LAYOUT_FOUR_LARGE_TOP: Icon = crate::icon_from_path!("ui/layout-4-large-top.svg");
484    /// Three charts side by side in the top half, one in the bottom half.
485    pub const LAYOUT_FOUR_LARGE_BOTTOM: Icon =
486        crate::icon_from_path!("ui/layout-4-large-bottom.svg");
487    /// Layout five SVG icon.
488    pub const LAYOUT_FIVE: Icon = crate::icon_from_path!("ui/layout-5.svg");
489    /// Five columns.
490    pub const LAYOUT_FIVE_HORIZONTAL: Icon = crate::icon_from_path!("ui/layout-5-columns.svg");
491    /// Five rows.
492    pub const LAYOUT_FIVE_VERTICAL: Icon = crate::icon_from_path!("ui/layout-5-rows.svg");
493    /// One chart in the left half, four stacked in the right half.
494    pub const LAYOUT_FIVE_LARGE_LEFT: Icon = crate::icon_from_path!("ui/layout-5-large-left.svg");
495    /// Four charts stacked in the left half, one in the right half.
496    pub const LAYOUT_FIVE_LARGE_RIGHT: Icon = crate::icon_from_path!("ui/layout-5-large-right.svg");
497    /// One chart in the top half, four side by side in the bottom half.
498    pub const LAYOUT_FIVE_LARGE_TOP: Icon = crate::icon_from_path!("ui/layout-5-large-top.svg");
499    /// Four charts side by side in the top half, one in the bottom half.
500    pub const LAYOUT_FIVE_LARGE_BOTTOM: Icon =
501        crate::icon_from_path!("ui/layout-5-large-bottom.svg");
502    /// Layout six SVG icon.
503    pub const LAYOUT_SIX: Icon = crate::icon_from_path!("ui/layout-6.svg");
504    /// Six columns.
505    pub const LAYOUT_SIX_HORIZONTAL: Icon = crate::icon_from_path!("ui/layout-6-columns.svg");
506    /// Six rows.
507    pub const LAYOUT_SIX_VERTICAL: Icon = crate::icon_from_path!("ui/layout-6-rows.svg");
508    /// One chart in the left half, five stacked in the right half.
509    pub const LAYOUT_SIX_LARGE_LEFT: Icon = crate::icon_from_path!("ui/layout-6-large-left.svg");
510    /// Five charts stacked in the left half, one in the right half.
511    pub const LAYOUT_SIX_LARGE_RIGHT: Icon = crate::icon_from_path!("ui/layout-6-large-right.svg");
512    /// One chart in the top half, five side by side in the bottom half.
513    pub const LAYOUT_SIX_LARGE_TOP: Icon = crate::icon_from_path!("ui/layout-6-large-top.svg");
514    /// Five charts side by side in the top half, one in the bottom half.
515    pub const LAYOUT_SIX_LARGE_BOTTOM: Icon =
516        crate::icon_from_path!("ui/layout-6-large-bottom.svg");
517    /// Layout seven SVG icon.
518    pub const LAYOUT_SEVEN: Icon = crate::icon_from_path!("ui/layout-7.svg");
519    /// Layout eight SVG icon.
520    pub const LAYOUT_EIGHT: Icon = crate::icon_from_path!("ui/layout-8.svg");
521    /// Layout nine SVG icon.
522    pub const LAYOUT_NINE: Icon = crate::icon_from_path!("ui/layout-9.svg");
523    /// Layout ten SVG icon.
524    pub const LAYOUT_TEN: Icon = crate::icon_from_path!("ui/layout-10.svg");
525    /// Layout eleven SVG icon.
526    pub const LAYOUT_ELEVEN: Icon = crate::icon_from_path!("ui/layout-11.svg");
527    /// Layout twelve SVG icon.
528    pub const LAYOUT_TWELVE: Icon = crate::icon_from_path!("ui/layout-12.svg");
529    /// Layout thirteen SVG icon.
530    pub const LAYOUT_THIRTEEN: Icon = crate::icon_from_path!("ui/layout-13.svg");
531    /// Layout fourteen SVG icon.
532    pub const LAYOUT_FOURTEEN: Icon = crate::icon_from_path!("ui/layout-14.svg");
533    /// Layout fifteen SVG icon.
534    pub const LAYOUT_FIFTEEN: Icon = crate::icon_from_path!("ui/layout-15.svg");
535    /// Layout sixteen SVG icon.
536    pub const LAYOUT_SIXTEEN: Icon = crate::icon_from_path!("ui/layout-16.svg");
537    /// One chart with a tab strip, for the tabbed preset.
538    pub const LAYOUT_TABS: Icon = crate::icon_from_path!("ui/layout-tabs.svg");
539    /// Layout setup SVG icon.
540    pub const LAYOUT_SETUP: Icon = crate::icon_from_path!("ui/layout-setup.svg");
541    /// Close SVG icon.
542    pub const CLOSE: Icon = crate::icon_from_path!("ui/close.svg");
543    /// Three columns, for a table's column chooser.
544    pub const COLUMNS: Icon = crate::icon_from_path!("ui/columns.svg");
545    /// An empty square, for maximizing a panel.
546    pub const MAXIMIZE: Icon = crate::icon_from_path!("ui/maximize.svg");
547    /// A square with a plus.
548    pub const SQUARE_PLUS: Icon = crate::icon_from_path!("ui/square-plus.svg");
549    /// An open folder, for opening a saved layout.
550    pub const FOLDER_OPEN: Icon = crate::icon_from_path!("ui/folder-open.svg");
551    /// Move pane SVG icon.
552    pub const MOVE_PANE: Icon = crate::icon_from_path!("ui/move-pane.svg");
553    /// An arrow into a price axis, for pinning a study to a scale.
554    pub const PIN_TO_SCALE: Icon = crate::icon_from_path!("ui/pin-scale.svg");
555    /// Watchlist SVG icon.
556    pub const WATCHLIST: Icon = crate::icon_from_path!("ui/watchlist.svg");
557    /// Ui drag handle SVG icon.
558    pub const UI_DRAG_HANDLE: Icon = crate::icon_from_path!("ui/drag-handle.svg");
559    /// Ui more horizontal SVG icon.
560    pub const UI_MORE_HORIZONTAL: Icon = crate::icon_from_path!("ui/more.svg");
561    /// Ui buffering SVG icon.
562    pub const UI_BUFFERING: Icon = crate::icon_from_path!("ui/loading.svg");
563
564    // Settings dialog tabs
565    /// Settings symbol SVG icon.
566    pub const SETTINGS_SYMBOL: Icon = crate::icon_from_path!("ui/symbol.svg");
567    /// Settings status line SVG icon.
568    pub const SETTINGS_STATUS_LINE: Icon = crate::icon_from_path!("ui/status-line.svg");
569    /// Settings scales lines SVG icon.
570    pub const SETTINGS_SCALES_LINES: Icon = crate::icon_from_path!("ui/scales-lines.svg");
571    /// Settings canvas SVG icon.
572    pub const SETTINGS_CANVAS: Icon = crate::icon_from_path!("ui/canvas.svg");
573    /// Settings trading SVG icon: a buy and a sell arrow.
574    pub const SETTINGS_TRADING: Icon = crate::icon_from_path!("ui/trading.svg");
575    /// Settings events SVG icon.
576    pub const SETTINGS_EVENTS: Icon = crate::icon_from_path!("ui/events.svg");
577
578    // Indicator categories and object tree groups
579    /// Code SVG icon.
580    pub const CODE: Icon = crate::icon_from_path!("ui/code.svg");
581    /// Users SVG icon.
582    pub const USERS: Icon = crate::icon_from_path!("ui/users.svg");
583    /// Crown SVG icon.
584    pub const CROWN: Icon = crate::icon_from_path!("ui/crown.svg");
585    /// Database SVG icon.
586    pub const DATABASE: Icon = crate::icon_from_path!("ui/database.svg");
587    /// Pencil SVG icon.
588    pub const PENCIL: Icon = crate::icon_from_path!("ui/pencil.svg");
589    /// Template SVG icon.
590    pub const TEMPLATE: Icon = crate::icon_from_path!("ui/template.svg");
591
592    // Connection status
593    /// Status connected SVG icon.
594    pub const STATUS_CONNECTED: Icon = crate::icon_from_path!("ui/connected.svg");
595    /// Status connecting SVG icon.
596    pub const STATUS_CONNECTING: Icon = crate::icon_from_path!("ui/connecting.svg");
597    /// Status disconnected SVG icon.
598    pub const STATUS_DISCONNECTED: Icon = crate::icon_from_path!("ui/disconnected.svg");
599
600    // Media and replay
601    /// Media play SVG icon.
602    pub const MEDIA_PLAY: Icon = crate::icon_from_path!("ui/play.svg");
603    /// Media pause SVG icon.
604    pub const MEDIA_PAUSE: Icon = crate::icon_from_path!("ui/pause.svg");
605    /// Media stop SVG icon.
606    pub const MEDIA_STOP: Icon = crate::icon_from_path!("ui/stop.svg");
607    /// Media skip back SVG icon.
608    pub const MEDIA_SKIP_BACK: Icon = crate::icon_from_path!("ui/skip-back.svg");
609    /// Media skip forward SVG icon.
610    pub const MEDIA_SKIP_FORWARD: Icon = crate::icon_from_path!("ui/skip-forward.svg");
611    /// Ui arrow back SVG icon.
612    pub const UI_ARROW_BACK: Icon = crate::icon_from_path!("ui/step-back.svg");
613    /// Ui arrow forward SVG icon.
614    pub const UI_ARROW_FORWARD: Icon = crate::icon_from_path!("ui/step-forward.svg");
615
616    // Aliases
617    /// Bell SVG icon.
618    pub const BELL: Icon = ALERTS;
619    /// Widget bar alerts SVG icon.
620    pub const WIDGET_BAR_ALERTS: Icon = ALERTS;
621    /// Candlestick SVG icon.
622    pub const CANDLESTICK: Icon = CHART_CANDLES;
623    /// Settings gear SVG icon.
624    pub const SETTINGS_GEAR: Icon = SETTINGS;
625    /// Bar chart SVG icon.
626    pub const BAR_CHART: Icon = CHART_BARS;
627    /// Remove SVG icon.
628    pub const REMOVE: Icon = TRASH;
629    /// Long pos SVG icon.
630    pub const LONG_POS: Icon = LONG_POSITION;
631    /// Short pos SVG icon.
632    pub const SHORT_POS: Icon = SHORT_POSITION;
633}
634
635#[cfg(test)]
636mod tests {
637    use std::collections::HashSet;
638    use std::path::Path;
639
640    /// Asset paths of every `icon_from_path!` constant in this file.
641    fn embedded_paths() -> Vec<String> {
642        let needle = concat!("icon_from_path", "!(\"");
643        include_str!("mod.rs")
644            .split(needle)
645            .skip(1)
646            .map(|rest| rest[..rest.find('"').unwrap()].to_string())
647            .collect()
648    }
649
650    fn svg_files(dir: &Path, out: &mut Vec<String>, root: &Path) {
651        for entry in std::fs::read_dir(dir).unwrap() {
652            let path = entry.unwrap().path();
653            if path.is_dir() {
654                svg_files(&path, out, root);
655            } else if path.extension().is_some_and(|e| e == "svg") {
656                let rel = path.strip_prefix(root).unwrap();
657                out.push(rel.to_string_lossy().replace('\\', "/"));
658            }
659        }
660    }
661
662    /// The SVG loader resolves `currentColor` to black unless the root sets a colour, and egui's
663    /// tint multiplies the texture, so an icon without a white root stays black in every theme.
664    #[test]
665    fn every_icon_file_is_embedded_and_tintable() {
666        let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("assets/icons");
667        let mut files = Vec::new();
668        svg_files(&root, &mut files, &root);
669        let embedded: HashSet<String> = embedded_paths().into_iter().collect();
670        for f in &files {
671            assert!(embedded.contains(f), "{f} is not embedded by any constant");
672            let svg = std::fs::read_to_string(root.join(f)).unwrap();
673            let open_tag = &svg[..svg.find('>').unwrap()];
674            assert!(
675                open_tag.contains(r##"color="#fff""##),
676                "{f}: root element must set color=\"#fff\" so tinting works"
677            );
678        }
679    }
680}