From 65ee77bd011837158f7b6036ea3d774a312cf329 Mon Sep 17 00:00:00 2001 From: Sofiya K Date: Thu, 30 May 2024 13:31:49 +0530 Subject: [PATCH] - Removed unsused codes - Refactor the code --- DemoApp/DemoApp/MauiProgram.cs | 2 +- .../Resources/Styles/DarkThemeColors.xaml | 29 +++- .../Resources/Styles/LightThemeColors.xaml | 29 +++- .../Constant/ColorsConstants.cs | 68 ++++----- .../Controls/DropDown/DropDownContents.xaml | 4 +- .../Controls/DropDown/DropDownViewCell.cs | 6 +- .../Controls/DropDown/TMDropDown.xaml | 2 +- .../Controls/DropDown/TMDropDown.xaml.cs | 4 +- .../Controls/Messages/MessageView.xaml.cs | 2 +- .../Controls/ProgressBar/BaseProgressBar.cs | 8 +- .../Controls/TMCard/TMCard.xaml.cs | 6 +- .../Controls/TMDataGrid/DataGrid.xaml.cs | 2 +- .../Controls/TMDataGrid/DataGridRow.cs | 2 +- .../Controls/TMInput/BaseInput.xaml.cs | 2 +- .../Controls/TMModal/TMModalContents.xaml | 4 +- .../TMSegmentedControl/TMSegmentedItem.xaml | 2 +- .../TMSegmentedItem.xaml.cs | 4 +- .../Controls/TMSlider/SliderCore.cs | 16 +- .../Controls/TMSlider/SliderHelper.cs | 4 +- .../Controls/TMSlider/TMRangeSlider.cs | 4 +- .../Controls/TMSlider/TMSlider.cs | 2 +- .../Controls/TMSpinner/TMSpinner.cs | 2 +- .../Controls/TabBar/TMTabbedPage.cs | 12 +- .../Controls/TabBar/TabViewItem.xaml.cs | 8 +- .../Helpers/ResourceDictionary.cs | 6 +- Trimble.Modus.Components/Styles/Colors.xaml | 47 +----- .../Styles/LightTheme.xaml | 140 +++++++++--------- .../Styles/LightThemeColors.xaml | 6 +- 28 files changed, 212 insertions(+), 211 deletions(-) diff --git a/DemoApp/DemoApp/MauiProgram.cs b/DemoApp/DemoApp/MauiProgram.cs index bc61d39a..be53816e 100644 --- a/DemoApp/DemoApp/MauiProgram.cs +++ b/DemoApp/DemoApp/MauiProgram.cs @@ -14,7 +14,7 @@ public static MauiApp CreateMauiApp() builder .UseMauiApp() .UseMauiCommunityToolkit() - .UseTrimbleModus(new Resources.Styles.LightThemeColors(), new Resources.Styles.DarkThemeColors()) + .UseTrimbleModus() .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); diff --git a/DemoApp/DemoApp/Resources/Styles/DarkThemeColors.xaml b/DemoApp/DemoApp/Resources/Styles/DarkThemeColors.xaml index 510a6f92..90c144a9 100644 --- a/DemoApp/DemoApp/Resources/Styles/DarkThemeColors.xaml +++ b/DemoApp/DemoApp/Resources/Styles/DarkThemeColors.xaml @@ -3,5 +3,32 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="DemoApp.Resources.Styles.DarkThemeColors"> - green + yellow + lightyellow + #ffeb3b + + #FFFFFF + #252A2E + + #d32f2f + #ef5350 + #c62828 + + #3f51b5 + #c5cae9 + #1a237e + + #ed6c02 + #ff9800 + #e65100 + + #2e7d32 + #4caf50 + #1b5e20 + + #9c27b0 + #ba68c8 + #7b1fa2 + + transparent diff --git a/DemoApp/DemoApp/Resources/Styles/LightThemeColors.xaml b/DemoApp/DemoApp/Resources/Styles/LightThemeColors.xaml index 5d8f8cfb..12bff215 100644 --- a/DemoApp/DemoApp/Resources/Styles/LightThemeColors.xaml +++ b/DemoApp/DemoApp/Resources/Styles/LightThemeColors.xaml @@ -2,5 +2,32 @@ - #FFC400 + #019aeb + #DCEDF9 + #004f83 + + #FFFFFF + #252A2E + + #DA212C + #FBD4D7 + #AB1F26 + + #353A40 + #E0E1E9 + #171C1E + + #FBAD26 + #fff5e4 + #e49325 + + #1E8A44 + #E0ECCF + #006638 + + #6A6E79 + #B7B9C3 + #585C65 + + transparent diff --git a/Trimble.Modus.Components/Constant/ColorsConstants.cs b/Trimble.Modus.Components/Constant/ColorsConstants.cs index d3a2e6af..752b966a 100644 --- a/Trimble.Modus.Components/Constant/ColorsConstants.cs +++ b/Trimble.Modus.Components/Constant/ColorsConstants.cs @@ -1,48 +1,40 @@ namespace Trimble.Modus.Components.Constant; + internal class ColorsConstants { - // Blue - public const string TrimbleBlueDark = "TrimbleBlueDark"; - public const string TrimbleBlue = "TrimbleBlue"; - public const string Blue = "Blue"; - public const string BlueDark = "BlueDark"; - public const string BlueLight = "BlueLight"; - public const string HighlightBlue = "HighlightBlue"; - public const string BluePale = "BluePale"; + // Primary + public const string Primary = "Primary"; + public const string PrimaryLight = "PrimaryLight"; + public const string PrimaryDark = "PrimaryDark"; + + // Text Colors + public const string DefaultTextColor = "DefaultTextColor"; + public const string AlternateTextColor = "AlternateTextColor"; - // Black - public const string TrimbleGray = "TrimbleGray"; - public const string Gray10 = "Gray10"; - public const string Gray9 = "Gray9"; - public const string Gray8 = "Gray8"; - public const string Gray7 = "Gray7"; - public const string Gray6 = "Gray6"; - public const string Gray5 = "Gray5"; - public const string Gray4 = "Gray4"; - public const string Gray3 = "Gray3"; - public const string Gray2 = "Gray2"; - public const string Gray1 = "Gray1"; - public const string Gray0 = "Gray0"; - public const string GrayLight = "GrayLight"; - public const string White = "White"; + // Danger + public const string Danger = "Danger"; + public const string DangerLight = "DangerLight"; + public const string DangerDark = "DangerDark"; + + // Tertiary + public const string Tertiary = "Tertiary"; + public const string TertiaryLight = "TertiaryLight"; + public const string TertiaryDark = "TertiaryDark"; - // Orange - public const string YellowDark = "YellowDark"; - public const string Yellow = "Yellow"; - public const string YellowLight = "YellowLight"; - public const string YellowPale = "YellowPale"; + // Warning + public const string Warning = "Warning"; + public const string WarningLight = "WarningLight"; + public const string WarningDark = "WarningDark"; - // Red - public const string RedDark = "RedDark"; - public const string Red = "Red"; - public const string RedLight = "RedLight"; - public const string RedPale = "RedPale"; + // Success + public const string Success = "Success"; + public const string SuccessLight = "SuccessLight"; + public const string SuccessDark = "SuccessDark"; - // Green - public const string GreenDark = "GreenDark"; - public const string Green = "Green"; - public const string GreenLight = "GreenLight"; - public const string GreenPale = "GreenPale"; + // Secondary + public const string Secondary = "Secondary"; + public const string SecondaryLight = "SecondaryLight"; + public const string SecondaryDark = "SecondaryDark"; // Transparent public const string Transparent = "Transparent"; diff --git a/Trimble.Modus.Components/Controls/DropDown/DropDownContents.xaml b/Trimble.Modus.Components/Controls/DropDown/DropDownContents.xaml index 955dc39e..3056e44a 100644 --- a/Trimble.Modus.Components/Controls/DropDown/DropDownContents.xaml +++ b/Trimble.Modus.Components/Controls/DropDown/DropDownContents.xaml @@ -8,7 +8,7 @@ @@ -16,7 +16,7 @@ - diff --git a/Trimble.Modus.Components/Controls/DropDown/DropDownViewCell.cs b/Trimble.Modus.Components/Controls/DropDown/DropDownViewCell.cs index bd21a9d6..60d2c673 100644 --- a/Trimble.Modus.Components/Controls/DropDown/DropDownViewCell.cs +++ b/Trimble.Modus.Components/Controls/DropDown/DropDownViewCell.cs @@ -19,9 +19,9 @@ public DropDownViewCell() { label = new Label { - TextColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.Gray9), + TextColor = ResourcesDictionary.GetColor(ColorsConstants.Secondary), FontAttributes = FontAttributes.None, - BackgroundColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.Transparent), + BackgroundColor = ResourcesDictionary.GetColor(ColorsConstants.Transparent), VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Start, Padding = new Thickness(8, 12) @@ -33,7 +33,7 @@ public DropDownViewCell() { Children = { label }, - BackgroundColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.Transparent), + BackgroundColor = ResourcesDictionary.GetColor(ColorsConstants.Transparent), }; } internal void UpdateBackgroundColor(Color backgroundColor, bool textAttribute) diff --git a/Trimble.Modus.Components/Controls/DropDown/TMDropDown.xaml b/Trimble.Modus.Components/Controls/DropDown/TMDropDown.xaml index 76273e16..c2292358 100644 --- a/Trimble.Modus.Components/Controls/DropDown/TMDropDown.xaml +++ b/Trimble.Modus.Components/Controls/DropDown/TMDropDown.xaml @@ -24,7 +24,7 @@ FontSize="16" HorizontalOptions="Center" FontFamily="OpenSansSemibold" - TextColor="{DynamicResource White}" + TextColor="{DynamicResource AlternateTextColor}" VerticalOptions="Center" /> - internal Color BorderColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.Gray2); + internal Color BorderColor = ResourcesDictionary.GetColor(ColorsConstants.TertiaryDark); /// /// Border thickness for header & each cell /// diff --git a/Trimble.Modus.Components/Controls/TMDataGrid/DataGridRow.cs b/Trimble.Modus.Components/Controls/TMDataGrid/DataGridRow.cs index 838acbbf..cfcec72b 100644 --- a/Trimble.Modus.Components/Controls/TMDataGrid/DataGridRow.cs +++ b/Trimble.Modus.Components/Controls/TMDataGrid/DataGridRow.cs @@ -8,7 +8,7 @@ internal sealed class DataGridRow : Grid #region Fields private Color? _bgColor; - private readonly Color? _textColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.TrimbleGray); + private readonly Color? _textColor = ResourcesDictionary.GetColor(ColorsConstants.AlternateTextColor); private List SelectedIndexes = new List(); #endregion Fields diff --git a/Trimble.Modus.Components/Controls/TMInput/BaseInput.xaml.cs b/Trimble.Modus.Components/Controls/TMInput/BaseInput.xaml.cs index 5d3c3ec0..d236378b 100644 --- a/Trimble.Modus.Components/Controls/TMInput/BaseInput.xaml.cs +++ b/Trimble.Modus.Components/Controls/TMInput/BaseInput.xaml.cs @@ -518,7 +518,7 @@ private void UpdateBorderColors(BaseInput tmInput) { tmInput.InputBorder.Opacity = tmInput.InputLabel.Opacity = tmInput.HelperLayout.Opacity = 1; tmInput.SetDynamicResource(BaseInput.StyleProperty, "Default"); - tmInput.GetCoreContent().BackgroundColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.Transparent); + tmInput.GetCoreContent().BackgroundColor = ResourcesDictionary.GetColor(ColorsConstants.Transparent); SetBorderColor(tmInput); } else diff --git a/Trimble.Modus.Components/Controls/TMModal/TMModalContents.xaml b/Trimble.Modus.Components/Controls/TMModal/TMModalContents.xaml index cd502b1c..f91e19e4 100644 --- a/Trimble.Modus.Components/Controls/TMModal/TMModalContents.xaml +++ b/Trimble.Modus.Components/Controls/TMModal/TMModalContents.xaml @@ -33,10 +33,10 @@ VerticalOptions="Center" HorizontalOptions="Fill" StrokeShape="RoundRectangle 4" - Stroke="{DynamicResource Gray9}" + Stroke="{DynamicResource Secondary}" StrokeThickness="0"> - diff --git a/Trimble.Modus.Components/Controls/TMSegmentedControl/TMSegmentedItem.xaml b/Trimble.Modus.Components/Controls/TMSegmentedControl/TMSegmentedItem.xaml index 80cd4483..233e4c26 100644 --- a/Trimble.Modus.Components/Controls/TMSegmentedControl/TMSegmentedItem.xaml +++ b/Trimble.Modus.Components/Controls/TMSegmentedControl/TMSegmentedItem.xaml @@ -53,7 +53,7 @@ HorizontalOptions="Start" IsVisible="{Binding Source={x:Reference ItemContainer}, Path=ShowSeparator}" Margin="0,8" - Color="{DynamicResource Gray2}" + Color="{DynamicResource TertiaryDark}" VerticalOptions="FillAndExpand" WidthRequest="1.4" /> diff --git a/Trimble.Modus.Components/Controls/TMSegmentedControl/TMSegmentedItem.xaml.cs b/Trimble.Modus.Components/Controls/TMSegmentedControl/TMSegmentedItem.xaml.cs index 96756605..a9247564 100644 --- a/Trimble.Modus.Components/Controls/TMSegmentedControl/TMSegmentedItem.xaml.cs +++ b/Trimble.Modus.Components/Controls/TMSegmentedControl/TMSegmentedItem.xaml.cs @@ -20,11 +20,11 @@ public partial class TMSegmentedItem public static readonly BindableProperty IconProperty = BindableProperty.Create(nameof(Icon), typeof(ImageSource), typeof(TMSegmentedItem), null, propertyChanged: OnSegmentedItemPropertyChanged); - public static readonly BindableProperty CurrentBackgroundColorProperty = BindableProperty.Create(nameof(CurrentBackgroundColor), typeof(Color), typeof(TMSegmentedItem), ResourcesDictionary.ColorsDictionary(ColorsConstants.Transparent), propertyChanged: OnCurrentBackgroundColorChanged); + public static readonly BindableProperty CurrentBackgroundColorProperty = BindableProperty.Create(nameof(CurrentBackgroundColor), typeof(Color), typeof(TMSegmentedItem), ResourcesDictionary.GetColor(ColorsConstants.Transparent), propertyChanged: OnCurrentBackgroundColorChanged); public static readonly BindableProperty SizeProperty = BindableProperty.Create(nameof(Size), typeof(SegmentedControlSize), typeof(TMSegmentedItem), SegmentedControlSize.Small, propertyChanged: OnSizeChanged); - public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(TMSegmentedItem), ResourcesDictionary.ColorsDictionary(ColorsConstants.Gray9), propertyChanged: OnTextColorChanged); + public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(TMSegmentedItem), ResourcesDictionary.GetColor(ColorsConstants.Secondary), propertyChanged: OnTextColorChanged); public static readonly BindableProperty IconTintColorProperty = BindableProperty.Create(nameof(IconTintColor), typeof(Color), typeof(TMSegmentedItem), Colors.Black, propertyChanged: OnIconTintColorChanged); #endregion diff --git a/Trimble.Modus.Components/Controls/TMSlider/SliderCore.cs b/Trimble.Modus.Components/Controls/TMSlider/SliderCore.cs index cbeede58..1ed93833 100644 --- a/Trimble.Modus.Components/Controls/TMSlider/SliderCore.cs +++ b/Trimble.Modus.Components/Controls/TMSlider/SliderCore.cs @@ -315,11 +315,7 @@ protected void OnIsEnabledChanged() } else if (child is Border) { - (child as Border).Stroke = IsEnabled - ? ThumbColor - : ResourcesDictionary.ColorsDictionary( - ColorsConstants.Gray1 - ); + (child as Border).Stroke = IsEnabled ? ThumbColor : ResourcesDictionary.GetColor(ColorsConstants.Tertiary); } } } @@ -335,11 +331,11 @@ internal void SetThumbStyle(Border border, double thumbStrokeThickness, double t border.StrokeThickness = thumbStrokeThickness; border.Stroke = IsEnabled ? ThumbColor - : ResourcesDictionary.ColorsDictionary( - ColorsConstants.Gray1 + : ResourcesDictionary.GetColor( + ColorsConstants.Tertiary ); border.Margin = new Thickness(0); - border.BackgroundColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.White); + border.BackgroundColor = ResourcesDictionary.GetColor(ColorsConstants.DefaultTextColor); border.StrokeShape = new Ellipse() { WidthRequest = thumbSize, @@ -356,8 +352,8 @@ internal void RefreshThumbColor(Border border) { border.Stroke = IsEnabled ? ThumbColor - : ResourcesDictionary.ColorsDictionary( - ColorsConstants.Gray1 + : ResourcesDictionary.GetColor( + ColorsConstants.Tertiary ); } /// diff --git a/Trimble.Modus.Components/Controls/TMSlider/SliderHelper.cs b/Trimble.Modus.Components/Controls/TMSlider/SliderHelper.cs index cdbd7dc1..e0745ff3 100644 --- a/Trimble.Modus.Components/Controls/TMSlider/SliderHelper.cs +++ b/Trimble.Modus.Components/Controls/TMSlider/SliderHelper.cs @@ -59,7 +59,7 @@ public static Label CreateStepLabel(SliderSize size = SliderSize.Medium) } return new Label { - TextColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.Gray9), + TextColor = ResourcesDictionary.GetColor(ColorsConstants.Secondary), FontSize = 8, HorizontalTextAlignment = TextAlignment.Start, LineBreakMode = LineBreakMode.NoWrap, @@ -96,7 +96,7 @@ public static BoxView CreateStepLine(SliderSize size = SliderSize.Medium) Margin = new Thickness(leftPadding, 0, 0, 0), WidthRequest = 1, HeightRequest = 4, - Color = ResourcesDictionary.ColorsDictionary(ColorsConstants.Gray9) + Color = ResourcesDictionary.GetColor(ColorsConstants.Secondary) }; } } diff --git a/Trimble.Modus.Components/Controls/TMSlider/TMRangeSlider.cs b/Trimble.Modus.Components/Controls/TMSlider/TMRangeSlider.cs index af35ea6d..abf06573 100644 --- a/Trimble.Modus.Components/Controls/TMSlider/TMRangeSlider.cs +++ b/Trimble.Modus.Components/Controls/TMSlider/TMRangeSlider.cs @@ -291,8 +291,8 @@ protected override void OnLayoutPropertyChanged() Track.StrokeThickness = 0; TrackHighlight.StrokeThickness = 0; - UpperValueLabel.TextColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.White); - LowerValueLabel.TextColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.White); + UpperValueLabel.TextColor = ResourcesDictionary.GetColor(ColorsConstants.DefaultTextColor); + LowerValueLabel.TextColor = ResourcesDictionary.GetColor(ColorsConstants.DefaultTextColor); var trackSize = 8; _thumbSize = 24; diff --git a/Trimble.Modus.Components/Controls/TMSlider/TMSlider.cs b/Trimble.Modus.Components/Controls/TMSlider/TMSlider.cs index 8d04b0cd..81f5f639 100644 --- a/Trimble.Modus.Components/Controls/TMSlider/TMSlider.cs +++ b/Trimble.Modus.Components/Controls/TMSlider/TMSlider.cs @@ -230,7 +230,7 @@ protected override void OnLayoutPropertyChanged() Track.StrokeThickness = 0; TrackHighlight.StrokeThickness = 0; - ValueLabel.TextColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.White); + ValueLabel.TextColor = ResourcesDictionary.GetColor(ColorsConstants.AlternateTextColor); var trackSize = 8; _thumbSize = 24; var thumbStrokeThickness = 3; diff --git a/Trimble.Modus.Components/Controls/TMSpinner/TMSpinner.cs b/Trimble.Modus.Components/Controls/TMSpinner/TMSpinner.cs index 9442bbfa..cd4881c4 100644 --- a/Trimble.Modus.Components/Controls/TMSpinner/TMSpinner.cs +++ b/Trimble.Modus.Components/Controls/TMSpinner/TMSpinner.cs @@ -13,7 +13,7 @@ public class TMSpinner : SKCanvasView { #region Private Properties private SpinnerType _spinnerType; - private Color _spinnerColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.TrimbleBlue); + private Color _spinnerColor = ResourcesDictionary.GetColor(ColorsConstants.Primary); private float _startAngle = 0f; private int minWidth = 42, minHeight = 42, animateTimerSeconds = 10; private float _sweepAngle = 180f; diff --git a/Trimble.Modus.Components/Controls/TabBar/TMTabbedPage.cs b/Trimble.Modus.Components/Controls/TabBar/TMTabbedPage.cs index 9ddceec9..1ae5f79d 100644 --- a/Trimble.Modus.Components/Controls/TabBar/TMTabbedPage.cs +++ b/Trimble.Modus.Components/Controls/TabBar/TMTabbedPage.cs @@ -66,14 +66,14 @@ public TMTabbedPage() tabStripContainer = new Grid { - BackgroundColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.TrimbleBlue), + BackgroundColor = ResourcesDictionary.GetColor(ColorsConstants.Primary), HeightRequest = 70, VerticalOptions = LayoutOptions.Fill }; mainContainer = new Grid { - BackgroundColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.Red), + BackgroundColor = ResourcesDictionary.GetColor(ColorsConstants.Danger), RowSpacing = 0 }; @@ -86,7 +86,7 @@ public TMTabbedPage() { contentViewContainer = new ContentView { - BackgroundColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.GrayLight) + BackgroundColor = ResourcesDictionary.GetColor(ColorsConstants.TertiaryLight) }; Grid.SetRow(contentViewContainer, 0); mainContainer.Children.Add(contentViewContainer); @@ -95,7 +95,7 @@ public TMTabbedPage() { contentContainer = new CarouselView { - BackgroundColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.GrayLight), + BackgroundColor = ResourcesDictionary.GetColor(ColorsConstants.TertiaryLight), ItemsSource = TabItems, ItemTemplate = new DataTemplate(() => { @@ -150,11 +150,11 @@ private static void OnTabColorPropertyChanged(BindableObject bindable, object ol { if ((TabColor)newValue == TabColor.Primary) { - tabbedPage.tabStripContainer.BackgroundColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.TrimbleBlue); + tabbedPage.tabStripContainer.BackgroundColor = ResourcesDictionary.GetColor(ColorsConstants.Primary); } else { - tabbedPage.tabStripContainer.BackgroundColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.White); + tabbedPage.tabStripContainer.BackgroundColor = ResourcesDictionary.GetColor(ColorsConstants.SecondaryDark); } } } diff --git a/Trimble.Modus.Components/Controls/TabBar/TabViewItem.xaml.cs b/Trimble.Modus.Components/Controls/TabBar/TabViewItem.xaml.cs index 28156c06..6ac037f9 100644 --- a/Trimble.Modus.Components/Controls/TabBar/TabViewItem.xaml.cs +++ b/Trimble.Modus.Components/Controls/TabBar/TabViewItem.xaml.cs @@ -43,7 +43,7 @@ public partial class TabViewItem : ContentView internal static readonly BindablePropertyKey CurrentTextColorPropertyKey = - BindableProperty.CreateReadOnly(nameof(CurrentTextColor), typeof(Color), typeof(TabViewItem), ResourcesDictionary.ColorsDictionary(ColorsConstants.Gray9)); + BindableProperty.CreateReadOnly(nameof(CurrentTextColor), typeof(Color), typeof(TabViewItem), ResourcesDictionary.GetColor(ColorsConstants.Secondary)); public static readonly BindableProperty CurrentTextColorProperty = CurrentTextColorPropertyKey.BindableProperty; @@ -129,17 +129,17 @@ public TabViewItem() private void UpdateTabColor() { - var trimbleBlueColor = ResourcesDictionary.ColorsDictionary(ColorsConstants.TrimbleBlue); + var trimbleBlueColor = ResourcesDictionary.GetColor(ColorsConstants.PrimaryLight); var selectedColor = trimbleBlueColor; if (TabColor == TabColor.Primary) { - selectedColor = IsSelected ? trimbleBlueColor : ResourcesDictionary.ColorsDictionary(ColorsConstants.White); + selectedColor = IsSelected ? trimbleBlueColor : ResourcesDictionary.GetColor(ColorsConstants.DefaultTextColor); } text.TextColor = selectedColor; icon.Behaviors.Clear(); icon.Behaviors.Add(new IconTintColorBehavior { TintColor = selectedColor }); - selectedBorder.BackgroundColor = !IsSelected ? ResourcesDictionary.ColorsDictionary(ColorsConstants.Transparent) : ResourcesDictionary.ColorsDictionary(ColorsConstants.BluePale); + selectedBorder.BackgroundColor = !IsSelected ? ResourcesDictionary.GetColor(ColorsConstants.Transparent) : ResourcesDictionary.GetColor(ColorsConstants.PrimaryLight); } private static void OnTabViewItemPropertyChanged(BindableObject bindable, object oldValue, object newValue) { diff --git a/Trimble.Modus.Components/Helpers/ResourceDictionary.cs b/Trimble.Modus.Components/Helpers/ResourceDictionary.cs index 1e31b4a2..d830f637 100644 --- a/Trimble.Modus.Components/Helpers/ResourceDictionary.cs +++ b/Trimble.Modus.Components/Helpers/ResourceDictionary.cs @@ -2,8 +2,8 @@ public static class ResourcesDictionary { - public static Color ColorsDictionary(string styleKey) + public static Color GetColor(string styleKey) { - return (Color)new Styles.Colors()[styleKey]; + return Application.Current.Resources[styleKey] as Color; } -} \ No newline at end of file +} diff --git a/Trimble.Modus.Components/Styles/Colors.xaml b/Trimble.Modus.Components/Styles/Colors.xaml index 9d64b67a..a5333542 100644 --- a/Trimble.Modus.Components/Styles/Colors.xaml +++ b/Trimble.Modus.Components/Styles/Colors.xaml @@ -2,53 +2,8 @@ - - #004f83 - #0063a3 - #0063a3 - #0E416C - #217cbb - #019aeb - #DCEDF9 - - - #252a2e - #171c1e - #353a40 - #464b52 - #585c65 - #6a6e79 - #7d808d - #90939f - #a3a6b1 - #b7b9c3 - #cbcdd6 - #e0e1e9 - #f1f1f6 - #FFFFFF - - - #e49325 - #fbad26 - #fec157 - #fff5e4 - - - #AB1F26 - #da212c - #e86363 - #FBD4D7 - - - #006638 - #1E8A44 - #4ea646 - #E0ECCF - - - transparent - #80000000 #4D363545 + diff --git a/Trimble.Modus.Components/Styles/LightTheme.xaml b/Trimble.Modus.Components/Styles/LightTheme.xaml index c1f1bd3f..3c87c0d1 100644 --- a/Trimble.Modus.Components/Styles/LightTheme.xaml +++ b/Trimble.Modus.Components/Styles/LightTheme.xaml @@ -5,7 +5,7 @@ x:Class="Trimble.Modus.Components.Styles.LightTheme"> + Color="{StaticResource DefaultTextColor}"/> @@ -14,36 +14,36 @@ + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource DefaultTextColor}" /> + Color="{StaticResource DefaultTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> @@ -97,15 +97,15 @@ + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource DefaultTextColor}" /> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}" /> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource AlternateTextColor}" /> @@ -205,11 +205,11 @@ + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource DefaultTextColor}" /> - + + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource DefaultTextColor}" /> + Color="{StaticResource DefaultTextColor}" /> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource DefaultTextColor}"/> @@ -407,9 +407,9 @@ + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource DefaultTextColor}"/> @@ -418,17 +418,17 @@ + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource DefaultTextColor}"/> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource AlternateTextColor}" /> + Color="{StaticResource DefaultTextColor}"/> #0063A3 #DCEDF9 #004f83 - - #FFFFFF - #252A2E + #252A2E + #FFFFFF + #DA212C #FBD4D7 #AB1F26