Merge branch 'LightThemeTweaks' of https://github.com/Radiangames/FlaxEngine into Radiangames-LightThemeTweaks

This commit is contained in:
Wojtek Figat
2023-11-13 17:02:12 +01:00
16 changed files with 118 additions and 17 deletions

View File

@@ -86,6 +86,7 @@ namespace FlaxEditor.Content
Folder.ParentFolder = parent.Folder; Folder.ParentFolder = parent.Folder;
Parent = parent; Parent = parent;
} }
IconColor = Style.Current.Foreground;
} }
/// <summary> /// <summary>

View File

@@ -173,8 +173,8 @@ namespace FlaxEditor.GUI
else else
{ {
// No element selected // No element selected
Render2D.FillRectangle(iconRect, new Color(0.2f)); Render2D.FillRectangle(iconRect, Style.Current.BackgroundNormal);
Render2D.DrawText(style.FontMedium, "No asset\nselected", iconRect, Color.Wheat, TextAlignment.Center, TextAlignment.Center, TextWrapping.NoWrap, 1.0f, Height / DefaultIconSize); Render2D.DrawText(style.FontMedium, "No asset\nselected", iconRect, Color.Orange, TextAlignment.Center, TextAlignment.Center, TextWrapping.NoWrap, 1.0f, Height / DefaultIconSize);
} }
// Check if drag is over // Check if drag is over

View File

@@ -100,9 +100,10 @@ namespace FlaxEditor.GUI
AutoResize = true; AutoResize = true;
Offsets = new Margin(0, 0, 0, IconSize); Offsets = new Margin(0, 0, 0, IconSize);
_mouseOverColor = style.Foreground; // Ignoring style on purpose (style would make sense if the icons were white, but they are colored)
_selectedColor = style.Foreground; _mouseOverColor = new Color(0.8f, 0.8f, 0.8f, 1f);
_defaultColor = style.ForegroundGrey; _selectedColor = Color.White;
_defaultColor = new Color(0.7f, 0.7f, 0.7f, 0.5f);
for (int i = 0; i < platforms.Length; i++) for (int i = 0; i < platforms.Length; i++)
{ {

View File

@@ -98,7 +98,7 @@ namespace FlaxEditor.GUI
rect.Width -= leftDepthMargin; rect.Width -= leftDepthMargin;
Render2D.PushClip(rect); Render2D.PushClip(rect);
Render2D.DrawText(style.FontMedium, text, rect, Color.White, column.CellAlignment, TextAlignment.Center); Render2D.DrawText(style.FontMedium, text, rect, Style.Current.Foreground, column.CellAlignment, TextAlignment.Center);
Render2D.PopClip(); Render2D.PopClip();
x += width; x += width;

View File

@@ -208,13 +208,20 @@ namespace FlaxEditor.Options
// If a non-default style was chosen, switch to that style // If a non-default style was chosen, switch to that style
string styleName = themeOptions.SelectedStyle; string styleName = themeOptions.SelectedStyle;
if (styleName != "Default" && themeOptions.Styles.TryGetValue(styleName, out var style) && style != null) if (styleName != "Default" && styleName != "LightDefault" && themeOptions.Styles.TryGetValue(styleName, out var style) && style != null)
{ {
Style.Current = style; Style.Current = style;
} }
else else
{ {
Style.Current = CreateDefaultStyle(); if (styleName == "LightDefault")
{
Style.Current = CreateLightStyle();
}
else
{
Style.Current = CreateDefaultStyle();
}
} }
} }
@@ -233,6 +240,7 @@ namespace FlaxEditor.Options
Foreground = Color.FromBgra(0xFFFFFFFF), Foreground = Color.FromBgra(0xFFFFFFFF),
ForegroundGrey = Color.FromBgra(0xFFA9A9B3), ForegroundGrey = Color.FromBgra(0xFFA9A9B3),
ForegroundDisabled = Color.FromBgra(0xFF787883), ForegroundDisabled = Color.FromBgra(0xFF787883),
ForegroundViewport = Color.FromBgra(0xFFFFFFFF),
BackgroundHighlighted = Color.FromBgra(0xFF54545C), BackgroundHighlighted = Color.FromBgra(0xFF54545C),
BorderHighlighted = Color.FromBgra(0xFF6A6A75), BorderHighlighted = Color.FromBgra(0xFF6A6A75),
BackgroundSelected = Color.FromBgra(0xFF007ACC), BackgroundSelected = Color.FromBgra(0xFF007ACC),
@@ -278,6 +286,60 @@ namespace FlaxEditor.Options
return style; return style;
} }
/// <summary>
/// Creates the light style (2nd default).
/// </summary>
/// <returns>The style object.</returns>
public Style CreateLightStyle()
{
// Metro Style colors
var options = Options;
var style = new Style
{
Background = new Color(0.92f, 0.92f, 0.92f, 1f),
LightBackground = new Color(0.84f, 0.84f, 0.88f, 1f),
DragWindow = new Color(0.0f, 0.26f, 0.43f, 0.70f),
Foreground = new Color(0.0f, 0.0f, 0.0f, 1f),
ForegroundGrey = new Color(0.30f, 0.30f, 0.31f, 1f),
ForegroundDisabled = new Color(0.45f, 0.45f, 0.49f, 1f),
ForegroundViewport = new Color(1.0f, 1.0f, 1.0f, 1f),
BackgroundHighlighted = new Color(0.59f, 0.59f, 0.64f, 1f),
BorderHighlighted = new Color(0.50f, 0.50f, 0.55f, 1f),
BackgroundSelected = new Color(0.00f, 0.46f, 0.78f, 0.78f),
BorderSelected = new Color(0.11f, 0.57f, 0.88f, 0.65f),
BackgroundNormal = new Color(0.67f, 0.67f, 0.75f, 1f),
BorderNormal = new Color(0.59f, 0.59f, 0.64f, 1f),
TextBoxBackground = new Color(0.75f, 0.75f, 0.81f, 1f),
TextBoxBackgroundSelected = new Color(0.73f, 0.73f, 0.80f, 1f),
CollectionBackgroundColor = new Color(0.85f, 0.85f, 0.88f, 1f),
ProgressNormal = new Color(0.03f, 0.65f, 0.12f, 1f),
// Fonts
FontTitle = options.Interface.TitleFont.GetFont(),
FontLarge = options.Interface.LargeFont.GetFont(),
FontMedium = options.Interface.MediumFont.GetFont(),
FontSmall = options.Interface.SmallFont.GetFont(),
// Icons
ArrowDown = Editor.Icons.ArrowDown12,
ArrowRight = Editor.Icons.ArrowRight12,
Search = Editor.Icons.Search12,
Settings = Editor.Icons.Settings12,
Cross = Editor.Icons.Cross12,
CheckBoxIntermediate = Editor.Icons.CheckBoxIntermediate12,
CheckBoxTick = Editor.Icons.CheckBoxTick12,
StatusBarSizeGrip = Editor.Icons.WindowDrag12,
Translate = Editor.Icons.Translate32,
Rotate = Editor.Icons.Rotate32,
Scale = Editor.Icons.Scale32,
Scalar = Editor.Icons.Scalar32,
SharedTooltip = new Tooltip()
};
return style;
}
/// <inheritdoc /> /// <inheritdoc />
public override void OnInit() public override void OnInit()
{ {

View File

@@ -63,13 +63,14 @@ namespace FlaxEditor.Options
private void ReloadOptions(ComboBox obj) private void ReloadOptions(ComboBox obj)
{ {
var themeOptions = (ThemeOptions)ParentEditor.Values[0]; var themeOptions = (ThemeOptions)ParentEditor.Values[0];
var options = new string[themeOptions.Styles.Count + 1]; var options = new string[themeOptions.Styles.Count + 2];
options[0] = "Default"; options[0] = "Default";
options[1] = "LightDefault";
int i = 0; int i = 0;
foreach (var styleName in themeOptions.Styles.Keys) foreach (var styleName in themeOptions.Styles.Keys)
{ {
options[i + 1] = styleName; options[i + 2] = styleName;
i++; i++;
} }
_combobox.ComboBox.SetItems(options); _combobox.ComboBox.SetItems(options);

View File

@@ -115,7 +115,7 @@ namespace FlaxEditor.Viewport.Widgets
if (Icon.IsValid) if (Icon.IsValid)
{ {
// Draw icon // Draw icon
Render2D.DrawSprite(Icon, iconRect, style.Foreground); Render2D.DrawSprite(Icon, iconRect, style.ForegroundViewport);
// Update text rectangle // Update text rectangle
textRect.Location.X += iconSize; textRect.Location.X += iconSize;
@@ -123,7 +123,7 @@ namespace FlaxEditor.Viewport.Widgets
} }
// Draw text // Draw text
Render2D.DrawText(style.FontMedium, _text, textRect, style.Foreground * (IsMouseOver ? 1.0f : 0.9f), TextAlignment.Center, TextAlignment.Center); Render2D.DrawText(style.FontMedium, _text, textRect, style.ForegroundViewport * (IsMouseOver ? 1.0f : 0.9f), TextAlignment.Center, TextAlignment.Center);
} }
/// <inheritdoc /> /// <inheritdoc />

View File

@@ -63,6 +63,7 @@ namespace FlaxEditor.Windows.Profiler
// Table // Table
var headerColor = Style.Current.LightBackground; var headerColor = Style.Current.LightBackground;
var textColor = Style.Current.Foreground;
_table = new Table _table = new Table
{ {
Columns = new[] Columns = new[]
@@ -73,22 +74,26 @@ namespace FlaxEditor.Windows.Profiler
CellAlignment = TextAlignment.Near, CellAlignment = TextAlignment.Near,
Title = "Resource", Title = "Resource",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Type", Title = "Type",
CellAlignment = TextAlignment.Center, CellAlignment = TextAlignment.Center,
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "References", Title = "References",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Memory Usage", Title = "Memory Usage",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
FormatValue = v => Utilities.Utils.FormatBytesCount((ulong)v), FormatValue = v => Utilities.Utils.FormatBytesCount((ulong)v),
}, },
}, },

View File

@@ -93,6 +93,7 @@ namespace FlaxEditor.Windows.Profiler
// Table // Table
var headerColor = Style.Current.LightBackground; var headerColor = Style.Current.LightBackground;
var textColor = Style.Current.Foreground;
_table = new Table _table = new Table
{ {
Columns = new[] Columns = new[]
@@ -103,36 +104,42 @@ namespace FlaxEditor.Windows.Profiler
CellAlignment = TextAlignment.Near, CellAlignment = TextAlignment.Near,
Title = "Event", Title = "Event",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Total", Title = "Total",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
FormatValue = FormatCellPercentage, FormatValue = FormatCellPercentage,
TitleColor = textColor,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Self", Title = "Self",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
FormatValue = FormatCellPercentage, FormatValue = FormatCellPercentage,
TitleColor = textColor,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Time ms", Title = "Time ms",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
FormatValue = FormatCellMs, FormatValue = FormatCellMs,
TitleColor = textColor,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Self ms", Title = "Self ms",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
FormatValue = FormatCellMs, FormatValue = FormatCellMs,
TitleColor = textColor,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Memory", Title = "Memory",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
FormatValue = FormatCellBytes, FormatValue = FormatCellBytes,
TitleColor = textColor,
}, },
}, },
Parent = layout, Parent = layout,

View File

@@ -64,6 +64,7 @@ namespace FlaxEditor.Windows.Profiler
// Table // Table
var headerColor = Style.Current.LightBackground; var headerColor = Style.Current.LightBackground;
var textColor = Style.Current.Foreground;
_table = new Table _table = new Table
{ {
Columns = new[] Columns = new[]
@@ -74,35 +75,41 @@ namespace FlaxEditor.Windows.Profiler
CellAlignment = TextAlignment.Near, CellAlignment = TextAlignment.Near,
Title = "Event", Title = "Event",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Total", Title = "Total",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
FormatValue = (x) => ((float)x).ToString("0.0") + '%', FormatValue = (x) => ((float)x).ToString("0.0") + '%',
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "GPU ms", Title = "GPU ms",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
FormatValue = (x) => ((float)x).ToString("0.000"), FormatValue = (x) => ((float)x).ToString("0.000"),
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Draw Calls", Title = "Draw Calls",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
FormatValue = FormatCountLong, FormatValue = FormatCountLong,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Triangles", Title = "Triangles",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
FormatValue = FormatCountLong, FormatValue = FormatCountLong,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Vertices", Title = "Vertices",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
FormatValue = FormatCountLong, FormatValue = FormatCountLong,
}, },
}, },

View File

@@ -64,6 +64,7 @@ namespace FlaxEditor.Windows.Profiler
// Table // Table
var headerColor = Style.Current.LightBackground; var headerColor = Style.Current.LightBackground;
var textColor = Style.Current.Foreground;
_table = new Table _table = new Table
{ {
Columns = new[] Columns = new[]
@@ -74,18 +75,21 @@ namespace FlaxEditor.Windows.Profiler
CellAlignment = TextAlignment.Near, CellAlignment = TextAlignment.Near,
Title = "Resource", Title = "Resource",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Type", Title = "Type",
CellAlignment = TextAlignment.Center, CellAlignment = TextAlignment.Center,
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Memory Usage", Title = "Memory Usage",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
FormatValue = v => Utilities.Utils.FormatBytesCount((ulong)v), FormatValue = v => Utilities.Utils.FormatBytesCount((ulong)v),
TitleColor = textColor,
}, },
}, },
Parent = layout, Parent = layout,

View File

@@ -253,6 +253,7 @@ namespace FlaxEditor.Windows.Profiler
private static Table InitTable(ContainerControl parent, string name) private static Table InitTable(ContainerControl parent, string name)
{ {
var headerColor = Style.Current.LightBackground; var headerColor = Style.Current.LightBackground;
var textColor = Style.Current.Foreground;
var table = new Table var table = new Table
{ {
Columns = new[] Columns = new[]
@@ -263,28 +264,33 @@ namespace FlaxEditor.Windows.Profiler
CellAlignment = TextAlignment.Near, CellAlignment = TextAlignment.Near,
Title = name, Title = name,
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Count", Title = "Count",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Data Size", Title = "Data Size",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
FormatValue = FormatCellBytes, FormatValue = FormatCellBytes,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Message Size", Title = "Message Size",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
FormatValue = FormatCellBytes, FormatValue = FormatCellBytes,
}, },
new ColumnDefinition new ColumnDefinition
{ {
Title = "Receivers", Title = "Receivers",
TitleBackgroundColor = headerColor, TitleBackgroundColor = headerColor,
TitleColor = textColor,
}, },
}, },
Splits = new[] Splits = new[]

View File

@@ -105,7 +105,7 @@ namespace FlaxEditor.Windows.Profiler
if (_selectedSampleIndex != -1) if (_selectedSampleIndex != -1)
{ {
float selectedX = Width - (_samples.Count - _selectedSampleIndex - 1) * PointsOffset; float selectedX = Width - (_samples.Count - _selectedSampleIndex - 1) * PointsOffset;
Render2D.DrawLine(new Float2(selectedX, 0), new Float2(selectedX, chartHeight), Color.White, 1.5f); Render2D.DrawLine(new Float2(selectedX, 0), new Float2(selectedX, chartHeight), Style.Current.Foreground, 1.5f);
} }
int samplesInViewCount = Math.Min((int)(Width / PointsOffset), _samples.Count) - 1; int samplesInViewCount = Math.Min((int)(Width / PointsOffset), _samples.Count) - 1;
@@ -138,8 +138,8 @@ namespace FlaxEditor.Windows.Profiler
var headerRect = new Rectangle(0, chartHeight, Width, TitleHeight); var headerRect = new Rectangle(0, chartHeight, Width, TitleHeight);
var headerTextRect = new Rectangle(2, chartHeight, Width - 4, TitleHeight); var headerTextRect = new Rectangle(2, chartHeight, Width - 4, TitleHeight);
Render2D.FillRectangle(headerRect, style.BackgroundNormal); Render2D.FillRectangle(headerRect, style.BackgroundNormal);
Render2D.DrawText(style.FontMedium, Title, headerTextRect, Color.White * 0.8f, TextAlignment.Near, TextAlignment.Center); Render2D.DrawText(style.FontMedium, Title, headerTextRect, Style.Current.ForegroundGrey, TextAlignment.Near, TextAlignment.Center);
Render2D.DrawText(style.FontMedium, _sample, headerTextRect, Color.White, TextAlignment.Far, TextAlignment.Center); Render2D.DrawText(style.FontMedium, _sample, headerTextRect, Style.Current.Foreground, TextAlignment.Far, TextAlignment.Center);
} }
private void OnClick(ref Float2 location) private void OnClick(ref Float2 location)

View File

@@ -90,7 +90,7 @@ namespace FlaxEditor.Windows.Profiler
if (_nameLength < bounds.Width + 4) if (_nameLength < bounds.Width + 4)
{ {
Render2D.PushClip(bounds); Render2D.PushClip(bounds);
Render2D.DrawText(style.FontMedium, _name, bounds, Color.White, TextAlignment.Center, TextAlignment.Center); Render2D.DrawText(style.FontMedium, _name, bounds, Style.Current.Foreground, TextAlignment.Center, TextAlignment.Center);
Render2D.PopClip(); Render2D.PopClip();
} }
} }
@@ -115,7 +115,7 @@ namespace FlaxEditor.Windows.Profiler
var style = Style.Current; var style = Style.Current;
var rect = new Rectangle(Float2.Zero, Size); var rect = new Rectangle(Float2.Zero, Size);
Render2D.PushClip(rect); Render2D.PushClip(rect);
Render2D.DrawText(style.FontMedium, Name, rect, Color.White, TextAlignment.Center, TextAlignment.Center, TextWrapping.WrapChars); Render2D.DrawText(style.FontMedium, Name, rect, Style.Current.Foreground, TextAlignment.Center, TextAlignment.Center, TextWrapping.WrapChars);
Render2D.PopClip(); Render2D.PopClip();
} }
} }

View File

@@ -268,6 +268,7 @@ namespace FlaxEngine
Foreground = Color.FromBgra(0xFFFFFFFF), Foreground = Color.FromBgra(0xFFFFFFFF),
ForegroundGrey = Color.FromBgra(0xFFA9A9B3), ForegroundGrey = Color.FromBgra(0xFFA9A9B3),
ForegroundDisabled = Color.FromBgra(0xFF787883), ForegroundDisabled = Color.FromBgra(0xFF787883),
ForegroundViewport = Color.FromBgra(0xFFFFFFFF),
BackgroundHighlighted = Color.FromBgra(0xFF54545C), BackgroundHighlighted = Color.FromBgra(0xFF54545C),
BorderHighlighted = Color.FromBgra(0xFF6A6A75), BorderHighlighted = Color.FromBgra(0xFF6A6A75),
BackgroundSelected = Color.FromBgra(0xFF007ACC), BackgroundSelected = Color.FromBgra(0xFF007ACC),

View File

@@ -104,6 +104,12 @@ namespace FlaxEngine.GUI
[EditorOrder(110)] [EditorOrder(110)]
public Color ForegroundDisabled; public Color ForegroundDisabled;
/// <summary>
/// The foreground color in viewports (usually have a dark background)
/// </summary>
[EditorOrder(115)]
public Color ForegroundViewport;
/// <summary> /// <summary>
/// The background highlighted color. /// The background highlighted color.
/// </summary> /// </summary>