From 776b9e4f9492e8cbfe485c25dbcf5ca5f447bca0 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Tue, 12 Jul 2022 11:53:36 -0400 Subject: [PATCH] chore: Remove '_color' and '_brush' props from BTSColors The BTSColor props are implicitly convertible to both System.Windows.Media.Color and Brush --- .../View/VolSurfaceTimeDecayEditor.xaml | 7 +- .../MarketView/MarketViewAnimationManager.cs | 4 +- .../Spreader/ExecutionStrategyEditor.xaml | 2 +- .../Spreader/ExecutionStrategyEditor.xaml.cs | 9 +- .../ActivityLog/ActivityLogCategories.cs | 53 ++++---- .../Trading/AlgoStudio/AlgoStudioView.xaml | 9 +- .../Modules/Trading/Fills/FillsView.xaml | 8 +- .../View/FairValueLineSettingsView.xaml | 5 +- .../Trading/Ladder/View/LadderGridHost.cs | 2 +- .../Trading/Ladder/View/LadderRender.cs | 4 +- .../Trading/Ladder/View/LadderView.xaml | 2 +- .../Trading/Ladder/View/MiniLadderView.xaml | 2 +- .../ManualFills/ManualFillRowEditor.xaml | 8 +- .../ManualFills/ManualFillsView.xaml.cs | 2 +- .../MiniOrderBook/MiniOrderBookView.xaml | 12 +- .../Trading/OrderBook/OrderBookColumns.cs | 8 +- .../Trading/OrderBook/View/OrderBookView.xaml | 4 +- .../OrderBook/View/OrderBookView.xaml.cs | 2 +- .../Trading/PNL/Settings/PNLSettings.cs | 86 ++++++------- .../Trading/PNL/VM/PNLCellIndexBuilder.cs | 10 +- .../Modules/Trading/PNL/View/PNLView.xaml | 24 +++- .../ReconcileReport/ReconcileReportView.xaml | 8 +- src/client/spark/Orders/OrderIconFactory.cs | 6 +- .../Slide/SlideReportConfigurationView.xaml | 2 +- .../Risk/Slide/SlideReportSettingsView.xaml | 2 +- .../core/FontsAndColors/BTSColorExtension.cs | 14 ++- .../core/FontsAndColors/BTSColorExtensions.cs | 4 + .../spark/core/FontsAndColors/BTSColors.cs | 116 +++--------------- .../spark/view/Controls/BusySpinner.xaml | 2 +- .../FrameworkElementColumns/SideColumn.cs | 13 +- .../Filters/Views/FilterContentControl.xaml | 6 +- .../Controls/DialogSkirts/DialogSkirt.xaml | 2 +- .../DialogSkirtOKApplyCancel.xaml | 2 +- .../DialogSkirts/DialogSkirtOKCancel.xaml | 2 +- .../view/Controls/Dialogs/BTSMessageBox.xaml | 3 +- .../Dialogs/SupportRequestWindow.xaml | 9 +- .../Controls/ExpandedContentSelector.xaml | 2 +- .../view/Controls/Order/AlgoParamsView.xaml | 9 +- .../AlgoTemplateFavoriteButtonsView.xaml | 10 +- .../Order/OrderDetailsPopupControl.xaml | 10 +- .../view/Controls/Time/DateTimePicker.xaml | 2 +- .../view/Controls/Time/TimeSpanControl.xaml | 2 +- .../spark/view/Controls/ToolBar/ToolBar.xaml | 3 +- .../DragDrop/DragDropDocumentPreview.xaml | 4 +- .../MarkupExtensions/BTSBrushExtension.cs | 23 ++++ src/client/spark/view/Resources/Buttons.xaml | 5 +- .../spark/view/Resources/ComboBoxes.xaml | 14 +-- .../spark/view/Resources/Converters.xaml | 2 +- .../spark/view/Resources/WindowStyle.xaml | 11 +- src/client/spark/view/Shell/About.xaml | 2 +- src/client/spark/view/Shell/Launcher.xaml | 2 +- .../spark/view/Shell/Login/LoginView.xaml | 3 +- .../Settings/Global/GlobalAlertsView.xaml | 5 +- .../Shell/Settings/ShellSettingsDialog.xaml | 15 ++- .../view/Spark/Ladder/MBO/MBOPopupView.cs | 15 +-- 55 files changed, 298 insertions(+), 295 deletions(-) create mode 100644 src/client/spark/view/MarkupExtensions/BTSBrushExtension.cs diff --git a/src/client/spark/Modules/Analytics/VolSurface/View/VolSurfaceTimeDecayEditor.xaml b/src/client/spark/Modules/Analytics/VolSurface/View/VolSurfaceTimeDecayEditor.xaml index 9500f1e14..08ef119f4 100644 --- a/src/client/spark/Modules/Analytics/VolSurface/View/VolSurfaceTimeDecayEditor.xaml +++ b/src/client/spark/Modules/Analytics/VolSurface/View/VolSurfaceTimeDecayEditor.xaml @@ -65,12 +65,9 @@ - + + - - diff --git a/src/client/spark/Modules/Market/MarketView/MarketViewAnimationManager.cs b/src/client/spark/Modules/Market/MarketView/MarketViewAnimationManager.cs index cd9a7572a..f8b711ad2 100644 --- a/src/client/spark/Modules/Market/MarketView/MarketViewAnimationManager.cs +++ b/src/client/spark/Modules/Market/MarketView/MarketViewAnimationManager.cs @@ -111,10 +111,10 @@ namespace mbts.spark { new CellAnimation(Columns.Position, CellAnimation.Type.DownArrow, Brushes.Red), new CellAnimation(Columns.DayChange, CellAnimation.Type.UpArrow, Brushes.Green), new CellAnimation(Columns.DayChange, CellAnimation.Type.DownArrow, Brushes.Red), - new CellAnimation(Columns.WorkingBids, CellAnimation.Type.Border, BTSColors.warning_brush), + new CellAnimation(Columns.WorkingBids, CellAnimation.Type.Border, BTSColors.warning.to_brush()), new CellAnimation(Columns.WorkingBids, CellAnimation.Type.Border, new SolidColorBrush(BTSColors.MarketData.bid)), new CellAnimation(Columns.WorkingBids, CellAnimation.Type.Border, Brushes.Green), - new CellAnimation(Columns.WorkingAsks, CellAnimation.Type.Border, BTSColors.warning_brush), + new CellAnimation(Columns.WorkingAsks, CellAnimation.Type.Border, BTSColors.warning.to_brush()), new CellAnimation(Columns.WorkingAsks, CellAnimation.Type.Border, new SolidColorBrush(BTSColors.MarketData.ask)), new CellAnimation(Columns.WorkingAsks, CellAnimation.Type.Border, Brushes.Red)); private static readonly TimeSpan flash_duration = TimeSpan.FromSeconds(2); diff --git a/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml b/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml index 2752f8557..bcf51cdcc 100644 --- a/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml +++ b/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml @@ -426,7 +426,7 @@ - + diff --git a/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml.cs b/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml.cs index 58ee0f1e8..3e84676bb 100644 --- a/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml.cs +++ b/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml.cs @@ -320,7 +320,14 @@ namespace mbts.ui.spark { if (_vm.GetErrors(nameof(SyntheticEditorVM.tick_factors)).Cast().Any()) this.draw_border(drawing_context, _tick_factors_picker.value, null, new Pen(Brushes.Red, 1)); string error_text = string.Join(", ", _vm.AllErrors); - this.draw_relative_text(RelativePosition.Below, error_text, drawing_context, _name_text_box.value, BTSColors.header_error_text_brush, 0, y_offset); + this.draw_relative_text( + RelativePosition.Below, + error_text, + drawing_context, + _name_text_box.value, + BTSColors.header_error_text.to_brush(), + 0, + y_offset); } } } diff --git a/src/client/spark/Modules/Support/ActivityLog/ActivityLogCategories.cs b/src/client/spark/Modules/Support/ActivityLog/ActivityLogCategories.cs index 95ff84f2b..df1326b4e 100644 --- a/src/client/spark/Modules/Support/ActivityLog/ActivityLogCategories.cs +++ b/src/client/spark/Modules/Support/ActivityLog/ActivityLogCategories.cs @@ -1,25 +1,28 @@ -using mbts.ui; -using mbts.ui.controls; - -using System.Collections.Generic; -using System.Windows.Media; - -namespace bts.shell { - public static class ActivityLogCategory { - public static ILogViewerCategory order = new LogViewerCategory("Order", BTSColors.Orders.sent_brush); - public static ILogViewerCategory fill = new LogViewerCategory("Fill", BTSColors.Orders.filled_dark_brush); - public static ILogViewerCategory cancel = new LogViewerCategory("Cancel", BTSColors.Orders.working_cancel_brush); - public static ILogViewerCategory modify = new LogViewerCategory("Modify", BTSColors.Orders.modified_brush); - public static ILogViewerCategory warn = new LogViewerCategory("Warn", Brushes.Gold); - - public static IEnumerable all_categories { - get { - yield return order; - yield return fill; - yield return cancel; - yield return modify; - yield return warn; - } - } - } -} +using mbts.ui; +using mbts.ui.controls; + +using System.Collections.Generic; +using System.Windows.Media; + +namespace bts.shell { + public static class ActivityLogCategory { + public static ILogViewerCategory order = _mk("Order", BTSColors.Orders.sent); + public static ILogViewerCategory fill = _mk("Fill", BTSColors.Orders.filled_dark); + public static ILogViewerCategory cancel = _mk("Cancel", BTSColors.Orders.working_cancel); + public static ILogViewerCategory modify = _mk("Modify", BTSColors.Orders.modified); + public static ILogViewerCategory warn = _mk("Warn", Colors.Gold); + + public static IEnumerable all_categories { + get { + yield return order; + yield return fill; + yield return cancel; + yield return modify; + yield return warn; + } + } + + static ILogViewerCategory _mk(string name, Color color) => + new LogViewerCategory(name, color.to_brush().frozen()); + } +} diff --git a/src/client/spark/Modules/Trading/AlgoStudio/AlgoStudioView.xaml b/src/client/spark/Modules/Trading/AlgoStudio/AlgoStudioView.xaml index 2f579040a..2c322a7f9 100644 --- a/src/client/spark/Modules/Trading/AlgoStudio/AlgoStudioView.xaml +++ b/src/client/spark/Modules/Trading/AlgoStudio/AlgoStudioView.xaml @@ -219,7 +219,14 @@ - + + + - + - + diff --git a/src/client/spark/Modules/Trading/ReconcileReport/ReconcileReportView.xaml b/src/client/spark/Modules/Trading/ReconcileReport/ReconcileReportView.xaml index 1e759a06c..285f1021e 100644 --- a/src/client/spark/Modules/Trading/ReconcileReport/ReconcileReportView.xaml +++ b/src/client/spark/Modules/Trading/ReconcileReport/ReconcileReportView.xaml @@ -113,16 +113,12 @@ - + - + diff --git a/src/client/spark/Orders/OrderIconFactory.cs b/src/client/spark/Orders/OrderIconFactory.cs index d9a3f3545..146b8cad3 100644 --- a/src/client/spark/Orders/OrderIconFactory.cs +++ b/src/client/spark/Orders/OrderIconFactory.cs @@ -13,12 +13,14 @@ using System.Windows.Media; namespace mbts.ui.spark { internal static class OrderIconFactory { + static readonly Pen _bid_pen = new(BTSColors.MarketData.bid.to_brush(true), 4); + static readonly Pen _ask_pen = new(BTSColors.MarketData.ask.to_brush(true), 4); + static readonly ConcurrentDictionary _algo_palette = new ConcurrentDictionary(); + static OrderIconFactory() { _bid_pen.Freeze(); _ask_pen.Freeze(); } - private static readonly Pen _bid_pen = new Pen(BTSColors.MarketData.bid_brush, 4), _ask_pen = new Pen(BTSColors.MarketData.ask_brush, 4); - private static readonly ConcurrentDictionary _algo_palette = new ConcurrentDictionary(); public static ImageSource Create(OrderMetadata metadata, Side side) { Brush brush = _algo_palette.GetOrAdd(metadata.Color, c => { diff --git a/src/client/spark/Risk/Slide/SlideReportConfigurationView.xaml b/src/client/spark/Risk/Slide/SlideReportConfigurationView.xaml index 2248552b8..a97b66ef8 100644 --- a/src/client/spark/Risk/Slide/SlideReportConfigurationView.xaml +++ b/src/client/spark/Risk/Slide/SlideReportConfigurationView.xaml @@ -40,7 +40,7 @@ - + - + diff --git a/src/client/spark/core/FontsAndColors/BTSColorExtension.cs b/src/client/spark/core/FontsAndColors/BTSColorExtension.cs index 246235fc0..4cd63d9e2 100644 --- a/src/client/spark/core/FontsAndColors/BTSColorExtension.cs +++ b/src/client/spark/core/FontsAndColors/BTSColorExtension.cs @@ -23,6 +23,12 @@ namespace mbts.ui { [ConstructorArgument("name")] public string? Name { get; set; } + public Type? Type { get; set; } + + public static BTSColor get_color(string name) => + _color_map.TryGetValue(name, out var color) ? + color() : throw new ColorNotFoundException(); + public override object? ProvideValue(IServiceProvider service_provider) { if (service_provider is null) { return null; @@ -33,8 +39,8 @@ namespace mbts.ui { var pvt = service_provider.GetValueTargetProvider() ?? throw new InvalidOperationException("IProvideValueTarget is null"); - var tgt_type = _deduce_target_type(pvt); - var color = _get_color(Name); + var tgt_type = Type ?? _deduce_target_type(pvt); + var color = get_color(Name); return tgt_type == typeof(Color) ? (Color)color : (Brush)color; } @@ -51,10 +57,6 @@ namespace mbts.ui { return typeof(Brush); } - static BTSColor _get_color(string name) => - _color_map.TryGetValue(name, out var color) ? - color() : throw new ColorNotFoundException(); - static IEnumerable<(string, Func)> _normalized_color_props( Type type, string? prefix) { var bts_colors = ReflectionHelper.static_property_getters(type) diff --git a/src/client/spark/core/FontsAndColors/BTSColorExtensions.cs b/src/client/spark/core/FontsAndColors/BTSColorExtensions.cs index 61f3bdde1..d72a1cd2b 100644 --- a/src/client/spark/core/FontsAndColors/BTSColorExtensions.cs +++ b/src/client/spark/core/FontsAndColors/BTSColorExtensions.cs @@ -9,6 +9,10 @@ namespace mbts.ui { return brush; } + public static System.Windows.Media.SolidColorBrush to_brush( + this BTSColor color, double opacity) => + new(color) { Opacity = opacity }; + public static System.Windows.Media.SolidColorBrush to_brush( this BTSColor color, bool freeze) { var brush = new System.Windows.Media.SolidColorBrush(color); diff --git a/src/client/spark/core/FontsAndColors/BTSColors.cs b/src/client/spark/core/FontsAndColors/BTSColors.cs index a2cd07300..9158bab1f 100644 --- a/src/client/spark/core/FontsAndColors/BTSColors.cs +++ b/src/client/spark/core/FontsAndColors/BTSColors.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Windows.Media; namespace mbts.ui { @@ -9,34 +9,18 @@ namespace mbts.ui { public static class BTSColors { // 84 = 255 * 0.33 const byte _one_third_opacity_strength = 84; - static Brush _header_brush, _header_text_brush, _header_alternate_brush, _header_error_text_brush; - - static BTSColors() { - _header_brush = header; - _header_text_brush = header_text; - _header_alternate_brush = header_alternate; - _header_error_text_brush = header_error_text; - } [DisplayInfo(name = "Default Header")] public static BTSColor header { get { return BTSCoreColors.base_blue; } } - public static Color header_color => header; - public static Brush header_brush { get { return _header_brush; } } public static BTSColor header_text { get { return BTSCoreColors.white; } } - public static Color header_text_color => header_text; public static BTSColor header_error_text { get; } = new BTSColor(0xFE, 0x6A, 0x6E); - public static Brush header_error_text_brush => _header_error_text_brush; public static BTSColor header_border { get { return new BTSColor(0x63, 0x8A, 0xCC); } } - public static Brush header_text_brush { get { return _header_text_brush; } } public static BTSColor header_alternate { get { return BTSCoreColors.blue_grey; } } - public static Color header_alternate_color => header_alternate; public static BTSColor disabled_text { get { return BTSCoreColors.gray_light; } } public static BTSColor pinkalicious { get { return new BTSColor(0xff, 0x33, 0x99); } } public static BTSColor error_foreground => Colors.Firebrick; - public static Color error_foreground_color => error_foreground; - public static Brush error_foreground_brush => error_foreground; // Grid column colors public static class Security { @@ -73,17 +57,6 @@ namespace mbts.ui { } public static class MarketData { - static readonly Brush _bid_brush; - static readonly Brush _ask_brush; - - static MarketData() { - // null BTSColors are implicitly gray media colors/brushes (this behavior is problematic and should be changed), - // therefore need to ensure that _bid/_ask are not null before instantiating bid_brush/ask_brush - bid = new BTSColor(0x16, 0x7e, 0xd3); - ask = BTSCoreColors.red_darker; - _bid_brush = bid; - _ask_brush = ask; - } // Base Colors [DisplayInfo(name = "Market Data")] public static BTSColor default_background { get { return BTSCoreColors.blue_light_lighter; } } @@ -93,19 +66,13 @@ namespace mbts.ui { [DisplayInfo(name = "Bid Text")] public static BTSColor bid_text { get { return BTSCoreColors.blue; } } //Another bid color option: 40,70,200 - public static BTSColor bid { get; } + public static BTSColor bid => 0xff167ed3; public static BTSColor bid_alt { get { return BTSCoreColors.blue_light; } } - public static BTSColor ask { get; } + public static BTSColor ask { get; } = BTSCoreColors.red_darker; public static BTSColor ask_alt { get { return new BTSColor(255, 180, 180); } } public static BTSColor last { get { return BTSCoreColors.black; } } public static BTSColor bid_ask_alt_blend => BTSCoreColors.purple_light; - public static Brush bid_brush => _bid_brush; - public static Brush ask_brush => _ask_brush; - - public static Color bid_color => bid; - public static Color ask_color => ask; - [DisplayInfo(name = "Settlement")] public static BTSColor settlement_background { get { return Grid.default_column_background; } } [DisplayInfo(name = "Driver")] @@ -159,15 +126,15 @@ namespace mbts.ui { } public static class PNL { - public static Color anchor_color => Colors.Gold; - public static Color profit_color => Colors.Green; - public static Color loss_color => BTSColors.red; - public static Color header_row_background_color => 0xFFAAAAAA.argb_color(); + public static BTSColor anchor => Colors.Gold; + public static BTSColor profit => Colors.Green; + public static BTSColor loss => red; + public static BTSColor header_row_background => 0xffaaaaaa; // group background colors - public static Color group_row_background_color1 => 0xFFE9E9E9.argb_color(); - public static Color group_row_background_color2 => 0xFFCACACA.argb_color(); - public static Color group_row_background_color3 => 0xFF9DB0C1.argb_color(); - public static Color group_row_background_color4 => group_row_background_color1; + public static BTSColor group_row_background_color1 => 0xffe9e9e9; + public static BTSColor group_row_background_color2 => 0xffcacaca; + public static BTSColor group_row_background_color3 => 0xff9db0c1; + public static BTSColor group_row_background_color4 => group_row_background_color1; public static IEnumerable group_alternating_background_colors { get { @@ -189,24 +156,11 @@ namespace mbts.ui { _error_order_background = new BTSColor(0xffd6d6), _canceled_order_background = new BTSColor(0xffe4b2); - - static Orders() { - sent_brush = _sent; - filled_dark_brush = filled_dark; - working_cancel_brush = working_cancel; - working_order_background_brush = working_order_background; - completed_order_background_brush = completed_order_background; - error_order_background_brush = error_order_background; - canceled_order_background_brush = canceled_order_background; - modified_brush = modified; - } - // Base Colors [DisplayInfo(name = "Orders")] public static BTSColor default_background { get { return BTSCoreColors.blue_light_lighter; } } public static BTSColor default_text { get { return BTSCoreColors.black; } } public static BTSColor sent => _sent; - public static readonly Brush sent_brush; [DisplayInfo(name = "Price")] public static BTSColor price_background { get { return BTSCoreColors.blue_light_dark; } } @@ -216,23 +170,16 @@ namespace mbts.ui { // Alerts public static BTSColor working_status_summary { get { return BTSCoreColors.green; } } public static BTSColor working_cancel { get { return BTSCoreColors.red; } } - public static readonly Brush working_cancel_brush; public static BTSColor working_cancel_text { get { return BTSCoreColors.white; } } public static BTSColor working_order_background => _working_order_background; - public static readonly Brush working_order_background_brush; public static BTSColor completed_order_background => _completed_order_background; - public static readonly Brush completed_order_background_brush; public static BTSColor error_order_background => _error_order_background; - public static readonly Brush error_order_background_brush; public static BTSColor canceled_order_background => _canceled_order_background; - public static readonly Brush canceled_order_background_brush; public static BTSColor filled { get { return BTSCoreColors.green_light_light_saturated; } } public static BTSColor filled_dark => BTSCoreColors.green; - public static readonly Brush filled_dark_brush; // used in ladder log viewer public static BTSColor modified => orange; - public static readonly Brush modified_brush; // used in the ladder log viewer [DisplayInfo(name = "Order Buy Text")] public static BTSColor order_buy_text { get { return BTSCoreColors.black; } } @@ -334,7 +281,8 @@ namespace mbts.ui { public static BTSColor expiration_seperator { get { return grid_line_dark; } } [DisplayInfo(name = "Grid Default Background")] - public static BTSColor default_column_background { get { return BTSCoreColors.blue_light; } } + public static BTSColor default_column_background => 0x00ffffff; + public static BTSColor default_column_foreground => 0xff000000; public static BTSColor light_column_background { get { return BTSCoreColors.white; } } // input grid @@ -362,7 +310,6 @@ namespace mbts.ui { public static BTSColor menu_expander_mouseover { get { return BTSCoreColors.blue_bright; } } public static BTSColor spark_menu_background { get { return new BTSColor(0xe9); } } public static Color spark_menu_background_color => spark_menu_background; - public static Brush spark_menu_background_brush => spark_menu_background; public static BTSColor input_background { get { return new BTSColor(0xff); } } public static BTSColor input_text { get { return default_text; } } @@ -371,7 +318,7 @@ namespace mbts.ui { public static BTSColor input_mouseover_background { get { return new BTSColor(0xAB, 0xAD, 0xB3); } } public static BTSColor input_selected_border { get { return new BTSColor(0x7E, 0xB4, 0xEA); } } public static BTSColor input_selected_background { get { return new BTSColor(0xAB, 0xAD, 0xB3); } } - public static BTSColor text_prompt_foreground_color => 0x99999999; + public static BTSColor text_prompt_foreground => 0x99999999; public static BTSColor input_disabled_text => new BTSColor(0x87); public static BTSColor input_disabled_text_dark => new BTSColor(0x66); @@ -383,9 +330,6 @@ namespace mbts.ui { public static BTSColor input_dirty_border => warning; - public static Brush text_prompt_foreground_brush { get; } = text_prompt_foreground_color.to_brush().frozen(); - public static Brush input_disabled_text_brush { get; } = input_disabled_text.to_brush().frozen(); - public static class ComboBox { // Normal public static BTSColor normal_background { get { return UI.input_background; } } @@ -510,7 +454,6 @@ namespace mbts.ui { public static BTSColor disabled_border { get { return normal_border; } } public static BTSColor disabled_foreground { get { return new BTSColor(0x87); } } public static Color disabled_foreground_color => disabled_foreground; - public static Brush disabled_foreground_brush => disabled_foreground; // Focused @@ -655,78 +598,47 @@ namespace mbts.ui { // Style Guide Colors public static Color brand_lightest { get { return UI.brand_lightest; } } - public static Brush brand_lightest_brush { get { return new SolidColorBrush(brand_lightest); } } public static Color brand_lighter { get { return UI.brand_lighter; } } - public static Brush brand_lighter_brush { get { return new SolidColorBrush(brand_lighter); } } public static Color brand_light { get { return UI.brand_light; } } - public static Brush brand_light_brush { get { return new SolidColorBrush(brand_light); } } public static Color brand_info { get { return UI.brand_info; } } - public static Brush brand_info_brush { get { return new SolidColorBrush(brand_info); } } public static Color brand_medium { get { return UI.brand_medium; } } - public static Brush brand_medium_brush { get { return new SolidColorBrush(brand_medium); } } public static Color brand_primary { get { return UI.brand_primary; } } - public static Brush brand_primary_brush { get { return new SolidColorBrush(brand_primary); } } public static Color brand_dark { get { return UI.brand_dark; } } - public static Brush brand_dark_brush { get { return new SolidColorBrush(brand_dark); } } public static Color brand_darker { get { return UI.brand_darker; } } - public static Brush brand_darker_brush { get { return new SolidColorBrush(brand_darker); } } public static Color brand_darkest { get { return UI.brand_darkest; } } - public static Brush brand_darkest_brush { get { return new SolidColorBrush(brand_darkest); } } public static Color success { get { return UI.success; } } - public static Brush success_brush { get { return new SolidColorBrush(success); } } public static Color danger { get { return UI.danger; } } - public static Brush danger_brush { get { return new SolidColorBrush(danger); } } public static Color warning { get { return UI.warning; } } - public static Brush warning_brush { get { return new BTSColor(191, 102, 0); } } public static Color warning_dark { get { return UI.warning_dark; } } - public static Brush warning_dark_brush { get { return new SolidColorBrush(warning_dark); } } public static Color warning_light { get { return UI.warning_light; } } - public static Brush warning_light_brush { get { return new SolidColorBrush(warning_light); } } public static Color text_default { get { return UI.default_text; } } - public static Brush text_default_brush { get { return new SolidColorBrush(text_default); } } public static Color text_alternate { get { return UI.alternate_text; } } - public static Brush text_alternate_brush { get { return new SolidColorBrush(text_alternate); } } public static Color text_alternate_dark { get { return (Color)BTSCoreColors.black; } } - public static Brush text_alternate_dark_brush { get { return new SolidColorBrush(text_alternate_dark); } } // Logo Colors public static Color logo { get { return Color.FromRgb(0x00, 0x86, 0xbf); } } - public static Brush logo_brush { get { return new SolidColorBrush(logo); } } public static Color logo_brown { get { return Color.FromRgb(56, 52, 49); } } - public static Brush logo_brown_brush { get { return new SolidColorBrush(logo_brown); } } public static Color logo_gray { get { return Color.FromRgb(179, 179, 179); } } - public static Brush logo_gray_brush { get { return new SolidColorBrush(logo_gray); } } public static Color common_background => UI.default_background; - public static Brush common_background_brush { get; } = common_background.to_solid_brush().frozen(); public static Color accent1 { get { return UI.accent_light; } } - public static Brush accent1_brush { get { return new SolidColorBrush(accent1); } } public static Color accent_dark { get { return UI.accent_dark; } } - public static Brush accent_dark_brush { get { return new SolidColorBrush(accent_dark); } } public static Color accent_light { get { return UI.accent_light; } } - public static Brush accent_light_brush { get { return new SolidColorBrush(accent_light); } } - public static Brush accent_light_background_brush { get { Brush rv = accent_light_brush; rv.Opacity = 0.2; return rv; } } - - public static Brush form_border_brush { get { return new SolidColorBrush(UI.form_border); } } public static Color dialog_skirt { get { return UI.dialog_skirt; } } - public static Brush dialog_skirt_brush { get { return new SolidColorBrush(dialog_skirt); } } // Main form (Launcher) display colors #region Main Form Colors public static Color red_orange { get { return Color.FromRgb(0xde, 0x34, 0x29); } } public static Color blue { get { return Color.FromRgb(0x16, 0x7e, 0xd3); } } - public static Brush blue_brush { get { return new SolidColorBrush(blue); } } public static Color yellow { get { return Color.FromRgb(0xdd, 0xaa, 0x27); } } - public static Brush yellow_brush { get { return new SolidColorBrush(yellow); } } public static Color green { get { return Color.FromRgb(0x43, 0xa2, 0x3c); } } public static Color orange { get { return Color.FromRgb(0xfc, 0x8b, 0x00); } } public static Color pale_blue { get { return Color.FromRgb(0x2f, 0xb5, 0xe4); } } - public static Brush pale_blue_brush { get { return new SolidColorBrush(pale_blue); } } public static Color red { get { return Color.FromRgb(0xc4, 0x12, 0x12); } } public static Color pale_green { get { return Color.FromRgb(0x37, 0x7d, 0x35); } } public static Color purple { get { return Color.FromRgb(0x81, 0x5f, 0x91); } } diff --git a/src/client/spark/view/Controls/BusySpinner.xaml b/src/client/spark/view/Controls/BusySpinner.xaml index 2d4b5d3aa..133a12b5c 100644 --- a/src/client/spark/view/Controls/BusySpinner.xaml +++ b/src/client/spark/view/Controls/BusySpinner.xaml @@ -76,7 +76,7 @@ diff --git a/src/client/spark/view/Shell/About.xaml b/src/client/spark/view/Shell/About.xaml index 1d45fa776..e8a1d3d32 100644 --- a/src/client/spark/view/Shell/About.xaml +++ b/src/client/spark/view/Shell/About.xaml @@ -16,7 +16,7 @@ - BTS Spark + BTS Spark Version: Logged in as: diff --git a/src/client/spark/view/Shell/Launcher.xaml b/src/client/spark/view/Shell/Launcher.xaml index 215ec64b0..33ba2facc 100644 --- a/src/client/spark/view/Shell/Launcher.xaml +++ b/src/client/spark/view/Shell/Launcher.xaml @@ -120,7 +120,7 @@ - + diff --git a/src/client/spark/view/Shell/Login/LoginView.xaml b/src/client/spark/view/Shell/Login/LoginView.xaml index b0c76c6d1..778204efe 100644 --- a/src/client/spark/view/Shell/Login/LoginView.xaml +++ b/src/client/spark/view/Shell/Login/LoginView.xaml @@ -3,7 +3,6 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:mbts.ui" - xmlns:uicore="clr-namespace:mbts.ui" xmlns:shell="clr-namespace:mbts.ui.shell" xmlns:c="clr-namespace:mbts.ui.controls" xmlns:converters="clr-namespace:mbts.ui.converters" @@ -111,7 +110,7 @@ - + diff --git a/src/client/spark/view/Shell/Settings/Global/GlobalAlertsView.xaml b/src/client/spark/view/Shell/Settings/Global/GlobalAlertsView.xaml index 1176f8a14..05f558b9f 100644 --- a/src/client/spark/view/Shell/Settings/Global/GlobalAlertsView.xaml +++ b/src/client/spark/view/Shell/Settings/Global/GlobalAlertsView.xaml @@ -34,7 +34,10 @@ - + diff --git a/src/client/spark/view/Shell/Settings/ShellSettingsDialog.xaml b/src/client/spark/view/Shell/Settings/ShellSettingsDialog.xaml index e18057717..5ba3f7d1a 100644 --- a/src/client/spark/view/Shell/Settings/ShellSettingsDialog.xaml +++ b/src/client/spark/view/Shell/Settings/ShellSettingsDialog.xaml @@ -311,7 +311,12 @@ - + @@ -328,7 +333,10 @@ - + @@ -336,9 +344,6 @@ - - - diff --git a/src/client/spark/view/Spark/Ladder/MBO/MBOPopupView.cs b/src/client/spark/view/Spark/Ladder/MBO/MBOPopupView.cs index 0dde91f44..9fc0e8687 100644 --- a/src/client/spark/view/Spark/Ladder/MBO/MBOPopupView.cs +++ b/src/client/spark/view/Spark/Ladder/MBO/MBOPopupView.cs @@ -57,15 +57,12 @@ namespace mbts.spark { draw_grid(dc, _dp, _dp.header.Height + margin.Top + margin.Bottom); } - static Brush brush_for(Side side, OrderPositionImmutable order) { - if (MBOPopupModel.ismine(order)) return Brushes.Black; - switch (side) { - case Side.Buy: return BTSColors.MarketData.bid_brush; - case Side.Sell: return BTSColors.MarketData.ask_brush; - default: - return Brushes.DarkGray; - } - } + static Brush brush_for(Side side, OrderPositionImmutable order) => + MBOPopupModel.ismine(order) ? Brushes.Black : side switch { + Side.Buy => BTSColors.MarketData.bid.to_brush(), + Side.Sell => BTSColors.MarketData.ask.to_brush(), + _ => Brushes.DarkGray + }; static void draw_grid(DrawingContext dc, MBOPopupDrawParams dp, double offset) { for (int x = 0; x < dp.data.orders.Count(); ++x) {