From 80eb81a1072febeb506bf0e38206746b5feb0fe4 Mon Sep 17 00:00:00 2001 From: instance-id Date: Sat, 30 Apr 2022 22:12:39 -0500 Subject: [PATCH] New animation types and additional functionality. --- Runtime/Animations/ContinuousAnimations.cs | 56 +- Runtime/Animations/HoverAnimations.cs | 36 +- .../Animations/VisualElementBaseAnimation.cs | 134 +- .../AnimatedFoldout/AnimatedFoldout.cs | 43 +- .../AnimatedFoldout/UIElementExpander.cs | 12 +- Runtime/Enhancements/FastLinq.meta | 8 + Runtime/Enhancements/FastLinq/FastLinq.asmdef | 3 + .../FastLinq/FastLinq.asmdef.meta | 7 + .../FastLinq/ImprovedAggregate.cs | 153 ++ .../FastLinq/ImprovedAggregate.cs.meta | 11 + Runtime/Enhancements/FastLinq/ImprovedAll.cs | 59 + .../Enhancements/FastLinq/ImprovedAll.cs.meta | 11 + Runtime/Enhancements/FastLinq/ImprovedAny.cs | 92 ++ .../Enhancements/FastLinq/ImprovedAny.cs.meta | 11 + .../Enhancements/FastLinq/ImprovedContains.cs | 67 + .../FastLinq/ImprovedContains.cs.meta | 11 + .../Enhancements/FastLinq/ImprovedCount.cs | 79 + .../FastLinq/ImprovedCount.cs.meta | 11 + .../Enhancements/FastLinq/ImprovedFirst.cs | 79 + .../FastLinq/ImprovedFirst.cs.meta | 11 + .../FastLinq/ImprovedFirstOrDefault.cs | 73 + .../FastLinq/ImprovedFirstOrDefault.cs.meta | 11 + Runtime/Enhancements/FastLinq/ImprovedLast.cs | 105 ++ .../FastLinq/ImprovedLast.cs.meta | 11 + .../FastLinq/ImprovedLastOrDefault.cs | 105 ++ .../FastLinq/ImprovedLastOrDefault.cs.meta | 11 + .../FastLinq/ImprovedSequenceEqual.cs | 70 + .../FastLinq/ImprovedSequenceEqual.cs.meta | 11 + .../Scripts/Extensions/AssetFileExtensions.cs | 2 +- .../Extensions/CollectionExtensions.cs | 10 +- Runtime/Scripts/Extensions/Color.meta | 3 + .../Extensions/Color/ColorExtensions.cs | 307 ++++ .../Extensions/Color/ColorExtensions.cs.meta | 3 + Runtime/Scripts/Extensions/Color/ColorTool.cs | 115 ++ .../Extensions/Color/ColorTool.cs.meta | 3 + Runtime/Scripts/Extensions/Color/Colors.cs | 1345 +++++++++++++++++ .../Scripts/Extensions/Color/Colors.cs.meta | 3 + Runtime/Scripts/Extensions/Color/GetColor.cs | 54 + .../Scripts/Extensions/Color/GetColor.cs.meta | 3 + Runtime/Scripts/Extensions/Color/MathEx.cs | 124 ++ .../Scripts/Extensions/Color/MathEx.cs.meta | 3 + .../Scripts/Extensions/DataTypes/ClassData.cs | 11 +- .../Scripts/Extensions/DataTypes/FieldData.cs | 36 +- .../Scripts/Extensions/DataTypes/ListPool.cs | 64 + .../Extensions/DataTypes/ListPool.cs.meta | 3 + .../ElementGeneration/ContainerData.cs | 3 + .../ElementGeneration/ContainerStyle.cs | 3 + .../ElementGeneration/ElementGeneration.cs | 25 +- ...ectionExtensions.cs => ReflectionExten.cs} | 6 +- ...nsions.cs.meta => ReflectionExten.cs.meta} | 0 .../Extensions/VisualElementExtension.cs | 653 +++++++- Runtime/Scripts/UI/EATKEditor.cs | 6 +- ...id.instance.elementanimationtoolkit.asmdef | 18 +- Samples/Editor.meta | 3 - .../Scripts/Editor/ExampleComponentEditor.cs | 4 +- 55 files changed, 3930 insertions(+), 171 deletions(-) create mode 100644 Runtime/Enhancements/FastLinq.meta create mode 100644 Runtime/Enhancements/FastLinq/FastLinq.asmdef create mode 100644 Runtime/Enhancements/FastLinq/FastLinq.asmdef.meta create mode 100644 Runtime/Enhancements/FastLinq/ImprovedAggregate.cs create mode 100644 Runtime/Enhancements/FastLinq/ImprovedAggregate.cs.meta create mode 100644 Runtime/Enhancements/FastLinq/ImprovedAll.cs create mode 100644 Runtime/Enhancements/FastLinq/ImprovedAll.cs.meta create mode 100644 Runtime/Enhancements/FastLinq/ImprovedAny.cs create mode 100644 Runtime/Enhancements/FastLinq/ImprovedAny.cs.meta create mode 100644 Runtime/Enhancements/FastLinq/ImprovedContains.cs create mode 100644 Runtime/Enhancements/FastLinq/ImprovedContains.cs.meta create mode 100644 Runtime/Enhancements/FastLinq/ImprovedCount.cs create mode 100644 Runtime/Enhancements/FastLinq/ImprovedCount.cs.meta create mode 100644 Runtime/Enhancements/FastLinq/ImprovedFirst.cs create mode 100644 Runtime/Enhancements/FastLinq/ImprovedFirst.cs.meta create mode 100644 Runtime/Enhancements/FastLinq/ImprovedFirstOrDefault.cs create mode 100644 Runtime/Enhancements/FastLinq/ImprovedFirstOrDefault.cs.meta create mode 100644 Runtime/Enhancements/FastLinq/ImprovedLast.cs create mode 100644 Runtime/Enhancements/FastLinq/ImprovedLast.cs.meta create mode 100644 Runtime/Enhancements/FastLinq/ImprovedLastOrDefault.cs create mode 100644 Runtime/Enhancements/FastLinq/ImprovedLastOrDefault.cs.meta create mode 100644 Runtime/Enhancements/FastLinq/ImprovedSequenceEqual.cs create mode 100644 Runtime/Enhancements/FastLinq/ImprovedSequenceEqual.cs.meta create mode 100644 Runtime/Scripts/Extensions/Color.meta create mode 100644 Runtime/Scripts/Extensions/Color/ColorExtensions.cs create mode 100644 Runtime/Scripts/Extensions/Color/ColorExtensions.cs.meta create mode 100644 Runtime/Scripts/Extensions/Color/ColorTool.cs create mode 100644 Runtime/Scripts/Extensions/Color/ColorTool.cs.meta create mode 100644 Runtime/Scripts/Extensions/Color/Colors.cs create mode 100644 Runtime/Scripts/Extensions/Color/Colors.cs.meta create mode 100644 Runtime/Scripts/Extensions/Color/GetColor.cs create mode 100644 Runtime/Scripts/Extensions/Color/GetColor.cs.meta create mode 100644 Runtime/Scripts/Extensions/Color/MathEx.cs create mode 100644 Runtime/Scripts/Extensions/Color/MathEx.cs.meta create mode 100644 Runtime/Scripts/Extensions/DataTypes/ListPool.cs create mode 100644 Runtime/Scripts/Extensions/DataTypes/ListPool.cs.meta rename Runtime/Scripts/Extensions/{ReflectionExtensions.cs => ReflectionExten.cs} (87%) rename Runtime/Scripts/Extensions/{ReflectionExtensions.cs.meta => ReflectionExten.cs.meta} (100%) delete mode 100644 Samples/Editor.meta diff --git a/Runtime/Animations/ContinuousAnimations.cs b/Runtime/Animations/ContinuousAnimations.cs index 1b21764..ddba53a 100644 --- a/Runtime/Animations/ContinuousAnimations.cs +++ b/Runtime/Animations/ContinuousAnimations.cs @@ -18,32 +18,44 @@ public static class ContinuousAnimations // -------------------------------------------------- @HoverBorder // --------------------------------------------------------------- - /// - /// Pulse the border of an element between two colors - /// - /// ** To help combat your element shifting position slightly when a border is applied on hover, - /// it is a good idea to add a border to your element before hand and just set color to 'initial' - /// so that it is transparent, then keep 'addBorder' parameter as false. - /// - /// The element in which this function will be applied - /// Color 1 in which to pulse between - /// Color 2 in which to pulse between - /// The original color of the element being changed. Can be obtained and passed via 'visualElement.style.backgroundColor.value' - /// The amount of time it takes in milliseconds to complete the first color animation - /// The amount of time it takes in milliseconds to complete the second color animation - /// Adds a border if the element does not have one already - /// The width in which the borders should be when displaying - /// Function that can be called when the animation is completed - /// The parameters of the Vector4(1-4) represent which borders should have their colors changed: 1(x) = left, 2(y) = top, 3(z) = right, 4(w) = bottom. - /// If only the top and bottom borders are desired to pulse, you would pass new Vector4(0, 1, 0, 1) - public static IVisualElementScheduledItem AnimBorderPulse(this VisualElement element, Color color1, Color color2, Color original = default, + /// + /// Pulse the border of an element between two colors + /// + /// ** To help combat your element shifting position slightly when a border is applied on hover, + /// it is a good idea to add a border to your element before hand and just set color to 'initial' + /// so that it is transparent, then keep 'addBorder' parameter as false. + /// + /// + /// + /// "#2F569C".FromHex(), "#D2A00C".FromHex() + /// + /// + /// The element in which this function will be applied + /// Color 1 in which to pulse between + /// Color 2 in which to pulse between + /// The original color of the element being changed. Can be obtained and passed via 'visualElement.style.backgroundColor.value' + /// The amount of time it takes in milliseconds to complete the first color animation + /// The amount of time it takes in milliseconds to complete the second color animation + /// Adds a border if the element does not have one already + /// The width in which the borders should be when displaying + /// Function that can be called when the animation is completed + /// The parameters of the Vector4(1-4) represent which borders should have their colors changed: 1(x) = left, 2(y) = top, 3(z) = right, 4(w) = bottom. + /// If only the top and bottom borders are desired to pulse, you would pass new Vector4(0, 1, 0, 1) + /// Pass in a new ScheduledItem object, which will return the animation in order to control it externally + /// Time in which to delay between each pulse set + public static IVisualElementScheduledItem AnimBorderPulse( + this VisualElement element, + Color color1, + Color color2, + Color original = default, int color1DurationMs = 1000, int color2DurationMs = 1000, bool addBorder = false, Vector2 borderStartEndWidth = default, Action callback = null, Vector4 borderSelection = default, - IVisualElementScheduledItem repeatedAnim = default + IVisualElementScheduledItem repeatedAnim = default, + int delayBetween = 0 ) { if (borderStartEndWidth == default) @@ -148,7 +160,7 @@ void DoCleanup() // -- via the AnimateTo local function. Once completed -- // -- the AnimateFrom function is called animating back -- // -- to the original color. This is then repeated for -- - // -- as long as the mouse is hovered over the target -- + // -- until stopped -------------------------------------- void PulseIn(IVisualElementScheduledItem repeated) { if (!repeated.isActive) { DoCleanup(); return; } @@ -170,7 +182,7 @@ void PulseOut(IVisualElementScheduledItem repeated) color2DurationMs, () => { if(!repeated.isActive) DoCleanup();}).KeepAlive(); } // @formatter:on - var recurring = color1DurationMs + color2DurationMs + 20; + var recurring = color1DurationMs + color2DurationMs + 20 + delayBetween; repeatedAnim = element.schedule .Execute(() => { PulseIn(repeatedAnim); }) diff --git a/Runtime/Animations/HoverAnimations.cs b/Runtime/Animations/HoverAnimations.cs index 69c9c52..37e7c3f 100644 --- a/Runtime/Animations/HoverAnimations.cs +++ b/Runtime/Animations/HoverAnimations.cs @@ -111,28 +111,29 @@ public static void HoverColor(this T target, StyleColor original, Color hover /// /// var originalColor = ColorUtil.FromHex("#BABABA"); /// var hoverBGColor = ColorUtil.FromHex("#2F569C"); - /// + /// /// label.HoverBackground(originalColor, hoverBGColor); /// /// > /// The element in which this function will be applied /// The original color of the element being changed. Can be obtained and passed via 'visualElement.style.backgroundColor.value' /// The color to fade to when element is hovered + /// Transition animation duration when switching between states /// Create a condition to pass to this function. Example: bool Condition(VisualElement sRow) => selectedRow == packageListRow; /// The element in which the optional condition will be evaluated. Ex. in the example of 'bool Condition(VisualElement sRow) => selectedRow == packageListRow;', the conditionalElement would be 'VisualElement selectedRow' /// Whether to animate the transition of the background color public static void HoverBackground(this VisualElement target, StyleColor original, Color hoverColor, Func condition = null, - VisualElement conditionElement = null, bool animate = false) + VisualElement conditionElement = null, bool animate = false, int animDuration = 250) { var mouseOver = new ValueAnimation(); var mouseOut = new ValueAnimation(); if (animate) { - mouseOver = target.AnimateBackgroundColor(original.value, hoverColor, 250); + mouseOver = target.AnimateBackgroundColor(original.value, hoverColor, animDuration); mouseOver.KeepAlive(); - mouseOut = target.AnimateBackgroundColor(hoverColor, original.value, 250); + mouseOut = target.AnimateBackgroundColor(hoverColor, original.value, animDuration); mouseOut.KeepAlive(); } @@ -430,6 +431,33 @@ void PulseOut(in ValueAnimation pulse) #endregion + // -------------------------------------------------- @HoverBorder + // --------------------------------------------------------------- + /// + /// Adds background hover capability that will not be lost like CSS:hover when programatically setting background color + /// + /// ** To help combat your element shifting position slightly when a border is applied on hover, + /// it is a good idea to add a border to your element before hand and just set color to 'initial' + /// so that it is transparent, then keep 'addBorder' parameter as false. + /// + /// The element in which this function will be applied + /// + /// + /// + public static void HoverOpacity(this VisualElement target, float startValue, float endValue, int animDuration = 500) + { + target.RegisterCallback(evt => + { + target.AnimateOpacity(startValue, endValue, animDuration); + evt.StopPropagation(); + }); + target.RegisterCallback(evt => + { + target.AnimateOpacity(endValue, startValue, animDuration); + evt.StopPropagation(); + }); + } + // -------------------------------------------------------- @HoverWidth // -- Animate the width of target element to desired value on hover -- // -------------------------------------------------------------------- diff --git a/Runtime/Animations/VisualElementBaseAnimation.cs b/Runtime/Animations/VisualElementBaseAnimation.cs index 4e6fe47..e64c931 100644 --- a/Runtime/Animations/VisualElementBaseAnimation.cs +++ b/Runtime/Animations/VisualElementBaseAnimation.cs @@ -15,7 +15,6 @@ namespace instance.id.EATK public static class VisualElementBaseAnimation { #region Base Animation Extensions - // --------------------------------------- @AnimateBackgroundColor // --------------------------------------------------------------- /// @@ -32,7 +31,7 @@ public static ValueAnimation AnimateBackgroundColor(this VisualElem { if (easing == null) easing = Easy.EaseInOutQuint; return target.experimental.animation - .Start(new StyleValues { backgroundColor = startColor }, new StyleValues { backgroundColor = endColor }, durationMs) + .Start(new StyleValues {backgroundColor = startColor}, new StyleValues {backgroundColor = endColor}, durationMs) .Ease(easing) .OnCompleted(callback); } @@ -56,7 +55,7 @@ public static ValueAnimation AnimateBackgroundColorDelayed(this Vis target.parent.schedule.Execute(() => { anim = target.experimental.animation - .Start(new StyleValues { backgroundColor = startColor }, new StyleValues { backgroundColor = endColor }, durationMs) + .Start(new StyleValues {backgroundColor = startColor}, new StyleValues {backgroundColor = endColor}, durationMs) .Ease(easing) .OnCompleted(callback); }).StartingIn(delayMs); @@ -92,7 +91,7 @@ public static ValueAnimation AnimateBorderColor(this VisualElement { if (easing == null) easing = Easy.EaseInOutQuint; return target.experimental.animation - .Start(new StyleValues { borderColor = startColor }, new StyleValues { borderColor = endColor }, durationMs) + .Start(new StyleValues {borderColor = startColor}, new StyleValues {borderColor = endColor}, durationMs) .Ease(easing) .OnCompleted(callback); } @@ -126,7 +125,7 @@ public static ValueAnimation AnimateColor(this VisualElement target { if (easing == null) easing = Easy.EaseInOutQuint; return target.experimental.animation - .Start(new StyleValues { color = startColor }, new StyleValues { color = endColor }, durationMs) + .Start(new StyleValues {color = startColor}, new StyleValues {color = endColor}, durationMs) .Ease(easing) .OnCompleted(callback); } @@ -160,7 +159,7 @@ public static ValueAnimation AnimateImageTintColor(this VisualEleme { if (easing == null) easing = Easy.EaseInOutQuint; return target.experimental.animation - .Start(new StyleValues { unityBackgroundImageTintColor = startColor }, new StyleValues { unityBackgroundImageTintColor = endColor }, durationMs) + .Start(new StyleValues {unityBackgroundImageTintColor = startColor}, new StyleValues {unityBackgroundImageTintColor = endColor}, durationMs) .Ease(easing) .OnCompleted(callback); } @@ -189,15 +188,21 @@ public static ValueAnimation AnimateImageTintColor(this VisualEleme /// The length of time in which the animation will occur(in milliseconds) /// Function that can be called when the animation is completed /// Controls the animation timing curve mathematically + /// If enabled, animation can trigger from start value regardless of current opacity value public static ValueAnimation AnimateOpacity(this VisualElement target, float startOpacity, float endOpacity, int durationMs, Action callback = null, - Func easing = null) + Func easing = null, bool reanimate = false) { + if (!reanimate) + { + if (target.style.opacity == endOpacity) return null; + } + if (startOpacity == 0) startOpacity = 0.Zero(); if (endOpacity == 0) endOpacity = 0.Zero(); if (easing == null) easing = Easy.EaseInOutQuint; return target.experimental.animation - .Start(new StyleValues { opacity = startOpacity }, new StyleValues { opacity = endOpacity }, durationMs) + .Start(new StyleValues {opacity = startOpacity}, new StyleValues {opacity = endOpacity}, durationMs) .Ease(easing) .OnCompleted(callback); } @@ -224,7 +229,7 @@ public static ValueAnimation AnimateOpacityDelayed(this VisualEleme target.parent.schedule.Execute(() => { anim = target.experimental.animation - .Start(new StyleValues { opacity = startOpacity }, new StyleValues { opacity = endOpacity }, durationMs) + .Start(new StyleValues {opacity = startOpacity}, new StyleValues {opacity = endOpacity}, durationMs) .Ease(easing) .OnCompleted(callback); }).StartingIn(delayMs); @@ -232,6 +237,52 @@ public static ValueAnimation AnimateOpacityDelayed(this VisualEleme return anim; } + // ----------------------------------------------- @AnimateOpacity + // --------------------------------------------------------------- + /// + /// Enable Display of an element and animate it's opacity + /// + /// VisualElement to animate + /// Bool value representing the desired display state of the element + /// The length of time in which the animation will occur(in milliseconds) + /// Function that can be called when the animation is completed + /// Controls the animation timing curve mathematically + public static ValueAnimation AnimateDisplay(this VisualElement target, bool setDisplay, int durationMs, Action callback = null, + Func easing = null) + { + switch (setDisplay) + { + case true when target.GetDisplay(): + case false when !target.GetDisplay(): + return default; + } + + float startOpacity; + float endOpacity; + + if (setDisplay) + { + startOpacity = 0.Zero(); + endOpacity = 1; + target.SetOpacity(startOpacity); + target.SetDisplay(true); + } + else + { + startOpacity = 1; + endOpacity = 0.Zero(); + target.SetOpacity(startOpacity); + if (callback == null) + callback = () => target.SetDisplay(false); + } + + if (easing == null) easing = Easy.EaseInOutQuint; + return target.experimental.animation + .Start(new StyleValues {opacity = startOpacity}, new StyleValues {opacity = endOpacity}, durationMs) + .Ease(easing) + .OnCompleted(callback); + } + // ------------------------------------------------- @AnimateWidth // --------------------------------------------------------------- /// @@ -248,11 +299,27 @@ public static ValueAnimation AnimateWidth(this VisualElement target { if (easing == null) easing = Easy.EaseInOutQuint; return target.experimental.animation - .Start(new StyleValues { width = startWidth }, new StyleValues { width = endWidth }, durationMs) + .Start(new StyleValues {width = startWidth}, new StyleValues {width = endWidth}, durationMs) .Ease(easing) .OnCompleted(callback); } + public static ValueAnimation AnimateWidthDelayed(this VisualElement target, float startWidth, float endWidth, int durationMs, int delayMs, Action callback = null, + Func easing = null) + { + ValueAnimation anim = new ValueAnimation(); + if (easing == null) easing = Easy.EaseInOutQuint; + + target.parent.schedule.Execute(() => + { + anim = target.experimental.animation + .Start(new StyleValues {width = startWidth}, new StyleValues {width = endWidth}, durationMs) + .Ease(easing) + .OnCompleted(callback); + }).StartingIn(delayMs); + return anim; + } + // ------------------------------------------------ @AnimateHeight // --------------------------------------------------------------- /// @@ -269,11 +336,56 @@ public static ValueAnimation AnimateHeight(this VisualElement targe { if (easing == null) easing = Easy.EaseInOutQuint; return target.experimental.animation - .Start(new StyleValues { height = startHeight }, new StyleValues { height = endHeight }, durationMs) + .Start(new StyleValues {height = startHeight}, new StyleValues {height = endHeight}, durationMs) .Ease(easing) .OnCompleted(callback); } + public static ValueAnimation AnimateHeightDelayed(this VisualElement target, float startHeight, float endHeight, int durationMs, int delayMs, Action callback = null, + Func easing = null) + { + ValueAnimation anim = new ValueAnimation(); + if (easing == null) easing = Easy.EaseInOutQuint; + target.parent.schedule.Execute(() => + { + anim = target.experimental.animation + .Start(new StyleValues {height = startHeight}, new StyleValues {height = endHeight}, durationMs) + .Ease(easing) + .OnCompleted(callback); + }).StartingIn(delayMs); + return anim; + } + + /// + /// Animate an arbitrary float value + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static ValueAnimation AnimateValue(this VisualElement target, float startValue, float endValue, int durationMs, Action valueChange = null, Action callback = null, + Func easing = null) + { + if (easing == null) easing = Easy.EaseInOutQuint; + return target.experimental.animation + .Start(startValue, endValue, durationMs, valueChange) + .Ease(easing) + .OnCompleted(callback); + } + + public static ValueAnimation AnimateSlider(this Slider target, float startValue, float endValue, int durationMs, Action valueChange = null, Action callback = null, + Func easing = null) + { + if (easing == null) easing = Easy.EaseInOutQuint; + return target.experimental.animation + .Start(startValue, endValue, durationMs, valueChange) + .Ease(easing) + .OnCompleted(callback); + } #endregion } } diff --git a/Runtime/Elements/AnimatedFoldout/AnimatedFoldout.cs b/Runtime/Elements/AnimatedFoldout/AnimatedFoldout.cs index 6c9411a..84bc375 100644 --- a/Runtime/Elements/AnimatedFoldout/AnimatedFoldout.cs +++ b/Runtime/Elements/AnimatedFoldout/AnimatedFoldout.cs @@ -2,6 +2,7 @@ // -- Project : https://github.com/instance-id/ElementAnimationToolkit -- // -- instance.id 2020 | http://github.com/instance-id | http://instance.id -- // ---------------------------------------------------------------------------- + #if UNITY_EDITOR using System; using instance.id.EATK.Extensions; @@ -21,7 +22,7 @@ public class AnimatedFoldout : BindableElement, INotifyValueChanged public Expander expander; private bool m_Value; private bool isAnimating; - public Action stateChange = () => {}; + public Action stateChange = () => { }; /// /// USS class name of elements of this type. @@ -42,7 +43,18 @@ public class AnimatedFoldout : BindableElement, INotifyValueChanged /// USS class name of expander element in a AnimatedFoldout. /// public static readonly string expanderUssClassName = ussClassName + "__expander"; - + + private string toggleLabelUssClass; + public string ToggleLabelUssClass + { + get => toggleLabelUssClass; + set + { + toggleLabelUssClass = value; + m_Toggle.Query /// The root visual element of the binding object - public void ActivateOnStart(VisualElement rootElement) => + public void ActivateOnStart(VisualElement rootElement) => rootElement.RegisterCallback(evt => DoActivationOnStart(evt, rootElement)); // -- Callback will call this once the editor is ready, but just before displaying, so there is no visual "pop" @@ -157,9 +186,7 @@ private void OnAttachToPanel(AttachToPanelEvent evt) /// /// Instantiates an AnimatedFoldout using the data read from a UXML file. /// - public new class UxmlFactory : UxmlFactory - { - } + public new class UxmlFactory : UxmlFactory { } public new class UxmlTraits : BindableElement.UxmlTraits { diff --git a/Runtime/Elements/AnimatedFoldout/UIElementExpander.cs b/Runtime/Elements/AnimatedFoldout/UIElementExpander.cs index 00ed314..91c69bb 100644 --- a/Runtime/Elements/AnimatedFoldout/UIElementExpander.cs +++ b/Runtime/Elements/AnimatedFoldout/UIElementExpander.cs @@ -86,12 +86,7 @@ public void AddToExpansionGroup(VisualElement element) { expandContainerItems.Add(element); } - - public void TriggerExpanderResize(ChangeEvent eventValue) - { - ExpandContainerValueChanges(eventValue); - } - + /// /// Trigger the expansion container to resize. Needed when child elements change size. /// @@ -100,6 +95,11 @@ public void TriggerExpanderResize(bool eventValue = true) { ExpandContainerValueChanges(eventValue); } + + public void TriggerExpanderResize(ChangeEvent eventValue) + { + ExpandContainerValueChanges(eventValue); + } /// /// Manually trigger the OnGeometryChangedEvent event. diff --git a/Runtime/Enhancements/FastLinq.meta b/Runtime/Enhancements/FastLinq.meta new file mode 100644 index 0000000..644bbad --- /dev/null +++ b/Runtime/Enhancements/FastLinq.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c612ede63d54f3ad1a165a6e79184c6f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enhancements/FastLinq/FastLinq.asmdef b/Runtime/Enhancements/FastLinq/FastLinq.asmdef new file mode 100644 index 0000000..db1e413 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/FastLinq.asmdef @@ -0,0 +1,3 @@ +{ + "name": "FastLinq" +} diff --git a/Runtime/Enhancements/FastLinq/FastLinq.asmdef.meta b/Runtime/Enhancements/FastLinq/FastLinq.asmdef.meta new file mode 100644 index 0000000..211f5e0 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/FastLinq.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0d5f5efb257a4ba8381131a24e714869 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enhancements/FastLinq/ImprovedAggregate.cs b/Runtime/Enhancements/FastLinq/ImprovedAggregate.cs new file mode 100644 index 0000000..6b7705c --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedAggregate.cs @@ -0,0 +1,153 @@ +using System; +using System.Collections.Generic; + +namespace FastLinq +{ + public static partial class ImprovedLinq + { + public static TResult Aggregate( + this TSource[] source, + TAccumulate seed, + Func func, + Func resultSelector) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (func == null) throw new ArgumentNullException(nameof(func)); + if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); + TAccumulate result = seed; + foreach (var element in source) + { + result = func(result, element); + } + + return resultSelector(result); + } + + public static TAccumulate Aggregate( + this TSource[] source, + TAccumulate seed, + Func func) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (func == null) throw new ArgumentNullException(nameof(func)); + TAccumulate result = seed; + foreach (var element in source) + { + result = func(result, element); + } + + return result; + } + + public static TSource Aggregate(this TSource[] source, Func func) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (func == null) throw new ArgumentNullException(nameof(func)); + TSource result = default; + foreach (var element in source) + { + result = func(result, element); + } + + return result; + } + + public static TResult Aggregate( + this List source, + TAccumulate seed, + Func func, + Func resultSelector) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (func == null) throw new ArgumentNullException(nameof(func)); + if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); + TAccumulate result = seed; + foreach (var element in source) + { + result = func(result, element); + } + + return resultSelector(result); + } + + public static TAccumulate Aggregate( + this List source, + TAccumulate seed, + Func func) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (func == null) throw new ArgumentNullException(nameof(func)); + TAccumulate result = seed; + foreach (var element in source) + { + result = func(result, element); + } + + return result; + } + + public static TSource Aggregate( + this List source, + Func func) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (func == null) throw new ArgumentNullException(nameof(func)); + TSource result = default; + foreach (var element in source) + { + result = func(result, element); + } + + return result; + } + + public static TResult Aggregate( + this Dictionary source, + TAccumulate seed, + Func, TAccumulate> func, + Func resultSelector) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (func == null) throw new ArgumentNullException(nameof(func)); + if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); + TAccumulate result = seed; + foreach (var element in source) + { + result = func(result, element); + } + + return resultSelector(result); + } + + public static TAccumulate Aggregate( + this Dictionary source, + TAccumulate seed, + Func, TAccumulate> func) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (func == null) throw new ArgumentNullException(nameof(func)); + TAccumulate result = seed; + foreach (var element in source) + { + result = func(result, element); + } + + return result; + } + + public static KeyValuePair Aggregate( + this Dictionary source, + Func, KeyValuePair, KeyValuePair> func) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (func == null) throw new ArgumentNullException(nameof(func)); + KeyValuePair result = default; + foreach (var element in source) + { + result = func(result, element); + } + + return result; + } + } +} diff --git a/Runtime/Enhancements/FastLinq/ImprovedAggregate.cs.meta b/Runtime/Enhancements/FastLinq/ImprovedAggregate.cs.meta new file mode 100644 index 0000000..0de8957 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedAggregate.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 26b0e896d5acfb942a60ed48717e4c65 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enhancements/FastLinq/ImprovedAll.cs b/Runtime/Enhancements/FastLinq/ImprovedAll.cs new file mode 100644 index 0000000..cdf18e2 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedAll.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; + +namespace FastLinq +{ + public static partial class ImprovedLinq + { + public static bool All( + this TSource[] source, + Func predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + foreach (var element in source) + { + if (!predicate(element)) + { + return false; + } + } + + return true; + } + + public static bool All( + this List source, + Func predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + foreach (var element in source) + { + if (!predicate(element)) + { + return false; + } + } + + return true; + } + + public static bool All( + this Dictionary source, + Func, bool> predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + foreach (var element in source) + { + if (!predicate(element)) + { + return false; + } + } + + return true; + } + } +} diff --git a/Runtime/Enhancements/FastLinq/ImprovedAll.cs.meta b/Runtime/Enhancements/FastLinq/ImprovedAll.cs.meta new file mode 100644 index 0000000..235766e --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedAll.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1911a053ed91a31649e802033f40a032 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enhancements/FastLinq/ImprovedAny.cs b/Runtime/Enhancements/FastLinq/ImprovedAny.cs new file mode 100644 index 0000000..0718fde --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedAny.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; + +namespace FastLinq +{ + public static partial class ImprovedLinq + { + public static bool Any(this TSource[] source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Length > 0) + { + return true; + } + + return false; + } + + public static bool Any(this List source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Count > 0) + { + return true; + } + + return false; + } + + public static bool Any(this Dictionary source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Count > 0) + { + return true; + } + + return false; + } + + public static bool Any( + this TSource[] source, + Func predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + foreach (var element in source) + { + if (predicate(element)) + { + return true; + } + } + + return false; + } + + public static bool Any( + this List source, + Func predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + foreach (var element in source) + { + if (predicate(element)) + { + return true; + } + } + + return false; + } + + public static bool Any( + this Dictionary source, + Func, bool> predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + foreach (var element in source) + { + if (predicate(element)) + { + return true; + } + } + + return false; + } + } +} diff --git a/Runtime/Enhancements/FastLinq/ImprovedAny.cs.meta b/Runtime/Enhancements/FastLinq/ImprovedAny.cs.meta new file mode 100644 index 0000000..74cff7f --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedAny.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eef0d8eb5cd65e9249768f9a9c2757fa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enhancements/FastLinq/ImprovedContains.cs b/Runtime/Enhancements/FastLinq/ImprovedContains.cs new file mode 100644 index 0000000..fe419f9 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedContains.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; + +namespace FastLinq +{ +// NOTE +// Contains(this IEnumerable source, TSource value); +// この場合は、内部的にはICollectionであるかを判定して、該当する場合はICollection.Containsを呼び出す +// Arrayクラスの場合は、ICollection.Containsの実装でTrySZIndexOfを使っており、プリミティブタイプに最適化されたnative method呼び出しでかなり速い +// C#レイヤーでforeachの最適化でゴニョるより、素直に呼び出す方が速いので、ここではIEqualityComparerを指定する場合のみの最適化を行なっている + public static partial class ImprovedLinq + { + public static bool Contains( + this TSource[] source, + TSource value, + IEqualityComparer comparer) + { + if (comparer == null) comparer = EqualityComparer.Default; + if (source == null) throw new ArgumentNullException(nameof(source)); + foreach (var element in source) + { + if (comparer.Equals(element, value)) + { + return true; + } + } + + return false; + } + + public static bool Contains( + this List source, + TSource value, + IEqualityComparer comparer) + { + if (comparer == null) comparer = EqualityComparer.Default; + if (source == null) throw new ArgumentNullException(nameof(source)); + foreach (var element in source) + { + if (comparer.Equals(element, value)) + { + return true; + } + } + + return false; + } + + public static bool Contains( + this Dictionary source, + KeyValuePair value, + IEqualityComparer> comparer) + { + if (comparer == null) comparer = EqualityComparer>.Default; + if (source == null) throw new ArgumentNullException(nameof(source)); + foreach (var pair in source) + { + if (comparer.Equals(pair, value)) + { + return true; + } + } + + return false; + } + } +} diff --git a/Runtime/Enhancements/FastLinq/ImprovedContains.cs.meta b/Runtime/Enhancements/FastLinq/ImprovedContains.cs.meta new file mode 100644 index 0000000..c2b1625 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedContains.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6b3280f4825e258f69309cc87c1b44df +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enhancements/FastLinq/ImprovedCount.cs b/Runtime/Enhancements/FastLinq/ImprovedCount.cs new file mode 100644 index 0000000..7f1ab7d --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedCount.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; + +namespace FastLinq +{ + public static partial class ImprovedLinq + { + public static int Count(this TSource[] source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + return source.Length; + } + + public static int Count( + this TSource[] source, + Func predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + int count = 0; + foreach (var element in source) + { + if (predicate(element)) + { + count++; + } + } + + return count; + } + + public static int Count(this List source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + return source.Count; + } + + public static int Count( + this List source, + Func predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + int count = 0; + foreach (var element in source) + { + if (predicate(element)) + { + count++; + } + } + + return count; + } + + public static int Count(this Dictionary source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + return source.Count; + } + + public static int Count(this Dictionary source, + Func, bool> predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + int count = 0; + foreach (var pair in source) + { + if (predicate(pair)) + { + count++; + } + } + + return count; + } + } +} diff --git a/Runtime/Enhancements/FastLinq/ImprovedCount.cs.meta b/Runtime/Enhancements/FastLinq/ImprovedCount.cs.meta new file mode 100644 index 0000000..bfa5d81 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedCount.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 93980cd885cf7bb0ca9ff634fe5fed7e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enhancements/FastLinq/ImprovedFirst.cs b/Runtime/Enhancements/FastLinq/ImprovedFirst.cs new file mode 100644 index 0000000..92c2a21 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedFirst.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; + +namespace FastLinq +{ + public static partial class ImprovedLinq + { + public static T First(this T[] source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Length == 0) throw new InvalidOperationException(); + return source[0]; + } + + public static T First(this T[] source, Func predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + foreach (var element in source) + { + if (predicate(element)) + { + return element; + } + } + + throw new InvalidOperationException(); + } + + public static T First(this List source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Count == 0) throw new InvalidOperationException(); + return source[0]; + } + + public static T First(this List source, Func predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + foreach (var element in source) + { + if (predicate(element)) + { + return element; + } + } + + throw new InvalidOperationException(); + } + + public static KeyValuePair First(this Dictionary source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + foreach (var elem in source) + { + return elem; + } + + throw new InvalidOperationException(); + } + + public static KeyValuePair First(this Dictionary source, + Func, bool> predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + foreach (var element in source) + { + if (predicate(element)) + { + return element; + } + } + + throw new InvalidOperationException(); + } + } +} diff --git a/Runtime/Enhancements/FastLinq/ImprovedFirst.cs.meta b/Runtime/Enhancements/FastLinq/ImprovedFirst.cs.meta new file mode 100644 index 0000000..0e1af74 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedFirst.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a9f19e6407a0ca7ffba68c3c9a3c690b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enhancements/FastLinq/ImprovedFirstOrDefault.cs b/Runtime/Enhancements/FastLinq/ImprovedFirstOrDefault.cs new file mode 100644 index 0000000..8775444 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedFirstOrDefault.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; + +namespace FastLinq +{ + public static partial class ImprovedLinq + { + public static TSource FirstOrDefault(this TSource[] source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Length == 0) return default; + return source[0]; + } + + public static TSource FirstOrDefault(this List source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Count == 0) return default; + return source[0]; + } + + public static KeyValuePair FirstOrDefault(this Dictionary source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Count == 0) return default; + using (var enumerator = source.GetEnumerator()) + { + if (enumerator.MoveNext()) + { + return enumerator.Current; + } + } + return default; + } + + public static TSource FirstOrDefault(this TSource[] source, Func predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + foreach (TSource element in source) + { + if (predicate(element)) return element; + } + + return default; + } + + public static TSource FirstOrDefault(this List source, Func predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + foreach (TSource element in source) + { + if (predicate(element)) return element; + } + + return default; + } + + public static KeyValuePair FirstOrDefault(this Dictionary source, + Func, bool> predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + foreach (var pair in source) + { + if (predicate(pair)) return pair; + } + + return default; + } + } +} diff --git a/Runtime/Enhancements/FastLinq/ImprovedFirstOrDefault.cs.meta b/Runtime/Enhancements/FastLinq/ImprovedFirstOrDefault.cs.meta new file mode 100644 index 0000000..6da62cb --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedFirstOrDefault.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a482f53fca8eb4c90899e5855c1dc408 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enhancements/FastLinq/ImprovedLast.cs b/Runtime/Enhancements/FastLinq/ImprovedLast.cs new file mode 100644 index 0000000..daa8e41 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedLast.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; + +namespace FastLinq +{ + public static partial class ImprovedLinq + { + public static T Last(this T[] source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Length == 0) throw new InvalidOperationException(); + return source[source.Length - 1]; + } + + public static T Last(this T[] source, Func predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + for (var i = source.Length - 1; i >= 0; i--) + { + if (predicate(source[i])) + { + return source[i]; + } + } + + throw new InvalidOperationException(); + } + + public static T Last(this List source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Count == 0) throw new InvalidOperationException(); + return source[source.Count - 1]; + } + + public static T Last(this List source, Func predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + for (var i = source.Count - 1; i >= 0; i--) + { + if (predicate(source[i])) + { + return source[i]; + } + } + + throw new InvalidOperationException(); + } + + public static KeyValuePair Last(this Dictionary source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Count == 0) throw new InvalidOperationException(); + using (var e = source.GetEnumerator()) + { + if (e.MoveNext()) + { + KeyValuePair result; + do + { + result = e.Current; + } while (e.MoveNext()); + + return result; + } + } + + throw new InvalidOperationException(); + } + + public static KeyValuePair Last( + this Dictionary source, + Func, bool> predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Count == 0) throw new InvalidOperationException(); + bool found = false; + KeyValuePair result = default; + using (var e = source.GetEnumerator()) + { + if (e.MoveNext()) + { + do + { + if (predicate(e.Current)) + { + result = e.Current; + found = true; + } + } while (e.MoveNext()); + + } + } + + if (found) + { + return result; + } + + throw new InvalidOperationException(); + } + } +} diff --git a/Runtime/Enhancements/FastLinq/ImprovedLast.cs.meta b/Runtime/Enhancements/FastLinq/ImprovedLast.cs.meta new file mode 100644 index 0000000..5aabca8 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedLast.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6bae1597c1b28db74b5247119aef3951 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enhancements/FastLinq/ImprovedLastOrDefault.cs b/Runtime/Enhancements/FastLinq/ImprovedLastOrDefault.cs new file mode 100644 index 0000000..10cdb47 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedLastOrDefault.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; + +namespace FastLinq +{ + public static partial class ImprovedLinq + { + public static T LastOrDefault(this T[] source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Length == 0) return default; + return source[source.Length - 1]; + } + + public static T LastOrDefault(this T[] source, Func predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + for (var i = source.Length - 1; i >= 0; i--) + { + if (predicate(source[i])) + { + return source[i]; + } + } + + return default; + } + + public static T LastOrDefault(this List source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Count == 0) return default; + return source[source.Count - 1]; + } + + public static T LastOrDefault(this List source, Func predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (predicate == null) throw new ArgumentNullException(nameof(predicate)); + for (var i = source.Count - 1; i >= 0; i--) + { + if (predicate(source[i])) + { + return source[i]; + } + } + + return default; + } + + public static KeyValuePair LastOrDefault(this Dictionary source) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Count == 0) return default; + using (var e = source.GetEnumerator()) + { + if (e.MoveNext()) + { + KeyValuePair result; + do + { + result = e.Current; + } while (e.MoveNext()); + + return result; + } + } + + return default; + } + + public static KeyValuePair LastOrDefault( + this Dictionary source, + Func, bool> predicate) + { + if (source == null) throw new ArgumentNullException(nameof(source)); + if (source.Count == 0) return default; + bool found = false; + KeyValuePair result = default; + using (var e = source.GetEnumerator()) + { + if (e.MoveNext()) + { + do + { + if (predicate(e.Current)) + { + result = e.Current; + found = true; + } + } while (e.MoveNext()); + + } + } + + if (found) + { + return result; + } + + return default; + } + } +} diff --git a/Runtime/Enhancements/FastLinq/ImprovedLastOrDefault.cs.meta b/Runtime/Enhancements/FastLinq/ImprovedLastOrDefault.cs.meta new file mode 100644 index 0000000..aa353f7 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedLastOrDefault.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7f2a163ec45fb59569424b9efb9e8536 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enhancements/FastLinq/ImprovedSequenceEqual.cs b/Runtime/Enhancements/FastLinq/ImprovedSequenceEqual.cs new file mode 100644 index 0000000..1fa0330 --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedSequenceEqual.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; + +namespace FastLinq +{ + public static partial class ImprovedLinq + { + public static bool SequenceEqual( + this TSource[] first, + TSource[] second) + { + if (first == null) throw new ArgumentNullException(nameof(first)); + if (second == null) throw new ArgumentNullException(nameof(second)); + if (first.Length != second.Length) return false; + return SequenceEqual(first, second, null); + } + + public static bool SequenceEqual( + this TSource[] first, + TSource[] second, + IEqualityComparer comparer) + { + if (comparer == null) comparer = EqualityComparer.Default; + if (first == null) throw new ArgumentNullException(nameof(first)); + if (second == null) throw new ArgumentNullException(nameof(second)); + if (first.Length != second.Length) return false; + var length = first.Length; + for (var i = 0; i < length; i++) + { + if (!comparer.Equals(first[i], second[i])) + { + return false; + } + } + + return true; + } + + public static bool SequenceEqual( + this List first, + List second) + { + if (first == null) throw new ArgumentNullException(nameof(first)); + if (second == null) throw new ArgumentNullException(nameof(second)); + if (first.Count != second.Count) return false; + return SequenceEqual(first, second, null); + } + + public static bool SequenceEqual( + this List first, + List second, + IEqualityComparer comparer) + { + if (comparer == null) comparer = EqualityComparer.Default; + if (first == null) throw new ArgumentNullException(nameof(first)); + if (second == null) throw new ArgumentNullException(nameof(second)); + if (first.Count != second.Count) return false; + var length = first.Count; + for (var i = 0; i < length; i++) + { + if (!comparer.Equals(first[i], second[i])) + { + return false; + } + } + + return true; + } + } +} diff --git a/Runtime/Enhancements/FastLinq/ImprovedSequenceEqual.cs.meta b/Runtime/Enhancements/FastLinq/ImprovedSequenceEqual.cs.meta new file mode 100644 index 0000000..a6dc49e --- /dev/null +++ b/Runtime/Enhancements/FastLinq/ImprovedSequenceEqual.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 70a9772048a4036ddb83a800655031b8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/Extensions/AssetFileExtensions.cs b/Runtime/Scripts/Extensions/AssetFileExtensions.cs index eb80d54..b5c77be 100644 --- a/Runtime/Scripts/Extensions/AssetFileExtensions.cs +++ b/Runtime/Scripts/Extensions/AssetFileExtensions.cs @@ -327,7 +327,7 @@ Type GetIncomingType() // ------------------------------------------------------- // -- Dynamically added context menus per element -------- - additionalMenus?.ForEach(x => // @formatter:off + additionalMenus?.forEach(x => // @formatter:off { evt.menu.AppendAction(x.Key, CallActionMenu, a => DropdownMenuAction.Status.Normal, x.Value); diff --git a/Runtime/Scripts/Extensions/CollectionExtensions.cs b/Runtime/Scripts/Extensions/CollectionExtensions.cs index e47b179..b6230a1 100644 --- a/Runtime/Scripts/Extensions/CollectionExtensions.cs +++ b/Runtime/Scripts/Extensions/CollectionExtensions.cs @@ -30,7 +30,7 @@ public static T GetOrAdd(this Dictionary dictionary, TKey key, return result; } - public static bool TryAddValue(this IDictionary dictionary, TKey key, TValue value) + public static bool TryAdd(this IDictionary dictionary, TKey key, TValue value) { if (!dictionary.ContainsKey(key)) { @@ -41,7 +41,7 @@ public static bool TryAddValue(this IDictionary dict return false; } - public static bool TryAddValue(this Dictionary dictionary, TKey key, TValue value) + public static bool TryAdd(this Dictionary dictionary, TKey key, TValue value) { if (!dictionary.ContainsKey(key)) { @@ -56,7 +56,7 @@ public static void TryAddRange(this Dictionary dicti { foreach (var k in keys) { - dictionary.TryAddValue(k, value); + dictionary.TryAdd(k, value); } } @@ -146,7 +146,7 @@ public static int GetKeyWidth(this Dictionary dictio #region List - public static bool TryAddValue(this List list, TValue value) + public static bool TryAdd(this List list, TValue value) { if (list.Contains(value)) return false; list.Add(value); @@ -198,7 +198,7 @@ public static IEnumerable ForEachR(this List source, Action action, return forEach; } - public static void ForEach(this IEnumerable ie, Action action) + public static void forEach(this IEnumerable ie, Action action) { foreach (var i in ie) { diff --git a/Runtime/Scripts/Extensions/Color.meta b/Runtime/Scripts/Extensions/Color.meta new file mode 100644 index 0000000..e15aed3 --- /dev/null +++ b/Runtime/Scripts/Extensions/Color.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2ceacb1b4d8449408e97e1c52b70711f +timeCreated: 1649209399 \ No newline at end of file diff --git a/Runtime/Scripts/Extensions/Color/ColorExtensions.cs b/Runtime/Scripts/Extensions/Color/ColorExtensions.cs new file mode 100644 index 0000000..daaa9c1 --- /dev/null +++ b/Runtime/Scripts/Extensions/Color/ColorExtensions.cs @@ -0,0 +1,307 @@ +using UnityEngine; +using System; +using Random = UnityEngine.Random; + +namespace instance.id.EATK.Extensions +{ + public static class DistinctColors + { + public static Color Red = new Color(230, 25, 75); + public static Color Green = new Color(60, 180, 75); + public static Color Yellow = new Color(255, 225, 25); + public static Color Blue = new Color(0, 130, 200); + public static Color Orange = new Color(245, 130, 48); + public static Color Purple = new Color(145, 30, 180); + public static Color Cyan = new Color(70, 240, 240); + public static Color Magenta = new Color(240, 50, 230); + public static Color Lime = new Color(210, 245, 60); + public static Color Pink = new Color(250, 190, 190); + public static Color Teal = new Color(0, 128, 128); + public static Color Lavender = new Color(230, 190, 255); + public static Color Brown = new Color(170, 110, 40); + public static Color Beige = new Color(255, 250, 200); + public static Color Maroon = new Color(128, 0, 0); + public static Color Mint = new Color(170, 255, 195); + public static Color Olive = new Color(128, 128, 0); + public static Color Coral = new Color(255, 215, 180); + public static Color Navy = new Color(0, 0, 128); + public static Color Grey = new Color(128, 128, 128); + public static Color White = new Color(255, 255, 255); + public static Color Black = new Color(0, 0, 0); + } + + public static class ColorHelper + { + public static Color GetRandomColor() + { + var bright = RandomBrightColor(); + return bright.ToRGBA(); + } + + public static string ToHex(this Color32 color) + { + string hex = color.r.ToString("X2") + color.g.ToString("X2") + color.b.ToString("X2"); + return hex; + } + + public enum ColorType + { + Bright, + Pastel, + Dark + } + + public static HSLColor RandomBrightColor() + { + HSLColor randomColor = new HSLColor(); + randomColor.h = Random.Range(0, 360); + randomColor.s = Random.Range(0.7f, 1f); + randomColor.l = Random.Range(0.45f, 0.6f); + randomColor.a = 1; + return randomColor; + } + + public static HSLColor RandomPastelColor() + { + HSLColor randomColor = new HSLColor(); + randomColor.h = Random.Range(0, 360); + randomColor.s = Random.Range(0.3f, 0.4f); + randomColor.l = Random.Range(0.45f, 0.6f); + randomColor.a = 1; + + return randomColor; + } + + public static HSLColor RandomDarkColor() + { + HSLColor randomColor = new HSLColor(); + randomColor.h = Random.Range(0, 360); + randomColor.s = 0.8f; + randomColor.l = 0.1f; + randomColor.a = 1; + + return randomColor; + } + + // private static float Random.Range(float min, float max) + // { + // return min + ((float) System.Random.NextDouble() * (max - min)); + // } + + public static bool IsBlack(this Color32 color) + { + if (color.r == 0 && color.g == 0 && color.b == 0) + { + return true; + } + + return false; + } + + public const float ColorOffset = 40; + + public static Color[] GetGradients(int darkness) + { + Color[] colorGradient = new Color[2]; + var newColor = RandomBrightColor(); + bool increase = newColor.h < 100; + if (increase) + { + newColor.h += ColorOffset; + } + else + { + newColor.h -= ColorOffset; + } + + if (darkness == 2) + { + newColor.l -= 0.35f; + newColor.s -= 0.2f; + } + + if (darkness == 3) + { + if (increase) + { + newColor.h -= ColorOffset * 2; + } + else + { + newColor.h += ColorOffset * 2; + } + + newColor.l -= 0.5f; + newColor.s -= 0.4f; + } + + HSLColor complimentColor = newColor; + if (newColor.h < 30 && darkness != 2) + { + complimentColor.h += ColorOffset * 0.5f; + } + else + { + complimentColor.h -= ColorOffset * 0.5f; + } + + complimentColor.s += Random.Range(-0.15f, 0.15f); + colorGradient[0] = complimentColor; + colorGradient[1] = newColor; + return colorGradient; + } + } + + + public struct HSLColor + { + public float h; + public float s; + public float l; + public float a; + + + public HSLColor(float h, float s, float l, float a) + { + this.h = h; + this.s = s; + this.l = l; + this.a = a; + } + + public HSLColor(float h, float s, float l) + { + this.h = h; + this.s = s; + this.l = l; + this.a = 1f; + } + + public HSLColor(Color c) + { + HSLColor temp = FromRGBA(c); + h = temp.h; + s = temp.s; + l = temp.l; + a = temp.a; + } + + public static HSLColor FromRGBA(Color c) + { + float h, s, l, a; + a = c.a; + + float cmin = MathEx.Min(MathEx.Min(c.r, c.g), c.b); + float cmax = MathEx.Max(MathEx.Max(c.r, c.g), c.b); + + l = (cmin + cmax) / 2f; + + if (cmin == cmax) + { + s = 0; + h = 0; + } + else + { + float delta = cmax - cmin; + + s = (l <= .5f) ? (delta / (cmax + cmin)) : (delta / (2f - (cmax + cmin))); + + h = 0; + + if (c.r == cmax) + { + h = (c.g - c.b) / delta; + } + else if (c.g == cmax) + { + h = 2f + (c.b - c.r) / delta; + } + else if (c.b == cmax) + { + h = 4f + (c.r - c.g) / delta; + } + + h = Mathf.Repeat(h * 60f, 360f); + } + + return new HSLColor(h, s, l, a); + } + + + public Color ToRGBA() + { + float r, g, b, a; + a = this.a; + float m1, m2; + m2 = (l <= .5f) ? (l * (1f + s)) : (l + s - l * s); + m1 = 2f * l - m2; + if (s == 0f) + { + r = g = b = l; + } + else + { + r = Value(m1, m2, h + 120f); + g = Value(m1, m2, h); + b = Value(m1, m2, h - 120f); + } + + return new Color(r, g, b, a); + } + + static float Value(float n1, float n2, float hue) + { + hue = Mathf.Repeat(hue, 360f); + + if (hue < 60f) + { + return n1 + (n2 - n1) * hue / 60f; + } + + if (hue < 180f) + { + return n2; + } + + if (hue < 240f) + { + return n1 + (n2 - n1) * (240f - hue) / 60f; + } + + return n1; + } + + public static implicit operator HSLColor(Color src) + { + return FromRGBA(src); + } + + public static implicit operator Color(HSLColor src) + { + return src.ToRGBA(); + } + + public override string ToString() + { + return string.Format("H: {0} S: {1} L: {2} A: {3}", h, s, l, a); + } + + public static uint ToUint(HSLColor hsl) + { + int num1 = (int) Math.Round(hsl.h * 360.0); + int num2 = (int) Math.Round(hsl.s * 100.0 + 100.0); + int num3 = (int) Math.Round(hsl.l * 100.0 + 100.0); + int num4 = num2 << 16; + int num5 = num3 << 24; + return (uint) (num1 | num4 | num5); + } + + public static HSLColor FromUint(uint packed) + { + return new HSLColor((float) (ushort) packed / 360f, + (float) ((int) (byte) (packed >> 16) - 100) / 100f, + (float) ((int) (byte) (packed >> 24) - 100) / 100f); + } + } +} diff --git a/Runtime/Scripts/Extensions/Color/ColorExtensions.cs.meta b/Runtime/Scripts/Extensions/Color/ColorExtensions.cs.meta new file mode 100644 index 0000000..7a2858d --- /dev/null +++ b/Runtime/Scripts/Extensions/Color/ColorExtensions.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0efa1d13cb18483c968b0b0e040df107 +timeCreated: 1649209399 \ No newline at end of file diff --git a/Runtime/Scripts/Extensions/Color/ColorTool.cs b/Runtime/Scripts/Extensions/Color/ColorTool.cs new file mode 100644 index 0000000..29d5c7f --- /dev/null +++ b/Runtime/Scripts/Extensions/Color/ColorTool.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Reflection; +using UnityEngine; + +namespace instance.id.EATK.Extensions +{ + public static class ColorTool + { + public static Dictionary KnownColors { get; private set; } + + static ColorTool() => Init(); + + /// + /// Initialize the list of known colors so that we don't have to use reflection all the time. + /// + public static void Init() + { + Type t = typeof(Color); + Type c = typeof(Colors); + + KnownColors = new Dictionary(); + + /* Find all public static properties and attempt to get a color out of them */ + foreach (PropertyInfo prop in t.GetProperties(BindingFlags.Public | BindingFlags.Static)) + { + /* Make sure the property can return a color type */ + if (prop.PropertyType == t) + { + string name = prop.Name.ToLowerInvariant(); + Color color = (Color) prop.GetValue(null, null); + KnownColors.Add(name, color); + } + } + + var type = typeof(Colors); + var fields = type.GetFields().ToDictionary(f => f.Name, f => (Color) f.GetValue(f)); + + foreach (var color in fields) KnownColors.Add(color.Key, color.Value); + } + /// + /// Allows you to convert either a known name or hexidecimal representation into a potential color object. + /// + /// + /// + public static Color ReadColor(string colorString) + { + colorString = colorString.ToLowerInvariant(); + + if (KnownColors.ContainsKey(colorString)) return KnownColors[colorString]; + + else if (colorString.Contains("#")) + { + int r, g, b, a = 0; + var style = NumberStyles.HexNumber; + + colorString = colorString.Replace("#", ""); + + switch (colorString.Length) + { + case 3: + /* rgb */ + r = int.Parse(colorString.Substring(0, 1) + colorString.Substring(0, 1), style); + g = int.Parse(colorString.Substring(1, 1) + colorString.Substring(1, 1), style); + b = int.Parse(colorString.Substring(2, 1) + colorString.Substring(2, 1), style); + return new Color(r, g, b); + case 4: + /* rgba */ + r = int.Parse(colorString.Substring(0, 1) + colorString.Substring(0, 1), style); + g = int.Parse(colorString.Substring(1, 1) + colorString.Substring(1, 1), style); + b = int.Parse(colorString.Substring(2, 1) + colorString.Substring(2, 1), style); + a = int.Parse(colorString.Substring(3, 1) + colorString.Substring(2, 1), style); + return new Color(r, g, b, a); + case 6: + /* rrggbb */ + r = int.Parse(colorString.Substring(0, 2), style); + g = int.Parse(colorString.Substring(2, 2), style); + b = int.Parse(colorString.Substring(4, 2), style); + return new Color(r, g, b); + case 8: + /* rrggbbaa */ + r = int.Parse(colorString.Substring(0, 2), style); + g = int.Parse(colorString.Substring(2, 2), style); + b = int.Parse(colorString.Substring(4, 2), style); + a = int.Parse(colorString.Substring(6, 2), style); + return new Color(r, g, b, a); + default: + throw new ArgumentException("Invalid hex string."); + } + } + + throw new ArgumentException("Invalid color string."); + } + + /// + /// Lua does not support overloads, so this utility class provides a special global function rgb(). + /// + public static Color ReadRGB(byte r, byte g, byte b) + { + return new Color(r, g, b); + } + + + /// + /// Lua does not support overloads, so this utility class provides a special global function rgba(). + /// + public static Color ReadRGBA(byte r, byte g, byte b, byte alpha) + { + return new Color(r, g, b, alpha); + } + } +} diff --git a/Runtime/Scripts/Extensions/Color/ColorTool.cs.meta b/Runtime/Scripts/Extensions/Color/ColorTool.cs.meta new file mode 100644 index 0000000..02b76fe --- /dev/null +++ b/Runtime/Scripts/Extensions/Color/ColorTool.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f582b502a340496a8e484875f123dab0 +timeCreated: 1649209399 \ No newline at end of file diff --git a/Runtime/Scripts/Extensions/Color/Colors.cs b/Runtime/Scripts/Extensions/Color/Colors.cs new file mode 100644 index 0000000..f240642 --- /dev/null +++ b/Runtime/Scripts/Extensions/Color/Colors.cs @@ -0,0 +1,1345 @@ +using UnityEngine; + +// -- https://gist.github.com/louisvalet/d37f3bc259a43bfbfecec7dd5e376354 +namespace instance.id.EATK.Extensions +{ +#pragma warning disable CS3003 + public static class Colors + { + public static readonly Color AbsoluteZero = new Color32(0, 72, 186, 255); + public static readonly Color Acajou = new Color32(76, 47, 39, 255); + public static readonly Color AcidGreen = new Color32(176, 191, 26, 255); + public static readonly Color Aero = new Color32(124, 185, 232, 255); + public static readonly Color AeroBlue = new Color32(201, 255, 229, 255); + public static readonly Color AfricanViolet = new Color32(178, 132, 190, 255); + public static readonly Color AirForceBlueRAF = new Color32(93, 138, 168, 255); + public static readonly Color AirForceBlueUSAF = new Color32(0, 48, 143, 255); + public static readonly Color AirSuperiorityBlue = new Color32(114, 160, 193, 255); + public static readonly Color AlabamaCrimson = new Color32(175, 48, 42, 255); + public static readonly Color Alabaster = new Color32(242, 240, 230, 255); + public static readonly Color AliceBlue = new Color32(240, 248, 255, 255); + public static readonly Color AlienArmpit = new Color32(132, 222, 2, 255); + public static readonly Color AlizarinCrimson = new Color32(227, 38, 54, 255); + public static readonly Color AlloyOrange = new Color32(196, 98, 16, 255); + public static readonly Color Almond = new Color32(239, 222, 205, 255); + public static readonly Color Amaranth = new Color32(229, 43, 80, 255); + public static readonly Color AmaranthDeepPurple = new Color32(159, 43, 104, 255); + public static readonly Color AmaranthPink = new Color32(241, 156, 187, 255); + public static readonly Color AmaranthPurple = new Color32(171, 39, 79, 255); + public static readonly Color AmaranthRed = new Color32(211, 33, 45, 255); + public static readonly Color Amazon = new Color32(59, 122, 87, 255); + public static readonly Color Amazonite = new Color32(0, 196, 176, 255); + public static readonly Color Amber = new Color32(255, 191, 0, 255); + public static readonly Color AmberSAEECE = new Color32(255, 126, 0, 255); + public static readonly Color AmericanBlue = new Color32(59, 59, 109, 255); + public static readonly Color AmericanBrown = new Color32(128, 64, 64, 255); + public static readonly Color AmericanGold = new Color32(211, 175, 55, 255); + public static readonly Color AmericanGreen = new Color32(52, 179, 52, 255); + public static readonly Color AmericanOrange = new Color32(255, 139, 0, 255); + public static readonly Color AmericanPink = new Color32(255, 152, 153, 255); + public static readonly Color AmericanPurple = new Color32(67, 28, 83, 255); + public static readonly Color AmericanRed = new Color32(179, 33, 52, 255); + public static readonly Color AmericanRose = new Color32(255, 3, 62, 255); + public static readonly Color AmericanSilver = new Color32(207, 207, 207, 255); + public static readonly Color AmericanViolet = new Color32(85, 27, 140, 255); + public static readonly Color AmericanYellow = new Color32(242, 180, 0, 255); + public static readonly Color Amethyst = new Color32(153, 102, 204, 255); + public static readonly Color AndroidGreen = new Color32(164, 198, 57, 255); + public static readonly Color AntiFlashWhite = new Color32(242, 243, 244, 255); + public static readonly Color AntiqueBrass = new Color32(205, 149, 117, 255); + public static readonly Color AntiqueBronze = new Color32(102, 93, 30, 255); + public static readonly Color AntiqueFuchsia = new Color32(145, 92, 131, 255); + public static readonly Color AntiqueRuby = new Color32(132, 27, 45, 255); + public static readonly Color AntiqueWhite = new Color32(250, 235, 215, 255); + public static readonly Color AoEnglish = new Color32(0, 128, 0, 255); + public static readonly Color Apple = new Color32(102, 180, 71, 255); + public static readonly Color AppleGreen = new Color32(141, 182, 0, 255); + public static readonly Color Apricot = new Color32(251, 206, 177, 255); + public static readonly Color Aqua = new Color32(0, 255, 255, 255); + public static readonly Color Aquamarine = new Color32(127, 255, 212, 255); + public static readonly Color ArcticLime = new Color32(208, 255, 20, 255); + public static readonly Color ArmyGreen = new Color32(75, 83, 32, 255); + public static readonly Color Arsenic = new Color32(59, 68, 75, 255); + public static readonly Color Artichoke = new Color32(143, 151, 121, 255); + public static readonly Color ArylideYellow = new Color32(233, 214, 107, 255); + public static readonly Color AshGray = new Color32(178, 190, 181, 255); + public static readonly Color Asparagus = new Color32(135, 169, 107, 255); + public static readonly Color AteneoBlue = new Color32(0, 58, 108, 255); + public static readonly Color AtomicTangerine = new Color32(255, 153, 102, 255); + public static readonly Color Auburn = new Color32(165, 42, 42, 255); + public static readonly Color Aureolin = new Color32(253, 238, 0, 255); + public static readonly Color Aurometalsaurus = new Color32(110, 127, 128, 255); + public static readonly Color Avocado = new Color32(86, 130, 3, 255); + public static readonly Color Awesome = new Color32(255, 32, 82, 255); + public static readonly Color Axolotl = new Color32(99, 119, 91, 255); + public static readonly Color AztecGold = new Color32(195, 153, 83, 255); + public static readonly Color Azure = new Color32(0, 127, 255, 255); + public static readonly Color AzureWebColor = new Color32(240, 255, 255, 255); + public static readonly Color AzureishWhite = new Color32(219, 233, 244, 255); + public static readonly Color BabyBlue = new Color32(137, 207, 240, 255); + public static readonly Color BabyBlueEyes = new Color32(161, 202, 241, 255); + public static readonly Color BabyPink = new Color32(244, 194, 194, 255); + public static readonly Color BabyPowder = new Color32(254, 254, 250, 255); + public static readonly Color BakerMillerPink = new Color32(255, 145, 175, 255); + public static readonly Color BallBlue = new Color32(33, 171, 205, 255); + public static readonly Color BananaMania = new Color32(250, 231, 181, 255); + public static readonly Color BananaYellow = new Color32(255, 225, 53, 255); + public static readonly Color BangladeshGreen = new Color32(0, 106, 78, 255); + public static readonly Color BarbiePink = new Color32(224, 33, 138, 255); + public static readonly Color BarnRed = new Color32(124, 10, 2, 255); + public static readonly Color BatteryChargedBlue = new Color32(29, 172, 214, 255); + public static readonly Color BattleshipGrey = new Color32(132, 132, 130, 255); + public static readonly Color Bazaar = new Color32(152, 119, 123, 255); + public static readonly Color BeauBlue = new Color32(188, 212, 230, 255); + public static readonly Color Beaver = new Color32(159, 129, 112, 255); + public static readonly Color Begonia = new Color32(250, 110, 121, 255); + public static readonly Color Beige = new Color32(245, 245, 220, 255); + public static readonly Color BdazzledBlue = new Color32(46, 88, 148, 255); + public static readonly Color BigDipORuby = new Color32(156, 37, 66, 255); + public static readonly Color BigFootFeet = new Color32(232, 142, 90, 255); + public static readonly Color Bisque = new Color32(255, 228, 196, 255); + public static readonly Color Bistre = new Color32(61, 43, 31, 255); + public static readonly Color BistreBrown = new Color32(150, 113, 23, 255); + public static readonly Color BitterLemon = new Color32(202, 224, 13, 255); + public static readonly Color BitterLime = new Color32(191, 255, 0, 255); + public static readonly Color Bittersweet = new Color32(254, 111, 94, 255); + public static readonly Color BittersweetShimmer = new Color32(191, 79, 81, 255); + public static readonly Color Black = new Color32(0, 0, 0, 255); + public static readonly Color BlackBean = new Color32(61, 12, 2, 255); + public static readonly Color BlackChocolate = new Color32(27, 24, 17, 255); + public static readonly Color BlackCoffee = new Color32(59, 47, 47, 255); + public static readonly Color BlackCoral = new Color32(84, 98, 111, 255); + public static readonly Color BlackLeatherJacket = new Color32(37, 53, 41, 255); + public static readonly Color BlackOlive = new Color32(59, 60, 54, 255); + public static readonly Color Blackberry = new Color32(143, 89, 115, 255); + public static readonly Color BlackShadows = new Color32(191, 175, 178, 255); + public static readonly Color BlanchedAlmond = new Color32(255, 235, 205, 255); + public static readonly Color BlastOffBronze = new Color32(165, 113, 100, 255); + public static readonly Color BleuDeFrance = new Color32(49, 140, 231, 255); + public static readonly Color BlizzardBlue = new Color32(172, 229, 238, 255); + public static readonly Color Blond = new Color32(250, 240, 190, 255); + public static readonly Color BloodOrange = new Color32(210, 0, 27, 255); + public static readonly Color BloodRed = new Color32(102, 0, 0, 255); + public static readonly Color Blue = new Color32(0, 0, 255, 255); + public static readonly Color BlueCrayola = new Color32(31, 117, 254, 255); + public static readonly Color BlueMunsell = new Color32(0, 147, 175, 255); + public static readonly Color BlueNCS = new Color32(0, 135, 189, 255); + public static readonly Color BluePantone = new Color32(0, 24, 168, 255); + public static readonly Color BluePigment = new Color32(51, 51, 153, 255); + public static readonly Color BlueRYB = new Color32(2, 71, 254, 255); + public static readonly Color BlueBell = new Color32(162, 162, 208, 255); + public static readonly Color BlueBolt = new Color32(0, 185, 251, 255); + public static readonly Color BlueGray = new Color32(102, 153, 204, 255); + public static readonly Color BlueGreen = new Color32(13, 152, 186, 255); + public static readonly Color BlueJeans = new Color32(93, 173, 236, 255); + public static readonly Color BlueMagentaViolet = new Color32(85, 53, 146, 255); + public static readonly Color BlueSapphire = new Color32(18, 97, 128, 255); + public static readonly Color BlueViolet = new Color32(138, 43, 226, 255); + public static readonly Color BlueYonder = new Color32(80, 114, 167, 255); + public static readonly Color Blueberry = new Color32(79, 134, 247, 255); + public static readonly Color Bluebonnet = new Color32(28, 28, 240, 255); + public static readonly Color Blush = new Color32(222, 93, 131, 255); + public static readonly Color Bole = new Color32(121, 68, 59, 255); + public static readonly Color BondiBlue = new Color32(0, 149, 182, 255); + public static readonly Color Bone = new Color32(227, 218, 201, 255); + public static readonly Color BoogerBuster = new Color32(221, 226, 106, 255); + public static readonly Color BostonUniversityRed = new Color32(204, 0, 0, 255); + public static readonly Color Boysenberry = new Color32(135, 50, 96, 255); + public static readonly Color BrandeisBlue = new Color32(0, 112, 255, 255); + public static readonly Color Brass = new Color32(181, 166, 66, 255); + public static readonly Color BrickRed = new Color32(203, 65, 84, 255); + public static readonly Color BrightGray = new Color32(235, 236, 240, 255); + public static readonly Color BrightGreen = new Color32(102, 255, 0, 255); + public static readonly Color BrightLavender = new Color32(191, 148, 228, 255); + public static readonly Color BrightLilac = new Color32(216, 145, 239, 255); + public static readonly Color BrightMaroon = new Color32(195, 33, 72, 255); + public static readonly Color BrightNavyBlue = new Color32(25, 116, 210, 255); + public static readonly Color BrightPink = new Color32(255, 0, 127, 255); + public static readonly Color BrightTurquoise = new Color32(8, 232, 222, 255); + public static readonly Color BrightUbe = new Color32(209, 159, 232, 255); + public static readonly Color BrightYellowCrayola = new Color32(255, 170, 29, 255); + public static readonly Color BrilliantAzure = new Color32(51, 153, 255, 255); + public static readonly Color BrilliantLavender = new Color32(244, 187, 255, 255); + public static readonly Color BrilliantRose = new Color32(255, 85, 163, 255); + public static readonly Color BrinkPink = new Color32(251, 96, 127, 255); + public static readonly Color BritishRacingGreen = new Color32(0, 66, 37, 255); + public static readonly Color Bronze = new Color32(136, 84, 11, 255); + public static readonly Color Bronze2 = new Color32(205, 127, 50, 255); + public static readonly Color BronzeMetallic = new Color32(176, 140, 86, 255); + public static readonly Color BronzeYellow = new Color32(115, 112, 0, 255); + public static readonly Color Brown = new Color32(153, 51, 0, 255); + public static readonly Color BrownCrayola = new Color32(175, 89, 62, 255); + public static readonly Color BrownTraditional = new Color32(150, 75, 0, 255); + public static readonly Color BrownNose = new Color32(107, 68, 35, 255); + public static readonly Color BrownSugar = new Color32(175, 110, 77, 255); + public static readonly Color BrownChocolate = new Color32(95, 25, 51, 255); + public static readonly Color BrownCoffee = new Color32(74, 44, 42, 255); + public static readonly Color BrownYellow = new Color32(204, 153, 102, 255); + public static readonly Color BrunswickGreen = new Color32(27, 77, 62, 255); + public static readonly Color BubbleGum = new Color32(255, 193, 204, 255); + public static readonly Color Bubbles = new Color32(231, 254, 255, 255); + public static readonly Color BudGreen = new Color32(123, 182, 97, 255); + public static readonly Color Buff = new Color32(240, 220, 130, 255); + public static readonly Color BulgarianRose = new Color32(72, 6, 7, 255); + public static readonly Color Burgundy = new Color32(128, 0, 32, 255); + public static readonly Color Burlywood = new Color32(222, 184, 135, 255); + public static readonly Color BurnishedBrown = new Color32(161, 122, 116, 255); + public static readonly Color BurntOrange = new Color32(204, 85, 0, 255); + public static readonly Color BurntSienna = new Color32(233, 116, 81, 255); + public static readonly Color BurntUmber = new Color32(138, 51, 36, 255); + public static readonly Color ButtonBlue = new Color32(36, 160, 237, 255); + public static readonly Color Byzantine = new Color32(189, 51, 164, 255); + public static readonly Color Byzantium = new Color32(112, 41, 99, 255); + public static readonly Color Cadet = new Color32(83, 104, 114, 255); + public static readonly Color CadetBlue = new Color32(95, 158, 160, 255); + public static readonly Color CadetGrey = new Color32(145, 163, 176, 255); + public static readonly Color CadmiumBlue = new Color32(10, 17, 146, 255); + public static readonly Color CadmiumGreen = new Color32(0, 107, 60, 255); + public static readonly Color CadmiumOrange = new Color32(237, 135, 45, 255); + public static readonly Color CadmiumPurple = new Color32(182, 12, 38, 255); + public static readonly Color CadmiumRed = new Color32(227, 0, 34, 255); + public static readonly Color CadmiumYellow = new Color32(255, 246, 0, 255); + public static readonly Color CadmiumViolet = new Color32(127, 62, 152, 255); + public static readonly Color CaféAuLait = new Color32(166, 123, 91, 255); + public static readonly Color CaféNoir = new Color32(75, 54, 33, 255); + public static readonly Color CalPolyPomonaGreen = new Color32(30, 77, 43, 255); + public static readonly Color Calamansi = new Color32(252, 255, 164, 255); + public static readonly Color CambridgeBlue = new Color32(163, 193, 173, 255); + public static readonly Color Camel = new Color32(193, 154, 107, 255); + public static readonly Color CameoPink = new Color32(239, 187, 204, 255); + public static readonly Color CamouflageGreen = new Color32(120, 134, 107, 255); + public static readonly Color Canary = new Color32(255, 255, 153, 255); + public static readonly Color CanaryYellow = new Color32(255, 239, 0, 255); + public static readonly Color CandyAppleRed = new Color32(255, 8, 0, 255); + public static readonly Color CandyPink = new Color32(228, 113, 122, 255); + public static readonly Color Capri = new Color32(0, 191, 255, 255); + public static readonly Color CaputMortuum = new Color32(89, 39, 32, 255); + public static readonly Color Caramel = new Color32(255, 213, 154, 255); + public static readonly Color Cardinal = new Color32(196, 30, 58, 255); + public static readonly Color CaribbeanGreen = new Color32(0, 204, 153, 255); + public static readonly Color Carmine = new Color32(150, 0, 24, 255); + public static readonly Color CarmineMP = new Color32(215, 0, 64, 255); + public static readonly Color CarminePink = new Color32(235, 76, 66, 255); + public static readonly Color CarmineRed = new Color32(255, 0, 56, 255); + public static readonly Color CarnationPink = new Color32(255, 166, 201, 255); + public static readonly Color Carnelian = new Color32(179, 27, 27, 255); + public static readonly Color CarolinaBlue = new Color32(86, 160, 211, 255); + public static readonly Color CarrotOrange = new Color32(237, 145, 33, 255); + public static readonly Color CastletonGreen = new Color32(0, 86, 63, 255); + public static readonly Color CatalinaBlue = new Color32(6, 42, 120, 255); + public static readonly Color Catawba = new Color32(112, 54, 66, 255); + public static readonly Color CedarChest = new Color32(201, 90, 73, 255); + public static readonly Color Ceil = new Color32(146, 161, 207, 255); + public static readonly Color Celadon = new Color32(172, 225, 175, 255); + public static readonly Color CeladonBlue = new Color32(0, 123, 167, 255); + public static readonly Color CeladonGreen = new Color32(47, 132, 124, 255); + public static readonly Color Celeste = new Color32(178, 255, 255, 255); + public static readonly Color CelestialBlue = new Color32(73, 151, 208, 255); + public static readonly Color Cerise = new Color32(222, 49, 99, 255); + public static readonly Color CerisePink = new Color32(236, 59, 131, 255); + public static readonly Color CeruleanBlue = new Color32(42, 82, 190, 255); + public static readonly Color CeruleanFrost = new Color32(109, 155, 195, 255); + public static readonly Color CGBlue = new Color32(0, 122, 165, 255); + public static readonly Color CGRed = new Color32(224, 60, 49, 255); + public static readonly Color Chamoisee = new Color32(160, 120, 90, 255); + public static readonly Color Champagne = new Color32(247, 231, 206, 255); + public static readonly Color ChampagnePink = new Color32(241, 221, 207, 255); + public static readonly Color Charcoal = new Color32(54, 69, 79, 255); + public static readonly Color CharlestonGreen = new Color32(35, 43, 43, 255); + public static readonly Color Charm = new Color32(208, 116, 139, 255); + public static readonly Color CharmPink = new Color32(230, 143, 172, 255); + public static readonly Color ChartreuseTraditional = new Color32(223, 255, 0, 255); + public static readonly Color ChartreuseWeb = new Color32(127, 255, 0, 255); + public static readonly Color Cheese = new Color32(255, 166, 0, 255); + public static readonly Color CherryBlossomPink = new Color32(255, 183, 197, 255); + public static readonly Color Chestnut = new Color32(149, 69, 53, 255); + public static readonly Color ChinaPink = new Color32(222, 111, 161, 255); + public static readonly Color ChinaRose = new Color32(168, 81, 110, 255); + public static readonly Color ChineseBlack = new Color32(20, 20, 20, 255); + public static readonly Color ChineseBlue = new Color32(54, 81, 148, 255); + public static readonly Color ChineseBronze = new Color32(205, 128, 50, 255); + public static readonly Color ChineseBrown = new Color32(170, 56, 30, 255); + public static readonly Color ChineseGreen = new Color32(208, 219, 97, 255); + public static readonly Color ChineseGold = new Color32(204, 153, 0, 255); + public static readonly Color ChineseOrange = new Color32(243, 112, 66, 255); + public static readonly Color ChinesePink = new Color32(222, 112, 161, 255); + public static readonly Color ChinesePurple = new Color32(114, 11, 152, 255); + public static readonly Color ChineseRed = new Color32(205, 7, 30, 255); + public static readonly Color ChineseSilver = new Color32(204, 204, 204, 255); + public static readonly Color ChineseViolet = new Color32(133, 96, 136, 255); + public static readonly Color ChineseWhite = new Color32(226, 229, 222, 255); + public static readonly Color ChineseYellow = new Color32(255, 178, 0, 255); + public static readonly Color ChlorophyllGreen = new Color32(74, 255, 0, 255); + public static readonly Color ChocolateKisses = new Color32(60, 20, 33, 255); + public static readonly Color ChocolateTraditional = new Color32(123, 63, 0, 255); + public static readonly Color ChocolateWeb = new Color32(210, 105, 30, 255); + public static readonly Color ChristmasBlue = new Color32(42, 143, 189, 255); + public static readonly Color ChristmasBrown = new Color32(93, 43, 44, 255); + public static readonly Color ChristmasBrown2 = new Color32(76, 31, 2, 255); + public static readonly Color ChristmasGreen = new Color32(60, 141, 13, 255); + public static readonly Color ChristmasGreen2 = new Color32(0, 117, 2, 255); + public static readonly Color ChristmasGold = new Color32(202, 169, 6, 255); + public static readonly Color ChristmasOrange = new Color32(255, 102, 0, 255); + public static readonly Color ChristmasOrange2 = new Color32(213, 108, 43, 255); + public static readonly Color ChristmasPink = new Color32(255, 204, 203, 255); + public static readonly Color ChristmasPink2 = new Color32(227, 66, 133, 255); + public static readonly Color ChristmasPurple = new Color32(102, 51, 152, 255); + public static readonly Color ChristmasPurple2 = new Color32(77, 8, 77, 255); + public static readonly Color ChristmasRed = new Color32(170, 1, 20, 255); + public static readonly Color ChristmasRed2 = new Color32(176, 27, 46, 255); + public static readonly Color ChristmasSilver = new Color32(225, 223, 224, 255); + public static readonly Color ChristmasYellow = new Color32(255, 204, 0, 255); + public static readonly Color ChristmasYellow2 = new Color32(254, 242, 0, 255); + public static readonly Color ChromeYellow = new Color32(255, 167, 0, 255); + public static readonly Color Cinereous = new Color32(152, 129, 123, 255); + public static readonly Color Cinnabar = new Color32(227, 66, 52, 255); + public static readonly Color CinnamonSatin = new Color32(205, 96, 126, 255); + public static readonly Color Citrine = new Color32(228, 208, 10, 255); + public static readonly Color CitrineBrown = new Color32(147, 55, 9, 255); + public static readonly Color Citron = new Color32(158, 169, 31, 255); + public static readonly Color Claret = new Color32(127, 23, 52, 255); + public static readonly Color ClassicRose = new Color32(251, 204, 231, 255); + public static readonly Color CobaltBlue = new Color32(0, 71, 171, 255); + public static readonly Color Coconut = new Color32(150, 90, 62, 255); + public static readonly Color Coffee = new Color32(111, 78, 55, 255); + public static readonly Color Cola = new Color32(60, 48, 36, 255); + public static readonly Color ColumbiaBlue = new Color32(196, 216, 226, 255); + public static readonly Color Conditioner = new Color32(255, 255, 204, 255); + public static readonly Color CongoPink = new Color32(248, 131, 121, 255); + public static readonly Color CoolBlack = new Color32(0, 46, 99, 255); + public static readonly Color CoolGrey = new Color32(140, 146, 172, 255); + public static readonly Color CookiesAndCream = new Color32(238, 224, 177, 255); + public static readonly Color Copper = new Color32(184, 115, 51, 255); + public static readonly Color CopperCrayola = new Color32(218, 138, 103, 255); + public static readonly Color CopperPenny = new Color32(173, 111, 105, 255); + public static readonly Color CopperRed = new Color32(203, 109, 81, 255); + public static readonly Color CopperRose = new Color32(153, 102, 102, 255); + public static readonly Color Coquelicot = new Color32(255, 56, 0, 255); + public static readonly Color Coral = new Color32(255, 127, 80, 255); + public static readonly Color CoralRed = new Color32(255, 64, 64, 255); + public static readonly Color CoralReef = new Color32(253, 124, 110, 255); + public static readonly Color Cordovan = new Color32(137, 63, 69, 255); + public static readonly Color Corn = new Color32(251, 236, 93, 255); + public static readonly Color CornflowerBlue = new Color32(100, 149, 237, 255); + public static readonly Color Cornsilk = new Color32(255, 248, 220, 255); + public static readonly Color CosmicCobalt = new Color32(46, 45, 136, 255); + public static readonly Color CosmicLatte = new Color32(255, 248, 231, 255); + public static readonly Color CoyoteBrown = new Color32(129, 97, 60, 255); + public static readonly Color CottonCandy = new Color32(255, 188, 217, 255); + public static readonly Color Cream = new Color32(255, 253, 208, 255); + public static readonly Color Crimson = new Color32(220, 20, 60, 255); + public static readonly Color CrimsonGlory = new Color32(190, 0, 50, 255); + public static readonly Color CrimsonRed = new Color32(153, 0, 0, 255); + public static readonly Color Cultured = new Color32(245, 245, 245, 255); + public static readonly Color CyanAzure = new Color32(78, 130, 180, 255); + public static readonly Color CyanBlueAzure = new Color32(70, 130, 191, 255); + public static readonly Color CyanCobaltBlue = new Color32(40, 88, 156, 255); + public static readonly Color CyanCornflowerBlue = new Color32(24, 139, 194, 255); + public static readonly Color CyanProcess = new Color32(0, 183, 235, 255); + public static readonly Color CyberGrape = new Color32(88, 66, 124, 255); + public static readonly Color CyberYellow = new Color32(255, 211, 0, 255); + public static readonly Color Cyclamen = new Color32(245, 111, 161, 255); + public static readonly Color Daffodil = new Color32(255, 255, 49, 255); + public static readonly Color Dandelion = new Color32(240, 225, 48, 255); + public static readonly Color DarkBlue = new Color32(0, 0, 139, 255); + public static readonly Color DarkBlueGray = new Color32(102, 102, 153, 255); + public static readonly Color DarkBronze = new Color32(128, 74, 0, 255); + public static readonly Color DarkBrown = new Color32(101, 67, 33, 255); + public static readonly Color DarkBrownTangelo = new Color32(136, 101, 78, 255); + public static readonly Color DarkByzantium = new Color32(93, 57, 84, 255); + public static readonly Color DarkCandyAppleRed = new Color32(164, 0, 0, 255); + public static readonly Color DarkCerulean = new Color32(8, 69, 126, 255); + public static readonly Color DarkCharcoal = new Color32(51, 51, 51, 255); + public static readonly Color DarkChestnut = new Color32(152, 105, 96, 255); + public static readonly Color DarkChocolate = new Color32(73, 2, 6, 255); + public static readonly Color DarkChocolateHersheys = new Color32(60, 19, 33, 255); + public static readonly Color DarkCornflowerBlue = new Color32(38, 66, 139, 255); + public static readonly Color DarkCoral = new Color32(205, 91, 69, 255); + public static readonly Color DarkCyan = new Color32(0, 139, 139, 255); + public static readonly Color DarkElectricBlue = new Color32(83, 104, 120, 255); + public static readonly Color DarkGoldenrod = new Color32(184, 134, 11, 255); + public static readonly Color DarkGrayX11 = new Color32(169, 169, 169, 255); + public static readonly Color DarkGreen = new Color32(1, 50, 32, 255); + public static readonly Color DarkGreenX11 = new Color32(0, 100, 0, 255); + public static readonly Color DarkGunmetal = new Color32(31, 38, 42, 255); + public static readonly Color DarkImperialBlue = new Color32(0, 65, 106, 255); + public static readonly Color DarkImperialBlue2 = new Color32(0, 20, 126, 255); + public static readonly Color DarkJungleGreen = new Color32(26, 36, 33, 255); + public static readonly Color DarkKhaki = new Color32(189, 183, 107, 255); + public static readonly Color DarkLava = new Color32(72, 60, 50, 255); + public static readonly Color DarkLavender = new Color32(115, 79, 150, 255); + public static readonly Color DarkLemonLime = new Color32(139, 190, 27, 255); + public static readonly Color DarkLiver = new Color32(83, 75, 79, 255); + public static readonly Color DarkLiverHorses = new Color32(84, 61, 55, 255); + public static readonly Color DarkMagenta = new Color32(139, 0, 139, 255); + public static readonly Color DarkMidnightBlue = new Color32(0, 51, 102, 255); + public static readonly Color DarkMossGreen = new Color32(74, 93, 35, 255); + public static readonly Color DarkOliveGreen = new Color32(85, 107, 47, 255); + public static readonly Color DarkOrange = new Color32(255, 140, 0, 255); + public static readonly Color DarkOrchid = new Color32(153, 50, 204, 255); + public static readonly Color DarkPastelBlue = new Color32(119, 158, 203, 255); + public static readonly Color DarkPastelGreen = new Color32(3, 192, 60, 255); + public static readonly Color DarkPastelPurple = new Color32(150, 111, 214, 255); + public static readonly Color DarkPastelRed = new Color32(194, 59, 34, 255); + public static readonly Color DarkPink = new Color32(231, 84, 128, 255); + public static readonly Color DarkPowderBlue = new Color32(0, 51, 153, 255); + public static readonly Color DarkPuce = new Color32(79, 58, 60, 255); + public static readonly Color DarkPurple = new Color32(48, 25, 52, 255); + public static readonly Color DarkRaspberry = new Color32(135, 38, 87, 255); + public static readonly Color DarkRed = new Color32(139, 0, 0, 255); + public static readonly Color DarkSalmon = new Color32(233, 150, 122, 255); + public static readonly Color DarkScarlet = new Color32(86, 3, 25, 255); + public static readonly Color DarkSeaGreen = new Color32(143, 188, 143, 255); + public static readonly Color DarkSienna = new Color32(60, 20, 20, 255); + public static readonly Color DarkSkyBlue = new Color32(140, 190, 214, 255); + public static readonly Color DarkSlateBlue = new Color32(72, 61, 139, 255); + public static readonly Color DarkSlateGray = new Color32(47, 79, 79, 255); + public static readonly Color DarkSpringGreen = new Color32(23, 114, 69, 255); + public static readonly Color DarkTan = new Color32(145, 129, 81, 255); + public static readonly Color DarkTangerine = new Color32(255, 168, 18, 255); + public static readonly Color DarkTerraCotta = new Color32(204, 78, 92, 255); + public static readonly Color DarkTurquoise = new Color32(0, 206, 209, 255); + public static readonly Color DarkVanilla = new Color32(209, 190, 168, 255); + public static readonly Color DarkViolet = new Color32(148, 0, 211, 255); + public static readonly Color DarkYellow = new Color32(155, 135, 12, 255); + public static readonly Color DartmouthGreen = new Color32(0, 112, 60, 255); + public static readonly Color DavysGrey = new Color32(85, 85, 85, 255); + public static readonly Color DebianRed = new Color32(215, 10, 83, 255); + public static readonly Color DeepAmethyst = new Color32(156, 138, 164, 255); + public static readonly Color DeepAquamarine = new Color32(64, 130, 109, 255); + public static readonly Color DeepCarmine = new Color32(169, 32, 62, 255); + public static readonly Color DeepCarminePink = new Color32(239, 48, 56, 255); + public static readonly Color DeepCarrotOrange = new Color32(233, 105, 44, 255); + public static readonly Color DeepCerise = new Color32(218, 50, 135, 255); + public static readonly Color DeepChampagne = new Color32(250, 214, 165, 255); + public static readonly Color DeepChestnut = new Color32(185, 78, 72, 255); + public static readonly Color DeepCoffee = new Color32(112, 66, 65, 255); + public static readonly Color DeepFuchsia = new Color32(193, 84, 193, 255); + public static readonly Color DeepGreen = new Color32(5, 102, 8, 255); + public static readonly Color DeepGreenCyanTurquoise = new Color32(14, 124, 97, 255); + public static readonly Color DeepJungleGreen = new Color32(0, 75, 73, 255); + public static readonly Color DeepKoamaru = new Color32(51, 51, 102, 255); + public static readonly Color DeepLemon = new Color32(245, 199, 26, 255); + public static readonly Color DeepLilac = new Color32(153, 85, 187, 255); + public static readonly Color DeepMagenta = new Color32(204, 0, 204, 255); + public static readonly Color DeepMaroon = new Color32(130, 0, 0, 255); + public static readonly Color DeepMauve = new Color32(212, 115, 212, 255); + public static readonly Color DeepMossGreen = new Color32(53, 94, 59, 255); + public static readonly Color DeepPeach = new Color32(255, 203, 164, 255); + public static readonly Color DeepPink = new Color32(255, 20, 147, 255); + public static readonly Color DeepPuce = new Color32(169, 92, 104, 255); + public static readonly Color DeepRed = new Color32(133, 1, 1, 255); + public static readonly Color DeepRuby = new Color32(132, 63, 91, 255); + public static readonly Color DeepSaffron = new Color32(255, 153, 51, 255); + public static readonly Color DeepSpaceSparkle = new Color32(74, 100, 108, 255); + public static readonly Color DeepTaupe = new Color32(126, 94, 96, 255); + public static readonly Color DeepTuscanRed = new Color32(102, 66, 77, 255); + public static readonly Color DeepViolet = new Color32(51, 0, 102, 255); + public static readonly Color Deer = new Color32(186, 135, 89, 255); + public static readonly Color Denim = new Color32(21, 96, 189, 255); + public static readonly Color DenimBlue = new Color32(34, 67, 182, 255); + public static readonly Color DesaturatedCyan = new Color32(102, 153, 153, 255); + public static readonly Color DesertSand = new Color32(237, 201, 175, 255); + public static readonly Color Desire = new Color32(234, 60, 83, 255); + public static readonly Color Diamond = new Color32(185, 242, 255, 255); + public static readonly Color DimGray = new Color32(105, 105, 105, 255); + public static readonly Color DingyDungeon = new Color32(197, 49, 81, 255); + public static readonly Color Dirt = new Color32(155, 118, 83, 255); + public static readonly Color DirtyBrown = new Color32(181, 101, 30, 255); + public static readonly Color DirtyWhite = new Color32(232, 228, 201, 255); + public static readonly Color DodgerBlue = new Color32(30, 144, 255, 255); + public static readonly Color DodieYellow = new Color32(254, 246, 91, 255); + public static readonly Color DogwoodRose = new Color32(215, 24, 104, 255); + public static readonly Color DollarBill = new Color32(133, 187, 101, 255); + public static readonly Color DolphinGray = new Color32(130, 142, 132, 255); + public static readonly Color DonkeyBrown = new Color32(102, 76, 40, 255); + public static readonly Color DukeBlue = new Color32(0, 0, 156, 255); + public static readonly Color DustStorm = new Color32(229, 204, 201, 255); + public static readonly Color DutchWhite = new Color32(239, 223, 187, 255); + public static readonly Color EarthYellow = new Color32(225, 169, 95, 255); + public static readonly Color Ebony = new Color32(85, 93, 80, 255); + public static readonly Color Ecru = new Color32(194, 178, 128, 255); + public static readonly Color EerieBlack = new Color32(27, 27, 27, 255); + public static readonly Color Eggplant = new Color32(97, 64, 81, 255); + public static readonly Color Eggshell = new Color32(240, 234, 214, 255); + public static readonly Color EgyptianBlue = new Color32(16, 52, 166, 255); + public static readonly Color ElectricBlue = new Color32(125, 249, 255, 255); + public static readonly Color ElectricCrimson = new Color32(255, 0, 63, 255); + public static readonly Color ElectricGreen = new Color32(0, 255, 0, 255); + public static readonly Color ElectricIndigo = new Color32(111, 0, 255, 255); + public static readonly Color ElectricLime = new Color32(204, 255, 0, 255); + public static readonly Color ElectricPurple = new Color32(191, 0, 255, 255); + public static readonly Color ElectricUltramarine = new Color32(63, 0, 255, 255); + public static readonly Color ElectricViolet = new Color32(143, 0, 255, 255); + public static readonly Color ElectricYellow = new Color32(255, 255, 51, 255); + public static readonly Color Emerald = new Color32(80, 200, 120, 255); + public static readonly Color EmeraldGreen = new Color32(4, 99, 7, 255); + public static readonly Color Eminence = new Color32(108, 48, 130, 255); + public static readonly Color EnglishLavender = new Color32(180, 131, 149, 255); + public static readonly Color EnglishRed = new Color32(171, 75, 82, 255); + public static readonly Color EnglishVermillion = new Color32(204, 71, 75, 255); + public static readonly Color EnglishViolet = new Color32(86, 60, 92, 255); + public static readonly Color EtonBlue = new Color32(150, 200, 162, 255); + public static readonly Color Eucalyptus = new Color32(68, 215, 168, 255); + public static readonly Color FaluRed = new Color32(128, 24, 24, 255); + public static readonly Color Fandango = new Color32(181, 51, 137, 255); + public static readonly Color FandangoPink = new Color32(222, 82, 133, 255); + public static readonly Color FashionFuchsia = new Color32(244, 0, 161, 255); + public static readonly Color Fawn = new Color32(229, 170, 112, 255); + public static readonly Color Feldgrau = new Color32(77, 93, 83, 255); + public static readonly Color Feldspar = new Color32(253, 213, 177, 255); + public static readonly Color FernGreen = new Color32(79, 121, 66, 255); + public static readonly Color FerrariRed = new Color32(255, 40, 0, 255); + public static readonly Color FieldDrab = new Color32(108, 84, 30, 255); + public static readonly Color FieryRose = new Color32(255, 84, 112, 255); + public static readonly Color Firebrick = new Color32(178, 34, 34, 255); + public static readonly Color FireEngineRed = new Color32(206, 32, 41, 255); + public static readonly Color FireOpal = new Color32(233, 92, 75, 255); + public static readonly Color Flame = new Color32(226, 88, 34, 255); + public static readonly Color FlamingoPink = new Color32(252, 142, 172, 255); + public static readonly Color Flavescent = new Color32(247, 233, 142, 255); + public static readonly Color Flax = new Color32(238, 220, 130, 255); + public static readonly Color Flesh = new Color32(255, 233, 209, 255); + public static readonly Color Flirt = new Color32(162, 0, 109, 255); + public static readonly Color FloralWhite = new Color32(255, 250, 240, 255); + public static readonly Color Folly = new Color32(255, 0, 79, 255); + public static readonly Color ForestGreenTraditional = new Color32(1, 68, 33, 255); + public static readonly Color ForestGreenWeb = new Color32(34, 139, 34, 255); + public static readonly Color FrenchBistre = new Color32(133, 109, 77, 255); + public static readonly Color FrenchBlue = new Color32(0, 114, 187, 255); + public static readonly Color FrenchFuchsia = new Color32(253, 63, 146, 255); + public static readonly Color FrenchLilac = new Color32(134, 96, 142, 255); + public static readonly Color FrenchLime = new Color32(158, 253, 56, 255); + public static readonly Color FrenchPink = new Color32(253, 108, 158, 255); + public static readonly Color FrenchPlum = new Color32(129, 20, 83, 255); + public static readonly Color FrenchPuce = new Color32(78, 22, 9, 255); + public static readonly Color FrenchRaspberry = new Color32(199, 44, 72, 255); + public static readonly Color FrenchRose = new Color32(246, 74, 138, 255); + public static readonly Color FrenchSkyBlue = new Color32(119, 181, 254, 255); + public static readonly Color FrenchViolet = new Color32(136, 6, 206, 255); + public static readonly Color FrenchWine = new Color32(172, 30, 68, 255); + public static readonly Color FreshAir = new Color32(166, 231, 255, 255); + public static readonly Color Frostbite = new Color32(233, 54, 167, 255); + public static readonly Color Fuchsia = new Color32(255, 0, 255, 255); + public static readonly Color FuchsiaPink = new Color32(255, 119, 255, 255); + public static readonly Color FuchsiaPurple = new Color32(204, 57, 123, 255); + public static readonly Color FuchsiaRose = new Color32(199, 67, 117, 255); + public static readonly Color Fulvous = new Color32(228, 132, 0, 255); + public static readonly Color FuzzyWuzzy = new Color32(204, 102, 102, 255); + public static readonly Color Gainsboro = new Color32(220, 220, 220, 255); + public static readonly Color Gamboge = new Color32(228, 155, 15, 255); + public static readonly Color GambogeOrangeBrown = new Color32(152, 102, 0, 255); + public static readonly Color Garnet = new Color32(115, 54, 53, 255); + public static readonly Color GargoyleGas = new Color32(255, 223, 70, 255); + public static readonly Color GenericViridian = new Color32(0, 127, 102, 255); + public static readonly Color GhostWhite = new Color32(248, 248, 255, 255); + public static readonly Color GiantsClub = new Color32(176, 92, 82, 255); + public static readonly Color GiantsOrange = new Color32(254, 90, 29, 255); + public static readonly Color Glaucous = new Color32(96, 130, 182, 255); + public static readonly Color GlossyGrape = new Color32(171, 146, 179, 255); + public static readonly Color GOGreen = new Color32(0, 171, 102, 255); + public static readonly Color Gold = new Color32(165, 124, 0, 255); + public static readonly Color GoldMetallic = new Color32(212, 175, 55, 255); + public static readonly Color GoldWebGolden = new Color32(255, 215, 0, 255); + public static readonly Color GoldCrayola = new Color32(230, 190, 138, 255); + public static readonly Color GoldFusion = new Color32(133, 117, 78, 255); + public static readonly Color GoldFoil = new Color32(189, 155, 22, 255); + public static readonly Color GoldenBrown = new Color32(153, 101, 21, 255); + public static readonly Color GoldenPoppy = new Color32(252, 194, 0, 255); + public static readonly Color GoldenYellow = new Color32(255, 223, 0, 255); + public static readonly Color Goldenrod = new Color32(218, 165, 32, 255); + public static readonly Color GraniteGray = new Color32(103, 103, 103, 255); + public static readonly Color GrannySmithApple = new Color32(168, 228, 160, 255); + public static readonly Color Grape = new Color32(111, 45, 168, 255); + public static readonly Color GrayHTMLCSSGray = new Color32(128, 128, 128, 255); + public static readonly Color GrayX11Gray = new Color32(190, 190, 190, 255); + public static readonly Color GrayAsparagus = new Color32(70, 89, 69, 255); + public static readonly Color Green = new Color32(0, 128, 1, 255); + public static readonly Color GreenCrayola = new Color32(28, 172, 120, 255); + public static readonly Color GreenMunsell = new Color32(0, 168, 119, 255); + public static readonly Color GreenNCS = new Color32(0, 159, 107, 255); + public static readonly Color GreenPantone = new Color32(0, 173, 67, 255); + public static readonly Color GreenPigment = new Color32(0, 165, 80, 255); + public static readonly Color GreenRYB = new Color32(102, 176, 50, 255); + public static readonly Color GreenBlue = new Color32(17, 100, 180, 255); + public static readonly Color GreenCyan = new Color32(0, 153, 102, 255); + public static readonly Color GreenLizard = new Color32(167, 244, 50, 255); + public static readonly Color GreenSheen = new Color32(110, 174, 161, 255); + public static readonly Color GreenYellow = new Color32(173, 255, 47, 255); + public static readonly Color Grullo = new Color32(169, 154, 134, 255); + public static readonly Color GuppieGreen = new Color32(0, 255, 127, 255); + public static readonly Color Gunmetal = new Color32(42, 52, 57, 255); + public static readonly Color HalayàÚbe = new Color32(102, 55, 84, 255); + public static readonly Color HalloweenOrange = new Color32(235, 97, 35, 255); + public static readonly Color HanBlue = new Color32(68, 108, 207, 255); + public static readonly Color HanPurple = new Color32(82, 24, 250, 255); + public static readonly Color Harlequin = new Color32(63, 255, 0, 255); + public static readonly Color HarlequinGreen = new Color32(70, 203, 24, 255); + public static readonly Color HarvardCrimson = new Color32(201, 0, 22, 255); + public static readonly Color HarvestGold = new Color32(218, 145, 0, 255); + public static readonly Color HeartGold = new Color32(128, 128, 0, 255); + public static readonly Color HeatWave = new Color32(255, 122, 0, 255); + public static readonly Color Heliotrope = new Color32(223, 115, 255, 255); + public static readonly Color HeliotropeGray = new Color32(170, 152, 168, 255); + public static readonly Color HeliotropeMagenta = new Color32(170, 0, 187, 255); + public static readonly Color Honeydew = new Color32(240, 255, 240, 255); + public static readonly Color HonoluluBlue = new Color32(0, 109, 176, 255); + public static readonly Color HookersGreen = new Color32(73, 121, 107, 255); + public static readonly Color HotMagenta = new Color32(255, 29, 206, 255); + public static readonly Color HotPink = new Color32(255, 105, 180, 255); + public static readonly Color Iceberg = new Color32(113, 166, 210, 255); + public static readonly Color Icterine = new Color32(252, 247, 94, 255); + public static readonly Color IguanaGreen = new Color32(113, 188, 120, 255); + public static readonly Color IlluminatingEmerald = new Color32(49, 145, 119, 255); + public static readonly Color Imperial = new Color32(96, 47, 107, 255); + public static readonly Color ImperialBlue = new Color32(0, 35, 149, 255); + public static readonly Color ImperialPurple = new Color32(102, 2, 60, 255); + public static readonly Color ImperialRed = new Color32(237, 41, 57, 255); + public static readonly Color Inchworm = new Color32(178, 236, 93, 255); + public static readonly Color Independence = new Color32(76, 81, 109, 255); + public static readonly Color IndiaGreen = new Color32(19, 136, 8, 255); + public static readonly Color IndianRed = new Color32(205, 92, 92, 255); + public static readonly Color IndianYellow = new Color32(227, 168, 87, 255); + public static readonly Color Indigo = new Color32(75, 0, 130, 255); + public static readonly Color IndigoDye = new Color32(9, 31, 146, 255); + public static readonly Color IndigoRainbow = new Color32(35, 48, 103, 255); + public static readonly Color InfraRed = new Color32(255, 73, 108, 255); + public static readonly Color InterdimensionalBlue = new Color32(54, 12, 204, 255); + public static readonly Color InternationalKleinBlue = new Color32(0, 47, 167, 255); + public static readonly Color InternationalOrangeAerospace = new Color32(255, 79, 0, 255); + public static readonly Color InternationalOrangeEngineering = new Color32(186, 22, 12, 255); + public static readonly Color InternationalOrangeGoldenGateBridge = new Color32(192, 54, 44, 255); + public static readonly Color Iris = new Color32(90, 79, 207, 255); + public static readonly Color Irresistible = new Color32(179, 68, 108, 255); + public static readonly Color Isabelline = new Color32(244, 240, 236, 255); + public static readonly Color IslamicGreen = new Color32(0, 144, 0, 255); + public static readonly Color Ivory = new Color32(255, 255, 240, 255); + public static readonly Color Jacarta = new Color32(61, 50, 93, 255); + public static readonly Color JackoBean = new Color32(65, 54, 40, 255); + public static readonly Color Jade = new Color32(0, 168, 107, 255); + public static readonly Color JapaneseCarmine = new Color32(157, 41, 51, 255); + public static readonly Color JapaneseIndigo = new Color32(38, 67, 72, 255); + public static readonly Color JapaneseLaurel = new Color32(47, 117, 50, 255); + public static readonly Color JapaneseViolet = new Color32(91, 50, 86, 255); + public static readonly Color Jasmine = new Color32(248, 222, 126, 255); + public static readonly Color Jasper = new Color32(215, 59, 62, 255); + public static readonly Color JasperOrange = new Color32(223, 145, 79, 255); + public static readonly Color JazzberryJam = new Color32(165, 11, 94, 255); + public static readonly Color JellyBean = new Color32(218, 97, 78, 255); + public static readonly Color JellyBeanBlue = new Color32(68, 121, 142, 255); + public static readonly Color Jet = new Color32(52, 52, 52, 255); + public static readonly Color JetStream = new Color32(187, 208, 201, 255); + public static readonly Color Jonquil = new Color32(244, 202, 22, 255); + public static readonly Color JordyBlue = new Color32(138, 185, 241, 255); + public static readonly Color JuneBud = new Color32(189, 218, 87, 255); + public static readonly Color JungleGreen = new Color32(41, 171, 135, 255); + public static readonly Color KellyGreen = new Color32(76, 187, 23, 255); + public static readonly Color KenyanCopper = new Color32(124, 28, 5, 255); + public static readonly Color Keppel = new Color32(58, 176, 158, 255); + public static readonly Color KeyLime = new Color32(232, 244, 140, 255); + public static readonly Color KhakiHTMLCSSKhaki = new Color32(195, 176, 145, 255); + public static readonly Color KhakiX11LightKhaki = new Color32(240, 230, 140, 255); + public static readonly Color Kiwi = new Color32(142, 229, 63, 255); + public static readonly Color Kobe = new Color32(136, 45, 23, 255); + public static readonly Color Kobi = new Color32(231, 159, 196, 255); + public static readonly Color KombuGreen = new Color32(53, 66, 48, 255); + public static readonly Color KSUPurple = new Color32(79, 38, 131, 255); + public static readonly Color KUCrimson = new Color32(232, 0, 13, 255); + public static readonly Color LaSalleGreen = new Color32(8, 120, 48, 255); + public static readonly Color LanguidLavender = new Color32(214, 202, 221, 255); + public static readonly Color LapisLazuli = new Color32(38, 97, 156, 255); + public static readonly Color LaserLemon = new Color32(255, 255, 102, 255); + public static readonly Color LaurelGreen = new Color32(169, 186, 157, 255); + public static readonly Color Lava = new Color32(207, 16, 32, 255); + public static readonly Color LavenderFloral = new Color32(181, 126, 220, 255); + public static readonly Color LavenderWeb = new Color32(230, 230, 250, 255); + public static readonly Color LavenderBlue = new Color32(204, 204, 255, 255); + public static readonly Color LavenderBlush = new Color32(255, 240, 245, 255); + public static readonly Color LavenderGray = new Color32(196, 195, 208, 255); + public static readonly Color LavenderIndigo = new Color32(148, 87, 235, 255); + public static readonly Color LavenderMagenta = new Color32(238, 130, 238, 255); + public static readonly Color LavenderPink = new Color32(251, 174, 210, 255); + public static readonly Color LavenderPurple = new Color32(150, 123, 182, 255); + public static readonly Color LavenderRose = new Color32(251, 160, 227, 255); + public static readonly Color LawnGreen = new Color32(124, 252, 0, 255); + public static readonly Color Lemon = new Color32(255, 247, 0, 255); + public static readonly Color LemonChiffon = new Color32(255, 250, 205, 255); + public static readonly Color LemonCurry = new Color32(204, 160, 29, 255); + public static readonly Color LemonGlacier = new Color32(253, 255, 0, 255); + public static readonly Color LemonMeringue = new Color32(246, 234, 190, 255); + public static readonly Color LemonYellow = new Color32(255, 244, 79, 255); + public static readonly Color LemonYellowCrayola = new Color32(255, 255, 159, 255); + public static readonly Color Lenurple = new Color32(186, 147, 216, 255); + public static readonly Color Liberty = new Color32(84, 90, 167, 255); + public static readonly Color Licorice = new Color32(26, 17, 16, 255); + public static readonly Color LightBlue = new Color32(173, 216, 230, 255); + public static readonly Color LightBrown = new Color32(181, 101, 29, 255); + public static readonly Color LightCarminePink = new Color32(230, 103, 113, 255); + public static readonly Color LightCobaltBlue = new Color32(136, 172, 224, 255); + public static readonly Color LightCoral = new Color32(240, 128, 128, 255); + public static readonly Color LightCornflowerBlue = new Color32(147, 204, 234, 255); + public static readonly Color LightCrimson = new Color32(245, 105, 145, 255); + public static readonly Color LightCyan = new Color32(224, 255, 255, 255); + public static readonly Color LightDeepPink = new Color32(255, 92, 205, 255); + public static readonly Color LightFrenchBeige = new Color32(200, 173, 127, 255); + public static readonly Color LightFuchsiaPink = new Color32(249, 132, 239, 255); + public static readonly Color LightGold = new Color32(178, 151, 0, 255); + public static readonly Color LightGoldenrodYellow = new Color32(250, 250, 210, 255); + public static readonly Color LightGray = new Color32(211, 211, 211, 255); + public static readonly Color LightGrayishMagenta = new Color32(204, 153, 204, 255); + public static readonly Color LightGreen = new Color32(144, 238, 144, 255); + public static readonly Color LightHotPink = new Color32(255, 179, 222, 255); + public static readonly Color LightMediumOrchid = new Color32(211, 155, 203, 255); + public static readonly Color LightMossGreen = new Color32(173, 223, 173, 255); + public static readonly Color LightOrange = new Color32(254, 216, 177, 255); + public static readonly Color LightOrchid = new Color32(230, 168, 215, 255); + public static readonly Color LightPastelPurple = new Color32(177, 156, 217, 255); + public static readonly Color LightPeriwinkle = new Color32(197, 203, 225, 255); + public static readonly Color LightPink = new Color32(255, 182, 193, 255); + public static readonly Color LightSalmon = new Color32(255, 160, 122, 255); + public static readonly Color LightSalmonPink = new Color32(255, 153, 153, 255); + public static readonly Color LightSeaGreen = new Color32(32, 178, 170, 255); + public static readonly Color LightSilver = new Color32(216, 216, 216, 255); + public static readonly Color LightSkyBlue = new Color32(135, 206, 250, 255); + public static readonly Color LightSlateGray = new Color32(119, 136, 153, 255); + public static readonly Color LightSteelBlue = new Color32(176, 196, 222, 255); + public static readonly Color LightTaupe = new Color32(179, 139, 109, 255); + public static readonly Color LightYellow = new Color32(255, 255, 224, 255); + public static readonly Color Lilac = new Color32(200, 162, 200, 255); + public static readonly Color LilacLuster = new Color32(174, 152, 170, 255); + public static readonly Color LimeGreen = new Color32(50, 205, 50, 255); + public static readonly Color Limerick = new Color32(157, 194, 9, 255); + public static readonly Color LincolnGreen = new Color32(25, 89, 5, 255); + public static readonly Color Linen = new Color32(250, 240, 230, 255); + public static readonly Color LittleBoyBlue = new Color32(108, 160, 220, 255); + public static readonly Color LittleGirlPink = new Color32(248, 185, 212, 255); + public static readonly Color Liver = new Color32(103, 76, 71, 255); + public static readonly Color LiverDogs = new Color32(184, 109, 41, 255); + public static readonly Color LiverOrgan = new Color32(108, 46, 31, 255); + public static readonly Color LiverChestnut = new Color32(152, 116, 86, 255); + public static readonly Color Lotion = new Color32(255, 254, 250, 255); + public static readonly Color Lumber = new Color32(255, 228, 205, 255); + public static readonly Color Lust = new Color32(230, 32, 32, 255); + public static readonly Color MaastrichtBlue = new Color32(0, 28, 61, 255); + public static readonly Color MacaroniAndCheese = new Color32(255, 189, 136, 255); + public static readonly Color MadderLake = new Color32(204, 51, 54, 255); + public static readonly Color MagentaDye = new Color32(202, 31, 123, 255); + public static readonly Color MagentaPantone = new Color32(208, 65, 126, 255); + public static readonly Color MagentaProcess = new Color32(255, 0, 144, 255); + public static readonly Color MagentaHaze = new Color32(159, 69, 118, 255); + public static readonly Color MagentaPink = new Color32(204, 51, 139, 255); + public static readonly Color MagicMint = new Color32(170, 240, 209, 255); + public static readonly Color MagicPotion = new Color32(255, 68, 102, 255); + public static readonly Color Magnolia = new Color32(248, 244, 255, 255); + public static readonly Color Mahogany = new Color32(192, 64, 0, 255); + public static readonly Color MaizeCrayola = new Color32(242, 198, 73, 255); + public static readonly Color MajorelleBlue = new Color32(96, 80, 220, 255); + public static readonly Color Malachite = new Color32(11, 218, 81, 255); + public static readonly Color Manatee = new Color32(151, 154, 170, 255); + public static readonly Color Mandarin = new Color32(243, 122, 72, 255); + public static readonly Color MangoGreen = new Color32(150, 255, 0, 255); + public static readonly Color MangoTango = new Color32(255, 130, 67, 255); + public static readonly Color Mantis = new Color32(116, 195, 101, 255); + public static readonly Color MardiGras = new Color32(136, 0, 133, 255); + public static readonly Color Marigold = new Color32(234, 162, 33, 255); + public static readonly Color MaroonHTMLCSS = new Color32(128, 0, 0, 255); + public static readonly Color MaroonX11 = new Color32(176, 48, 96, 255); + public static readonly Color Mauve = new Color32(224, 176, 255, 255); + public static readonly Color MauveTaupe = new Color32(145, 95, 109, 255); + public static readonly Color Mauvelous = new Color32(239, 152, 170, 255); + public static readonly Color MaximumBlue = new Color32(71, 171, 204, 255); + public static readonly Color MaximumBlueGreen = new Color32(48, 191, 191, 255); + public static readonly Color MaximumBluePurple = new Color32(172, 172, 230, 255); + public static readonly Color MaximumGreen = new Color32(94, 140, 49, 255); + public static readonly Color MaximumGreenYellow = new Color32(217, 230, 80, 255); + public static readonly Color MaximumPurple = new Color32(115, 51, 128, 255); + public static readonly Color MaximumRed = new Color32(217, 33, 33, 255); + public static readonly Color MaximumRedPurple = new Color32(166, 58, 121, 255); + public static readonly Color MaximumYellow = new Color32(250, 250, 55, 255); + public static readonly Color MaximumYellowRed = new Color32(242, 186, 73, 255); + public static readonly Color MayGreen = new Color32(76, 145, 65, 255); + public static readonly Color MayaBlue = new Color32(115, 194, 251, 255); + public static readonly Color MeatBrown = new Color32(229, 183, 59, 255); + public static readonly Color MediumAquamarine = new Color32(102, 221, 170, 255); + public static readonly Color MediumBlue = new Color32(0, 0, 205, 255); + public static readonly Color MediumCandyAppleRed = new Color32(226, 6, 44, 255); + public static readonly Color MediumCarmine = new Color32(175, 64, 53, 255); + public static readonly Color MediumChampagne = new Color32(243, 229, 171, 255); + public static readonly Color MediumElectricBlue = new Color32(3, 80, 150, 255); + public static readonly Color MediumJungleGreen = new Color32(28, 53, 45, 255); + public static readonly Color MediumLavenderMagenta = new Color32(221, 160, 221, 255); + public static readonly Color MediumOrchid = new Color32(186, 85, 211, 255); + public static readonly Color MediumPersianBlue = new Color32(0, 103, 165, 255); + public static readonly Color MediumPurple = new Color32(147, 112, 219, 255); + public static readonly Color MediumRedViolet = new Color32(187, 51, 133, 255); + public static readonly Color MediumRuby = new Color32(170, 64, 105, 255); + public static readonly Color MediumSeaGreen = new Color32(60, 179, 113, 255); + public static readonly Color MediumSkyBlue = new Color32(128, 218, 235, 255); + public static readonly Color MediumSlateBlue = new Color32(123, 104, 238, 255); + public static readonly Color MediumSpringBud = new Color32(201, 220, 135, 255); + public static readonly Color MediumSpringGreen = new Color32(0, 250, 154, 255); + public static readonly Color MediumTurquoise = new Color32(72, 209, 204, 255); + public static readonly Color MediumVermilion = new Color32(217, 96, 59, 255); + public static readonly Color MediumVioletRed = new Color32(199, 21, 133, 255); + public static readonly Color MellowApricot = new Color32(248, 184, 120, 255); + public static readonly Color Melon = new Color32(253, 188, 180, 255); + public static readonly Color Menthol = new Color32(193, 249, 162, 255); + public static readonly Color MetallicBlue = new Color32(50, 82, 123, 255); + public static readonly Color MetallicBronze = new Color32(169, 113, 66, 255); + public static readonly Color MetallicBrown = new Color32(172, 67, 19, 255); + public static readonly Color MetallicGreen = new Color32(41, 110, 1, 255); + public static readonly Color MetallicOrange = new Color32(218, 104, 15, 255); + public static readonly Color MetallicPink = new Color32(237, 166, 196, 255); + public static readonly Color MetallicRed = new Color32(166, 44, 43, 255); + public static readonly Color MetallicSeaweed = new Color32(10, 126, 140, 255); + public static readonly Color MetallicSilver = new Color32(168, 169, 173, 255); + public static readonly Color MetallicSunburst = new Color32(156, 124, 56, 255); + public static readonly Color MetallicViolet = new Color32(90, 10, 145, 255); + public static readonly Color MetallicYellow = new Color32(253, 204, 13, 255); + public static readonly Color MexicanPink = new Color32(228, 0, 124, 255); + public static readonly Color MiddleBlue = new Color32(126, 212, 230, 255); + public static readonly Color MiddleBlueGreen = new Color32(141, 217, 204, 255); + public static readonly Color MiddleBluePurple = new Color32(139, 114, 190, 255); + public static readonly Color MiddleGrey = new Color32(139, 134, 128, 255); + public static readonly Color MiddleGreen = new Color32(77, 140, 87, 255); + public static readonly Color MiddleGreenYellow = new Color32(172, 191, 96, 255); + public static readonly Color MiddlePurple = new Color32(217, 130, 181, 255); + public static readonly Color MiddleRed = new Color32(229, 144, 115, 255); + public static readonly Color MiddleRedPurple = new Color32(165, 83, 83, 255); + public static readonly Color MiddleYellow = new Color32(255, 235, 0, 255); + public static readonly Color MiddleYellowRed = new Color32(236, 177, 118, 255); + public static readonly Color Midnight = new Color32(112, 38, 112, 255); + public static readonly Color MidnightBlue = new Color32(25, 25, 112, 255); + public static readonly Color MidnightBlue2 = new Color32(0, 70, 140, 255); + public static readonly Color MidnightGreenEagleGreen = new Color32(0, 73, 83, 255); + public static readonly Color MikadoYellow = new Color32(255, 196, 12, 255); + public static readonly Color Milk = new Color32(253, 255, 245, 255); + public static readonly Color MilkChocolate = new Color32(132, 86, 60, 255); + public static readonly Color MimiPink = new Color32(255, 218, 233, 255); + public static readonly Color Mindaro = new Color32(227, 249, 136, 255); + public static readonly Color Ming = new Color32(54, 116, 125, 255); + public static readonly Color MinionYellow = new Color32(245, 220, 80, 255); + public static readonly Color Mint = new Color32(62, 180, 137, 255); + public static readonly Color MintCream = new Color32(245, 255, 250, 255); + public static readonly Color MintGreen = new Color32(152, 255, 152, 255); + public static readonly Color MistyMoss = new Color32(187, 180, 119, 255); + public static readonly Color MistyRose = new Color32(255, 228, 225, 255); + public static readonly Color Moonstone = new Color32(58, 168, 193, 255); + public static readonly Color MoonstoneBlue = new Color32(115, 169, 194, 255); + public static readonly Color MordantRed19 = new Color32(174, 12, 0, 255); + public static readonly Color MorningBlue = new Color32(141, 163, 153, 255); + public static readonly Color MossGreen = new Color32(138, 154, 91, 255); + public static readonly Color MountainMeadow = new Color32(48, 186, 143, 255); + public static readonly Color MountbattenPink = new Color32(153, 122, 141, 255); + public static readonly Color MSUGreen = new Color32(24, 69, 59, 255); + public static readonly Color Mud = new Color32(111, 83, 61, 255); + public static readonly Color MughalGreen = new Color32(48, 96, 48, 255); + public static readonly Color Mulberry = new Color32(197, 75, 140, 255); + public static readonly Color MulberryCrayola = new Color32(200, 80, 155, 255); + public static readonly Color Mustard = new Color32(255, 219, 88, 255); + public static readonly Color MustardBrown = new Color32(205, 122, 0, 255); + public static readonly Color MustardGreen = new Color32(110, 110, 48, 255); + public static readonly Color MustardYellow = new Color32(255, 173, 1, 255); + public static readonly Color MyrtleGreen = new Color32(49, 120, 115, 255); + public static readonly Color Mystic = new Color32(214, 82, 130, 255); + public static readonly Color MysticMaroon = new Color32(173, 67, 121, 255); + public static readonly Color MysticRed = new Color32(255, 34, 0, 255); + public static readonly Color NadeshikoPink = new Color32(246, 173, 198, 255); + public static readonly Color NapierGreen = new Color32(42, 128, 0, 255); + public static readonly Color NaplesYellow = new Color32(250, 218, 94, 255); + public static readonly Color NavajoWhite = new Color32(255, 222, 173, 255); + public static readonly Color Navy = new Color32(0, 0, 128, 255); + public static readonly Color NeonBlue = new Color32(27, 3, 163, 255); + public static readonly Color NeonBrown = new Color32(195, 115, 42, 255); + public static readonly Color NeonCarrot = new Color32(255, 163, 67, 255); + public static readonly Color NeonCyan = new Color32(0, 254, 252, 255); + public static readonly Color NeonFuchsia = new Color32(254, 65, 100, 255); + public static readonly Color NeonGold = new Color32(207, 170, 1, 255); + public static readonly Color NeonGreen = new Color32(57, 255, 20, 255); + public static readonly Color NeonPink = new Color32(254, 52, 126, 255); + public static readonly Color NeonRed = new Color32(255, 24, 24, 255); + public static readonly Color NeonScarlet = new Color32(255, 38, 3, 255); + public static readonly Color NeonTangerine = new Color32(246, 137, 10, 255); + public static readonly Color NewCar = new Color32(33, 79, 198, 255); + public static readonly Color NewYorkPink = new Color32(215, 131, 127, 255); + public static readonly Color Nickel = new Color32(114, 116, 114, 255); + public static readonly Color NonPhotoBlue = new Color32(164, 221, 237, 255); + public static readonly Color NorthTexasGreen = new Color32(5, 144, 51, 255); + public static readonly Color Nyanza = new Color32(233, 255, 219, 255); + public static readonly Color OceanBlue = new Color32(79, 66, 181, 255); + public static readonly Color OceanBoatBlue = new Color32(0, 119, 190, 255); + public static readonly Color OceanGreen = new Color32(72, 191, 145, 255); + public static readonly Color Ochre = new Color32(204, 119, 34, 255); + public static readonly Color OgreOdor = new Color32(253, 82, 64, 255); + public static readonly Color OldBurgundy = new Color32(67, 48, 46, 255); + public static readonly Color OldGold = new Color32(207, 181, 59, 255); + public static readonly Color OldLace = new Color32(253, 245, 230, 255); + public static readonly Color OldLavender = new Color32(121, 104, 120, 255); + public static readonly Color OldMauve = new Color32(103, 49, 71, 255); + public static readonly Color OldMossGreen = new Color32(134, 126, 54, 255); + public static readonly Color OldRose = new Color32(192, 128, 129, 255); + public static readonly Color OliveDrab3 = new Color32(107, 142, 35, 255); + public static readonly Color OliveDrab7 = new Color32(60, 52, 31, 255); + public static readonly Color Olivine = new Color32(154, 185, 115, 255); + public static readonly Color Onyx = new Color32(53, 56, 57, 255); + public static readonly Color Opal = new Color32(168, 195, 188, 255); + public static readonly Color OperaMauve = new Color32(183, 132, 167, 255); + public static readonly Color OrangeColorWheel = new Color32(255, 127, 0, 255); + public static readonly Color OrangeCrayola = new Color32(255, 117, 56, 255); + public static readonly Color OrangePantone = new Color32(255, 88, 0, 255); + public static readonly Color OrangeRYB = new Color32(251, 153, 2, 255); + public static readonly Color OrangeWeb = new Color32(255, 165, 0, 255); + public static readonly Color OrangePeel = new Color32(255, 159, 0, 255); + public static readonly Color OrangeRed = new Color32(255, 69, 0, 255); + public static readonly Color OrangeSoda = new Color32(250, 91, 61, 255); + public static readonly Color OrangeYellow = new Color32(248, 213, 104, 255); + public static readonly Color Orchid = new Color32(218, 112, 214, 255); + public static readonly Color OrchidPink = new Color32(242, 189, 205, 255); + public static readonly Color OriolesOrange = new Color32(251, 79, 20, 255); + public static readonly Color OuterSpace = new Color32(65, 74, 76, 255); + public static readonly Color OutrageousOrange = new Color32(255, 110, 74, 255); + public static readonly Color OxfordBlue = new Color32(0, 33, 71, 255); + public static readonly Color Oxley = new Color32(109, 154, 121, 255); + public static readonly Color PacificBlue = new Color32(28, 169, 201, 255); + public static readonly Color PakistanGreen = new Color32(0, 102, 0, 255); + public static readonly Color PalatinateBlue = new Color32(39, 59, 226, 255); + public static readonly Color PalatinatePurple = new Color32(104, 40, 96, 255); + public static readonly Color PaleBlue = new Color32(175, 238, 238, 255); + public static readonly Color PaleBrown = new Color32(152, 118, 84, 255); + public static readonly Color PaleCerulean = new Color32(155, 196, 226, 255); + public static readonly Color PaleChestnut = new Color32(221, 173, 175, 255); + public static readonly Color PaleCornflowerBlue = new Color32(171, 205, 239, 255); + public static readonly Color PaleCyan = new Color32(135, 211, 248, 255); + public static readonly Color PaleGoldenrod = new Color32(238, 232, 170, 255); + public static readonly Color PaleGreen = new Color32(152, 251, 152, 255); + public static readonly Color PaleLavender = new Color32(220, 208, 255, 255); + public static readonly Color PaleMagenta = new Color32(249, 132, 229, 255); + public static readonly Color PaleMagentaPink = new Color32(255, 153, 204, 255); + public static readonly Color PalePink = new Color32(250, 218, 221, 255); + public static readonly Color PaleRedViolet = new Color32(219, 112, 147, 255); + public static readonly Color PaleRobinEggBlue = new Color32(150, 222, 209, 255); + public static readonly Color PaleSilver = new Color32(201, 192, 187, 255); + public static readonly Color PaleSpringBud = new Color32(236, 235, 189, 255); + public static readonly Color PaleTaupe = new Color32(188, 152, 126, 255); + public static readonly Color PaleViolet = new Color32(204, 153, 255, 255); + public static readonly Color PalmLeaf = new Color32(111, 153, 64, 255); + public static readonly Color PansyPurple = new Color32(120, 24, 74, 255); + public static readonly Color PaoloVeroneseGreen = new Color32(0, 155, 125, 255); + public static readonly Color PapayaWhip = new Color32(255, 239, 213, 255); + public static readonly Color ParadisePink = new Color32(230, 62, 98, 255); + public static readonly Color ParrotPink = new Color32(217, 152, 160, 255); + public static readonly Color PastelBlue = new Color32(174, 198, 207, 255); + public static readonly Color PastelBrown = new Color32(130, 105, 83, 255); + public static readonly Color PastelGray = new Color32(207, 207, 196, 255); + public static readonly Color PastelGreen = new Color32(119, 221, 119, 255); + public static readonly Color PastelMagenta = new Color32(244, 154, 194, 255); + public static readonly Color PastelOrange = new Color32(255, 179, 71, 255); + public static readonly Color PastelPink = new Color32(222, 165, 164, 255); + public static readonly Color PastelPurple = new Color32(179, 158, 181, 255); + public static readonly Color PastelRed = new Color32(255, 105, 97, 255); + public static readonly Color PastelViolet = new Color32(203, 153, 201, 255); + public static readonly Color PastelYellow = new Color32(253, 253, 150, 255); + public static readonly Color Patriarch = new Color32(128, 0, 128, 255); + public static readonly Color Peach = new Color32(255, 229, 180, 255); + public static readonly Color PeachOrange = new Color32(255, 204, 153, 255); + public static readonly Color PeachPuff = new Color32(255, 218, 185, 255); + public static readonly Color PeachYellow = new Color32(250, 223, 173, 255); + public static readonly Color Pear = new Color32(209, 226, 49, 255); + public static readonly Color Pearl = new Color32(234, 224, 200, 255); + public static readonly Color PearlAqua = new Color32(136, 216, 192, 255); + public static readonly Color PearlyPurple = new Color32(183, 104, 162, 255); + public static readonly Color Peridot = new Color32(230, 226, 0, 255); + public static readonly Color PeriwinkleCrayola = new Color32(195, 205, 230, 255); + public static readonly Color PermanentGeraniumLake = new Color32(225, 44, 44, 255); + public static readonly Color PersianBlue = new Color32(28, 57, 187, 255); + public static readonly Color PersianGreen = new Color32(0, 166, 147, 255); + public static readonly Color PersianIndigo = new Color32(50, 18, 122, 255); + public static readonly Color PersianOrange = new Color32(217, 144, 88, 255); + public static readonly Color PersianPink = new Color32(247, 127, 190, 255); + public static readonly Color PersianPlum = new Color32(112, 28, 28, 255); + public static readonly Color PersianRed = new Color32(204, 51, 51, 255); + public static readonly Color PersianRose = new Color32(254, 40, 162, 255); + public static readonly Color Persimmon = new Color32(236, 88, 0, 255); + public static readonly Color Peru = new Color32(205, 133, 63, 255); + public static readonly Color PewterBlue = new Color32(139, 168, 183, 255); + public static readonly Color PhilippineBlue = new Color32(0, 56, 167, 255); + public static readonly Color PhilippineBrown = new Color32(93, 25, 22, 255); + public static readonly Color PhilippineGold = new Color32(177, 115, 4, 255); + public static readonly Color PhilippineGoldenYellow = new Color32(253, 223, 22, 255); + public static readonly Color PhilippineGray = new Color32(140, 140, 140, 255); + public static readonly Color PhilippineGreen = new Color32(0, 133, 67, 255); + public static readonly Color PhilippineOrange = new Color32(255, 115, 0, 255); + public static readonly Color PhilippinePink = new Color32(255, 26, 142, 255); + public static readonly Color PhilippineRed = new Color32(206, 17, 39, 255); + public static readonly Color PhilippineSilver = new Color32(179, 179, 179, 255); + public static readonly Color PhilippineViolet = new Color32(129, 0, 127, 255); + public static readonly Color PhilippineYellow = new Color32(254, 203, 0, 255); + public static readonly Color Phlox = new Color32(223, 0, 255, 255); + public static readonly Color PhthaloBlue = new Color32(0, 15, 137, 255); + public static readonly Color PhthaloGreen = new Color32(18, 53, 36, 255); + public static readonly Color PictonBlue = new Color32(69, 177, 232, 255); + public static readonly Color PictorialCarmine = new Color32(195, 11, 78, 255); + public static readonly Color PiggyPink = new Color32(253, 221, 230, 255); + public static readonly Color PineGreen = new Color32(1, 121, 111, 255); + public static readonly Color PineTree = new Color32(42, 47, 35, 255); + public static readonly Color Pineapple = new Color32(86, 60, 13, 255); + public static readonly Color Pink = new Color32(255, 192, 203, 255); + public static readonly Color PinkPantone = new Color32(215, 72, 148, 255); + public static readonly Color PinkFlamingo = new Color32(252, 116, 253, 255); + public static readonly Color PinkLace = new Color32(255, 221, 244, 255); + public static readonly Color PinkLavender = new Color32(216, 178, 209, 255); + public static readonly Color PinkPearl = new Color32(231, 172, 207, 255); + public static readonly Color PinkRaspberry = new Color32(152, 0, 54, 255); + public static readonly Color PinkSherbet = new Color32(247, 143, 167, 255); + public static readonly Color Pistachio = new Color32(147, 197, 114, 255); + public static readonly Color PixiePowder = new Color32(57, 18, 133, 255); + public static readonly Color Platinum = new Color32(229, 228, 226, 255); + public static readonly Color Plum = new Color32(142, 69, 133, 255); + public static readonly Color PlumpPurple = new Color32(89, 70, 178, 255); + public static readonly Color PoliceBlue = new Color32(55, 79, 107, 255); + public static readonly Color PolishedPine = new Color32(93, 164, 147, 255); + public static readonly Color Popstar = new Color32(190, 79, 98, 255); + public static readonly Color PortlandOrange = new Color32(255, 90, 54, 255); + public static readonly Color PowderBlue = new Color32(176, 224, 230, 255); + public static readonly Color PrincessPerfume = new Color32(255, 133, 207, 255); + public static readonly Color PrincetonOrange = new Color32(245, 128, 37, 255); + public static readonly Color PrussianBlue = new Color32(0, 49, 83, 255); + public static readonly Color Puce = new Color32(204, 136, 153, 255); + public static readonly Color PuceRed = new Color32(114, 47, 55, 255); + public static readonly Color PullmanBrownUPSBrown = new Color32(100, 65, 23, 255); + public static readonly Color PullmanGreen = new Color32(59, 51, 28, 255); + public static readonly Color Pumpkin = new Color32(255, 117, 24, 255); + public static readonly Color PurpleMunsell = new Color32(159, 0, 197, 255); + public static readonly Color PurpleX11 = new Color32(160, 32, 240, 255); + public static readonly Color PurpleHeart = new Color32(105, 53, 156, 255); + public static readonly Color PurpleMountainMajesty = new Color32(150, 120, 182, 255); + public static readonly Color PurpleNavy = new Color32(78, 81, 128, 255); + public static readonly Color PurplePizzazz = new Color32(254, 78, 218, 255); + public static readonly Color PurplePlum = new Color32(156, 81, 182, 255); + public static readonly Color PurpleTaupe = new Color32(80, 64, 77, 255); + public static readonly Color Purpureus = new Color32(154, 78, 174, 255); + public static readonly Color Quartz = new Color32(81, 72, 79, 255); + public static readonly Color QueenBlue = new Color32(67, 107, 149, 255); + public static readonly Color QueenPink = new Color32(232, 204, 215, 255); + public static readonly Color QuickSilver = new Color32(166, 166, 166, 255); + public static readonly Color QuinacridoneMagenta = new Color32(142, 58, 89, 255); + public static readonly Color Quincy = new Color32(106, 84, 69, 255); + public static readonly Color RadicalRed = new Color32(255, 53, 94, 255); + public static readonly Color RaisinBlack = new Color32(36, 33, 36, 255); + public static readonly Color Rajah = new Color32(251, 171, 96, 255); + public static readonly Color Raspberry = new Color32(227, 11, 92, 255); + public static readonly Color RaspberryPink = new Color32(226, 80, 152, 255); + public static readonly Color RawSienna = new Color32(214, 138, 89, 255); + public static readonly Color RawUmber = new Color32(130, 102, 68, 255); + public static readonly Color RazzleDazzleRose = new Color32(255, 51, 204, 255); + public static readonly Color Razzmatazz = new Color32(227, 37, 107, 255); + public static readonly Color RazzmicBerry = new Color32(141, 78, 133, 255); + public static readonly Color RebeccaPurple = new Color32(102, 52, 153, 255); + public static readonly Color Red = new Color32(255, 0, 0, 255); + public static readonly Color RedCrayola = new Color32(238, 32, 77, 255); + public static readonly Color RedMunsell = new Color32(242, 0, 60, 255); + public static readonly Color RedNCS = new Color32(196, 2, 51, 255); + public static readonly Color RedPigment = new Color32(237, 28, 36, 255); + public static readonly Color RedRYB = new Color32(254, 39, 18, 255); + public static readonly Color RedDevil = new Color32(134, 1, 17, 255); + public static readonly Color RedOrange = new Color32(255, 83, 73, 255); + public static readonly Color RedPurple = new Color32(228, 0, 120, 255); + public static readonly Color RedSalsa = new Color32(253, 58, 74, 255); + public static readonly Color Redwood = new Color32(164, 90, 82, 255); + public static readonly Color Regalia = new Color32(82, 45, 128, 255); + public static readonly Color ResolutionBlue = new Color32(0, 35, 135, 255); + public static readonly Color Rhythm = new Color32(119, 118, 150, 255); + public static readonly Color RichBlack = new Color32(0, 64, 64, 255); + public static readonly Color RichBlackFOGRA29 = new Color32(1, 11, 19, 255); + public static readonly Color RichBlackFOGRA39 = new Color32(1, 2, 3, 255); + public static readonly Color RichBrilliantLavender = new Color32(241, 167, 254, 255); + public static readonly Color RichElectricBlue = new Color32(8, 146, 208, 255); + public static readonly Color RichLavender = new Color32(167, 107, 207, 255); + public static readonly Color RichLilac = new Color32(182, 102, 210, 255); + public static readonly Color RifleGreen = new Color32(68, 76, 56, 255); + public static readonly Color RobinEggBlue = new Color32(0, 204, 204, 255); + public static readonly Color RocketMetallic = new Color32(138, 127, 128, 255); + public static readonly Color RomanSilver = new Color32(131, 137, 150, 255); + public static readonly Color RootBeer = new Color32(41, 14, 5, 255); + public static readonly Color RoseBonbon = new Color32(249, 66, 158, 255); + public static readonly Color RoseDust = new Color32(158, 94, 111, 255); + public static readonly Color RoseEbony = new Color32(103, 72, 70, 255); + public static readonly Color RoseGarnet = new Color32(150, 1, 69, 255); + public static readonly Color RoseGold = new Color32(183, 110, 121, 255); + public static readonly Color RosePink = new Color32(255, 102, 204, 255); + public static readonly Color RoseQuartz = new Color32(170, 152, 169, 255); + public static readonly Color RoseQuartzPink = new Color32(189, 85, 156, 255); + public static readonly Color RoseRed = new Color32(194, 30, 86, 255); + public static readonly Color RoseTaupe = new Color32(144, 93, 93, 255); + public static readonly Color RoseVale = new Color32(171, 78, 82, 255); + public static readonly Color Rosewood = new Color32(101, 0, 11, 255); + public static readonly Color RossoCorsa = new Color32(212, 0, 0, 255); + public static readonly Color RosyBrown = new Color32(188, 143, 143, 255); + public static readonly Color RoyalAzure = new Color32(0, 56, 168, 255); + public static readonly Color RoyalBlue = new Color32(0, 35, 102, 255); + public static readonly Color RoyalBlue2 = new Color32(65, 105, 225, 255); + public static readonly Color RoyalBrown = new Color32(82, 59, 53, 255); + public static readonly Color RoyalFuchsia = new Color32(202, 44, 146, 255); + public static readonly Color RoyalGreen = new Color32(19, 98, 7, 255); + public static readonly Color RoyalOrange = new Color32(249, 146, 69, 255); + public static readonly Color RoyalPink = new Color32(231, 56, 149, 255); + public static readonly Color RoyalRed = new Color32(155, 28, 49, 255); + public static readonly Color RoyalRed2 = new Color32(208, 0, 96, 255); + public static readonly Color RoyalPurple = new Color32(120, 81, 169, 255); + public static readonly Color Ruber = new Color32(206, 70, 118, 255); + public static readonly Color RubineRed = new Color32(209, 0, 86, 255); + public static readonly Color Ruby = new Color32(224, 17, 95, 255); + public static readonly Color RubyRed = new Color32(155, 17, 30, 255); + public static readonly Color Ruddy = new Color32(255, 0, 40, 255); + public static readonly Color RuddyBrown = new Color32(187, 101, 40, 255); + public static readonly Color RuddyPink = new Color32(225, 142, 150, 255); + public static readonly Color Rufous = new Color32(168, 28, 7, 255); + public static readonly Color Russet = new Color32(128, 70, 27, 255); + public static readonly Color RussianGreen = new Color32(103, 146, 103, 255); + public static readonly Color RussianViolet = new Color32(50, 23, 77, 255); + public static readonly Color Rust = new Color32(183, 65, 14, 255); + public static readonly Color RustyRed = new Color32(218, 44, 67, 255); + public static readonly Color SacramentoStateGreen = new Color32(4, 57, 39, 255); + public static readonly Color SaddleBrown = new Color32(139, 69, 19, 255); + public static readonly Color SafetyOrange = new Color32(255, 120, 0, 255); + public static readonly Color SafetyOrangeBlazeOrange = new Color32(255, 103, 0, 255); + public static readonly Color SafetyYellow = new Color32(238, 210, 2, 255); + public static readonly Color Saffron = new Color32(244, 196, 48, 255); + public static readonly Color Sage = new Color32(188, 184, 138, 255); + public static readonly Color StPatricksBlue = new Color32(35, 41, 122, 255); + public static readonly Color SalemColor = new Color32(23, 123, 77, 255); + public static readonly Color Salmon = new Color32(250, 128, 114, 255); + public static readonly Color SalmonPink = new Color32(255, 145, 164, 255); + public static readonly Color Sandstorm = new Color32(236, 213, 64, 255); + public static readonly Color SandyBrown = new Color32(244, 164, 96, 255); + public static readonly Color SandyTan = new Color32(253, 217, 181, 255); + public static readonly Color Sangria = new Color32(146, 0, 10, 255); + public static readonly Color SapGreen = new Color32(80, 125, 42, 255); + public static readonly Color Sapphire = new Color32(15, 82, 186, 255); + public static readonly Color SasquatchSocks = new Color32(255, 70, 129, 255); + public static readonly Color SatinSheenGold = new Color32(203, 161, 53, 255); + public static readonly Color Scarlet = new Color32(255, 36, 0, 255); + public static readonly Color Scarlet2 = new Color32(253, 14, 53, 255); + public static readonly Color SchoolBusYellow = new Color32(255, 216, 0, 255); + public static readonly Color ScreaminGreen = new Color32(102, 255, 102, 255); + public static readonly Color SeaBlue = new Color32(0, 105, 148, 255); + public static readonly Color SeaFoamGreen = new Color32(195, 226, 191, 255); + public static readonly Color SeaGreen = new Color32(46, 139, 87, 255); + public static readonly Color SeaGreenCrayola = new Color32(1, 255, 205, 255); + public static readonly Color SeaSerpent = new Color32(75, 199, 207, 255); + public static readonly Color SealBrown = new Color32(50, 20, 20, 255); + public static readonly Color Seashell = new Color32(255, 245, 238, 255); + public static readonly Color SelectiveYellow = new Color32(255, 186, 0, 255); + public static readonly Color Sepia = new Color32(112, 66, 20, 255); + public static readonly Color Shadow = new Color32(138, 121, 93, 255); + public static readonly Color ShadowBlue = new Color32(119, 139, 165, 255); + public static readonly Color Shampoo = new Color32(255, 207, 241, 255); + public static readonly Color ShamrockGreen = new Color32(0, 158, 96, 255); + public static readonly Color SheenGreen = new Color32(143, 212, 0, 255); + public static readonly Color ShimmeringBlush = new Color32(217, 134, 149, 255); + public static readonly Color ShinyShamrock = new Color32(95, 167, 120, 255); + public static readonly Color ShockingPink = new Color32(252, 15, 192, 255); + public static readonly Color ShockingPinkCrayola = new Color32(255, 111, 255, 255); + public static readonly Color Silver = new Color32(192, 192, 192, 255); + public static readonly Color SilverMetallic = new Color32(170, 169, 173, 255); + public static readonly Color SilverChalice = new Color32(172, 172, 172, 255); + public static readonly Color SilverFoil = new Color32(175, 177, 174, 255); + public static readonly Color SilverLakeBlue = new Color32(93, 137, 186, 255); + public static readonly Color SilverPink = new Color32(196, 174, 173, 255); + public static readonly Color SilverSand = new Color32(191, 193, 194, 255); + public static readonly Color Sinopia = new Color32(203, 65, 11, 255); + public static readonly Color SizzlingRed = new Color32(255, 56, 85, 255); + public static readonly Color SizzlingSunrise = new Color32(255, 219, 0, 255); + public static readonly Color Skobeloff = new Color32(0, 116, 116, 255); + public static readonly Color SkyBlue = new Color32(135, 206, 235, 255); + public static readonly Color SkyBlueCrayola = new Color32(118, 215, 234, 255); + public static readonly Color SkyMagenta = new Color32(207, 113, 175, 255); + public static readonly Color SlateBlue = new Color32(106, 90, 205, 255); + public static readonly Color SlateGray = new Color32(112, 128, 144, 255); + public static readonly Color SlimyGreen = new Color32(41, 150, 23, 255); + public static readonly Color SmashedPumpkin = new Color32(255, 109, 58, 255); + public static readonly Color Smitten = new Color32(200, 65, 134, 255); + public static readonly Color Smoke = new Color32(115, 130, 118, 255); + public static readonly Color SmokeyTopaz = new Color32(131, 42, 34, 255); + public static readonly Color SmokyBlack = new Color32(16, 12, 8, 255); + public static readonly Color SmokyTopaz = new Color32(147, 61, 65, 255); + public static readonly Color Snow = new Color32(255, 250, 250, 255); + public static readonly Color Soap = new Color32(206, 200, 239, 255); + public static readonly Color SoldierGreen = new Color32(84, 90, 44, 255); + public static readonly Color SolidPink = new Color32(137, 56, 67, 255); + public static readonly Color SonicSilver = new Color32(117, 117, 117, 255); + public static readonly Color SpartanCrimson = new Color32(158, 19, 22, 255); + public static readonly Color SpaceCadet = new Color32(29, 41, 81, 255); + public static readonly Color SpanishBistre = new Color32(128, 117, 50, 255); + public static readonly Color SpanishBlue = new Color32(0, 112, 184, 255); + public static readonly Color SpanishCarmine = new Color32(209, 0, 71, 255); + public static readonly Color SpanishCrimson = new Color32(229, 26, 76, 255); + public static readonly Color SpanishGray = new Color32(152, 152, 152, 255); + public static readonly Color SpanishGreen = new Color32(0, 145, 80, 255); + public static readonly Color SpanishOrange = new Color32(232, 97, 0, 255); + public static readonly Color SpanishPink = new Color32(247, 191, 190, 255); + public static readonly Color SpanishPurple = new Color32(102, 3, 60, 255); + public static readonly Color SpanishRed = new Color32(230, 0, 38, 255); + public static readonly Color SpanishViolet = new Color32(76, 40, 130, 255); + public static readonly Color SpanishViridian = new Color32(0, 127, 92, 255); + public static readonly Color SpanishYellow = new Color32(246, 181, 17, 255); + public static readonly Color SpicyMix = new Color32(139, 95, 77, 255); + public static readonly Color SpiroDiscoBall = new Color32(15, 192, 252, 255); + public static readonly Color SpringBud = new Color32(167, 252, 0, 255); + public static readonly Color SpringFrost = new Color32(135, 255, 42, 255); + public static readonly Color StarCommandBlue = new Color32(0, 123, 184, 255); + public static readonly Color SteelBlue = new Color32(70, 130, 180, 255); + public static readonly Color SteelPink = new Color32(204, 51, 204, 255); + public static readonly Color SteelTeal = new Color32(95, 138, 139, 255); + public static readonly Color Stormcloud = new Color32(79, 102, 106, 255); + public static readonly Color Straw = new Color32(228, 217, 111, 255); + public static readonly Color Strawberry = new Color32(252, 90, 141, 255); + public static readonly Color SugarPlum = new Color32(145, 78, 117, 255); + public static readonly Color SunburntCyclops = new Color32(255, 64, 76, 255); + public static readonly Color Sunglow = new Color32(255, 204, 51, 255); + public static readonly Color Sunny = new Color32(242, 242, 122, 255); + public static readonly Color Sunray = new Color32(227, 171, 87, 255); + public static readonly Color SunsetOrange = new Color32(253, 94, 83, 255); + public static readonly Color SuperPink = new Color32(207, 107, 169, 255); + public static readonly Color SweetBrown = new Color32(168, 55, 49, 255); + public static readonly Color Tan = new Color32(210, 180, 140, 255); + public static readonly Color Tangelo = new Color32(249, 77, 0, 255); + public static readonly Color Tangerine = new Color32(242, 133, 0, 255); + public static readonly Color TartOrange = new Color32(251, 77, 70, 255); + public static readonly Color TaupeGray = new Color32(139, 133, 137, 255); + public static readonly Color TeaGreen = new Color32(208, 240, 192, 255); + public static readonly Color Teal = new Color32(0, 128, 128, 255); + public static readonly Color TealBlue = new Color32(54, 117, 136, 255); + public static readonly Color TealDeer = new Color32(153, 230, 179, 255); + public static readonly Color TealGreen = new Color32(0, 130, 127, 255); + public static readonly Color Telemagenta = new Color32(207, 52, 118, 255); + public static readonly Color Temptress = new Color32(60, 33, 38, 255); + public static readonly Color TennéTawny = new Color32(205, 87, 0, 255); + public static readonly Color TerraCotta = new Color32(226, 114, 91, 255); + public static readonly Color Thistle = new Color32(216, 191, 216, 255); + public static readonly Color TickleMePink = new Color32(252, 137, 172, 255); + public static readonly Color TiffanyBlue = new Color32(10, 186, 181, 255); + public static readonly Color TigersEye = new Color32(224, 141, 60, 255); + public static readonly Color Timberwolf = new Color32(219, 215, 210, 255); + public static readonly Color Titanium = new Color32(135, 134, 129, 255); + public static readonly Color TitaniumYellow = new Color32(238, 230, 0, 255); + public static readonly Color Tomato = new Color32(255, 99, 71, 255); + public static readonly Color Toolbox = new Color32(116, 108, 192, 255); + public static readonly Color Topaz = new Color32(255, 200, 124, 255); + public static readonly Color TropicalRainForest = new Color32(0, 117, 94, 255); + public static readonly Color TropicalViolet = new Color32(205, 164, 222, 255); + public static readonly Color TrueBlue = new Color32(0, 115, 207, 255); + public static readonly Color TuftsBlue = new Color32(62, 142, 222, 255); + public static readonly Color Tulip = new Color32(255, 135, 141, 255); + public static readonly Color Tumbleweed = new Color32(222, 170, 136, 255); + public static readonly Color TurkishRose = new Color32(181, 114, 129, 255); + public static readonly Color Turquoise = new Color32(64, 224, 208, 255); + public static readonly Color TurquoiseBlue = new Color32(0, 255, 239, 255); + public static readonly Color TurquoiseGreen = new Color32(160, 214, 180, 255); + public static readonly Color TurquoiseSurf = new Color32(0, 197, 205, 255); + public static readonly Color TuscanRed = new Color32(124, 72, 72, 255); + public static readonly Color Tuscany = new Color32(192, 153, 153, 255); + public static readonly Color TwilightLavender = new Color32(138, 73, 107, 255); + public static readonly Color UABlue = new Color32(0, 51, 170, 255); + public static readonly Color UARed = new Color32(217, 0, 76, 255); + public static readonly Color Ube = new Color32(136, 120, 195, 255); + public static readonly Color UCLABlue = new Color32(83, 104, 149, 255); + public static readonly Color UCLAGold = new Color32(255, 179, 0, 255); + public static readonly Color UERed = new Color32(186, 0, 1, 255); + public static readonly Color UFOGreen = new Color32(60, 208, 112, 255); + public static readonly Color Ultramarine = new Color32(18, 10, 143, 255); + public static readonly Color UltramarineBlue = new Color32(65, 102, 245, 255); + public static readonly Color UltraRed = new Color32(252, 108, 133, 255); + public static readonly Color Umber = new Color32(99, 81, 71, 255); + public static readonly Color UnbleachedSilk = new Color32(255, 221, 202, 255); + public static readonly Color UnitedNationsBlue = new Color32(91, 146, 229, 255); + public static readonly Color UniversityOfCaliforniaGold = new Color32(183, 135, 39, 255); + public static readonly Color UniversityOfTennesseeOrange = new Color32(247, 127, 0, 255); + public static readonly Color UPMaroon = new Color32(123, 17, 19, 255); + public static readonly Color UpsdellRed = new Color32(174, 32, 41, 255); + public static readonly Color Urobilin = new Color32(225, 173, 33, 255); + public static readonly Color USAFABlue = new Color32(0, 79, 152, 255); + public static readonly Color UtahCrimson = new Color32(211, 0, 63, 255); + public static readonly Color VampireBlack = new Color32(8, 8, 8, 255); + public static readonly Color VanDykeBrown = new Color32(102, 66, 40, 255); + public static readonly Color VanillaIce = new Color32(243, 143, 169, 255); + public static readonly Color VegasGold = new Color32(197, 179, 88, 255); + public static readonly Color VenetianRed = new Color32(200, 8, 21, 255); + public static readonly Color Verdigris = new Color32(67, 179, 174, 255); + public static readonly Color Vermilion = new Color32(217, 56, 30, 255); + public static readonly Color VerseGreen = new Color32(24, 136, 13, 255); + public static readonly Color VeryLightAzure = new Color32(116, 187, 251, 255); + public static readonly Color VeryLightBlue = new Color32(102, 102, 255, 255); + public static readonly Color VeryLightMalachiteGreen = new Color32(100, 233, 134, 255); + public static readonly Color VeryLightTangelo = new Color32(255, 176, 119, 255); + public static readonly Color VeryPaleOrange = new Color32(255, 223, 191, 255); + public static readonly Color VeryPaleYellow = new Color32(255, 255, 191, 255); + public static readonly Color VioletColorWheel = new Color32(127, 0, 255, 255); + public static readonly Color VioletCrayola = new Color32(150, 61, 127, 255); + public static readonly Color VioletRYB = new Color32(134, 1, 175, 255); + public static readonly Color VioletBlue = new Color32(50, 74, 178, 255); + public static readonly Color VioletRed = new Color32(247, 83, 148, 255); + public static readonly Color ViolinBrown = new Color32(103, 68, 3, 255); + public static readonly Color ViridianGreen = new Color32(0, 150, 152, 255); + public static readonly Color VistaBlue = new Color32(124, 158, 217, 255); + public static readonly Color VividAuburn = new Color32(146, 39, 36, 255); + public static readonly Color VividBurgundy = new Color32(159, 29, 53, 255); + public static readonly Color VividCerise = new Color32(218, 29, 129, 255); + public static readonly Color VividCerulean = new Color32(0, 170, 238, 255); + public static readonly Color VividCrimson = new Color32(204, 0, 51, 255); + public static readonly Color VividGamboge = new Color32(255, 153, 0, 255); + public static readonly Color VividLimeGreen = new Color32(166, 214, 8, 255); + public static readonly Color VividMalachite = new Color32(0, 204, 51, 255); + public static readonly Color VividMulberry = new Color32(184, 12, 227, 255); + public static readonly Color VividOrange = new Color32(255, 95, 0, 255); + public static readonly Color VividOrangePeel = new Color32(255, 160, 0, 255); + public static readonly Color VividOrchid = new Color32(204, 0, 255, 255); + public static readonly Color VividRaspberry = new Color32(255, 0, 108, 255); + public static readonly Color VividRed = new Color32(247, 13, 26, 255); + public static readonly Color VividRedTangelo = new Color32(223, 97, 36, 255); + public static readonly Color VividSkyBlue = new Color32(0, 204, 255, 255); + public static readonly Color VividTangelo = new Color32(240, 116, 39, 255); + public static readonly Color VividTangerine = new Color32(255, 160, 137, 255); + public static readonly Color VividVermilion = new Color32(229, 96, 36, 255); + public static readonly Color VividViolet = new Color32(159, 0, 255, 255); + public static readonly Color VividYellow = new Color32(255, 227, 2, 255); + public static readonly Color Volt = new Color32(205, 255, 0, 255); + public static readonly Color WageningenGreen = new Color32(52, 178, 51, 255); + public static readonly Color WarmBlack = new Color32(0, 66, 66, 255); + public static readonly Color Watermelon = new Color32(240, 92, 133, 255); + public static readonly Color WatermelonRed = new Color32(190, 65, 71, 255); + public static readonly Color Waterspout = new Color32(164, 244, 249, 255); + public static readonly Color WeldonBlue = new Color32(124, 152, 171, 255); + public static readonly Color Wenge = new Color32(100, 84, 82, 255); + public static readonly Color Wheat = new Color32(245, 222, 179, 255); + public static readonly Color White = new Color32(255, 255, 255, 255); + public static readonly Color WhiteChocolate = new Color32(237, 230, 214, 255); + public static readonly Color WhiteCoffee = new Color32(230, 224, 212, 255); + public static readonly Color WildBlueYonder = new Color32(162, 173, 208, 255); + public static readonly Color WildOrchid = new Color32(212, 112, 162, 255); + public static readonly Color WildStrawberry = new Color32(255, 67, 164, 255); + public static readonly Color WillpowerOrange = new Color32(253, 88, 0, 255); + public static readonly Color WindsorTan = new Color32(167, 85, 2, 255); + public static readonly Color WineRed = new Color32(177, 18, 38, 255); + public static readonly Color WinterSky = new Color32(255, 0, 124, 255); + public static readonly Color WinterWizard = new Color32(160, 230, 255, 255); + public static readonly Color WintergreenDream = new Color32(86, 136, 125, 255); + public static readonly Color Wisteria = new Color32(201, 160, 220, 255); + public static readonly Color Xanadu = new Color32(115, 134, 120, 255); + public static readonly Color YaleBlue = new Color32(15, 77, 146, 255); + public static readonly Color YankeesBlue = new Color32(28, 40, 65, 255); + public static readonly Color Yellow = new Color32(255, 255, 0, 255); + public static readonly Color YellowCrayola = new Color32(252, 232, 131, 255); + public static readonly Color YellowMunsell = new Color32(239, 204, 0, 255); + public static readonly Color YellowPantone = new Color32(254, 223, 0, 255); + public static readonly Color YellowRYB = new Color32(254, 254, 51, 255); + public static readonly Color YellowGreen = new Color32(154, 205, 50, 255); + public static readonly Color YellowOrange = new Color32(255, 174, 66, 255); + public static readonly Color YellowRose = new Color32(255, 240, 0, 255); + public static readonly Color Zaffre = new Color32(0, 20, 168, 255); + public static readonly Color ZinnwalditeBrown = new Color32(44, 22, 8, 255); + public static readonly Color Zomp = new Color32(57, 167, 142, 255); + + } +#pragma warning restore CS3003 +} diff --git a/Runtime/Scripts/Extensions/Color/Colors.cs.meta b/Runtime/Scripts/Extensions/Color/Colors.cs.meta new file mode 100644 index 0000000..f03181a --- /dev/null +++ b/Runtime/Scripts/Extensions/Color/Colors.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0b45e7da69174ce6bfb766ce79cdd76a +timeCreated: 1649209399 \ No newline at end of file diff --git a/Runtime/Scripts/Extensions/Color/GetColor.cs b/Runtime/Scripts/Extensions/Color/GetColor.cs new file mode 100644 index 0000000..6e8f526 --- /dev/null +++ b/Runtime/Scripts/Extensions/Color/GetColor.cs @@ -0,0 +1,54 @@ +// using System; +// using System.Globalization; +// using UnityEngine; +// +// #if !USING_EATK +// namespace instance.id.EATK.Extensions +// { +// // public static class GetColor +// // { +// // /// +// // /// Converts a hexadecimal color string to a Unity RGBA Color value +// // /// +// // /// var color = GetColor.FromHex("#CCCCCC"); +// // /// The string parameter must be a hexadecimal string, can beginning with # +// // /// Returns a Unity Color parameter converted from a HTML/hexadecimal color string +// // /// The string parameter must be a hexadecimal string beginning with # +// // public static Color FromHex(this string color) +// // { +// // if (color.StartsWith("#")) color = color.Replace("#", ""); +// // if (Int32.TryParse(color, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out _)) +// // if (!color.StartsWith("#")) +// // color = $"#{color}"; +// // +// // ColorUtility.TryParseHtmlString(color, out var outColor); +// // return outColor; +// // } +// // } +// // } +// +// #else +// namespace instance.id.Extensions +// { +// internal static class GetColor +// { +// /// +// /// Converts a hexadecimal color string to a Unity RGBA Color value +// /// +// /// var color = GetColor.FromHex("#CCCCCC"); +// /// The string parameter must be a hexadecimal string, can beginning with # +// /// Returns a Unity Color parameter converted from a HTML/hexadecimal color string +// /// The string parameter must be a hexadecimal string beginning with # +// public static Color FromHex(this string color) +// { +// if (color.StartsWith("#")) color = color.Replace("#", ""); +// if (Int32.TryParse(color, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out _)) +// if (!color.StartsWith("#")) +// color = $"#{color}"; +// +// ColorUtility.TryParseHtmlString(color, out var outColor); +// return outColor; +// } +// } +// } +// #endif diff --git a/Runtime/Scripts/Extensions/Color/GetColor.cs.meta b/Runtime/Scripts/Extensions/Color/GetColor.cs.meta new file mode 100644 index 0000000..d997a74 --- /dev/null +++ b/Runtime/Scripts/Extensions/Color/GetColor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d0e5bf698dbf4098a0cf4cadbda39f7f +timeCreated: 1649209399 \ No newline at end of file diff --git a/Runtime/Scripts/Extensions/Color/MathEx.cs b/Runtime/Scripts/Extensions/Color/MathEx.cs new file mode 100644 index 0000000..d89e5f2 --- /dev/null +++ b/Runtime/Scripts/Extensions/Color/MathEx.cs @@ -0,0 +1,124 @@ +using System; + +namespace instance.id.EATK.Extensions +{ + public static class MathEx + { + public static int Clamp(int v, int min, int max) + { + return (v < min) ? min : ((v > max) ? max : v); + } + + public static float Clamp01(float v) + { + return (v < 0f) ? 0f : ((v > 1f) ? 1f : v); + } + + public static double Clamp01(double v) + { + return (v < 0.0) ? 0.0 : ((v > 1.0) ? 1.0 : v); + } + + public static float Clamp(float v, float min, float max) + { + return (v < min) ? min : ((v > max) ? max : v); + } + + public static double Clamp(double v, double min, double max) + { + return (v < min) ? min : ((v > max) ? max : v); + } + + public static float Lerp(float from, float to, float t) + { + return from + (to - from) * MathEx.Clamp01(t); + } + + public static double Lerp(double from, double to, double t) + { + return from + (to - from) * MathEx.Clamp01(t); + } + + public static float Repeat(float t, float length) + { + return t - (float)Math.Floor((double)(t / length)) * length; + } + + public static double Repeat(double t, double length) + { + return t - Math.Floor(t / length) * length; + } + + public static float LerpAngle(float a, float b, float t) + { + float num = MathEx.Repeat(b - a, 360f); + bool flag = num <= 180f; + if (!flag) + { + num -= 360f; + } + return a + num * MathEx.Clamp01(t); + } + + public static double LerpAngle(double a, double b, double t) + { + double num = MathEx.Repeat(b - a, 360.0); + bool flag = num <= 180.0; + if (!flag) + { + num -= 360.0; + } + return a + num * MathEx.Clamp01(t); + } + + public static float Distance(float a, float b) + { + return Math.Abs(a - b); + } + + public static double Distance(double a, double b) + { + return Math.Abs(a - b); + } + + public static int IsRange(float value, float min, float max) + { + return (value < min) ? -1 : ((value > max) ? 1 : 0); + } + + public static int IsRange(double value, double min, double max) + { + return (value < min) ? -1 : ((value > max) ? 1 : 0); + } + + public static float Max(float a, float b) + { + return (a <= b) ? b : a; + } + + public static double Max(double a, double b) + { + return (a <= b) ? b : a; + } + + public static float Min(float a, float b) + { + return (a <= b) ? a : b; + } + + public static double Min(double a, double b) + { + return (a <= b) ? a : b; + } + + public static bool Approximately(float a, float b) + { + return Math.Abs(b - a) < MathEx.Max(1E-06f * MathEx.Max(Math.Abs(a), Math.Abs(b)), 1.1E-44f); + } + + public static bool Approximately(double a, double b) + { + return Math.Abs(b - a) < MathEx.Max(1E-06 * MathEx.Max(Math.Abs(a), Math.Abs(b)), 1.121039E-44); + } + } +} diff --git a/Runtime/Scripts/Extensions/Color/MathEx.cs.meta b/Runtime/Scripts/Extensions/Color/MathEx.cs.meta new file mode 100644 index 0000000..7970033 --- /dev/null +++ b/Runtime/Scripts/Extensions/Color/MathEx.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f83cea8d4b284726bcc6ef7a061e606e +timeCreated: 1649209399 \ No newline at end of file diff --git a/Runtime/Scripts/Extensions/DataTypes/ClassData.cs b/Runtime/Scripts/Extensions/DataTypes/ClassData.cs index 4682198..ffbd362 100644 --- a/Runtime/Scripts/Extensions/DataTypes/ClassData.cs +++ b/Runtime/Scripts/Extensions/DataTypes/ClassData.cs @@ -5,12 +5,19 @@ namespace instance.id.EATK.Extensions { [Serializable] - public class ClassData where T : Attribute , new() + public class ClassData : ClassData where T : Attribute, new() { - [SerializeField] public string typeName; [SerializeField] public List fieldList = new List(); public Dictionary> fieldDatas = new Dictionary>(); + public ClassData(Type type) : base(type) { } + } + + [Serializable] + public class ClassData + { + [SerializeField] public string typeName; + public Dictionary fieldDatas = new Dictionary(); public ClassData(Type type) => typeName = type.Name; } } diff --git a/Runtime/Scripts/Extensions/DataTypes/FieldData.cs b/Runtime/Scripts/Extensions/DataTypes/FieldData.cs index f911f33..6f9c679 100644 --- a/Runtime/Scripts/Extensions/DataTypes/FieldData.cs +++ b/Runtime/Scripts/Extensions/DataTypes/FieldData.cs @@ -6,18 +6,40 @@ namespace instance.id.EATK.Extensions { - [Serializable] - public class FieldData where T : Attribute, new() + public class FieldData : FieldData where T : Attribute, new() + { + [SerializeField] public T attributeData; + + public FieldData(FieldInfo fieldInfo) : base(fieldInfo) + { + CheckForAttributes(fieldInfo); + } + + public FieldData() : base() + { + CheckForAttributes(fieldInfo); + } + + private void CheckForAttributes(FieldInfo fieldInfo) + { + var catAttrib = (T)Attribute.GetCustomAttribute(fieldInfo ?? throw new ArgumentNullException(nameof(fieldInfo)), typeof(T)); + attributeData = catAttrib ?? new T(); + } + } + + [Serializable] + public class FieldData { public Type fieldType; public FieldInfo fieldInfo; - [SerializeField] public T attributeData; [SerializeField] public string name; [SerializeField] public string fieldTypeString; [SerializeField] public List fieldTypeParametersString; [SerializeField] public List fieldTypeParameters; + public FieldData() { } + public FieldData(FieldInfo fieldInfo) { this.fieldInfo = fieldInfo; @@ -33,14 +55,6 @@ public FieldData(FieldInfo fieldInfo) .GetGenericArguments() .Select(x => x.Name.ToString()) .ToList(); - - CheckForAttributes(fieldInfo); - } - - private void CheckForAttributes(FieldInfo fieldInfo) - { - var catAttrib = (T) Attribute.GetCustomAttribute(fieldInfo ?? throw new ArgumentNullException(nameof(fieldInfo)), typeof(T)); - attributeData = catAttrib ?? new T(); } } } diff --git a/Runtime/Scripts/Extensions/DataTypes/ListPool.cs b/Runtime/Scripts/Extensions/DataTypes/ListPool.cs new file mode 100644 index 0000000..ded55c0 --- /dev/null +++ b/Runtime/Scripts/Extensions/DataTypes/ListPool.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; + +namespace instance.id.EATK.Extensions +{ + public static class ListPool + { + private static readonly object @lock = new object(); + private static readonly Stack> free = new Stack>(); + private static readonly HashSet> busy = new HashSet>(); + + public static List New() + { + lock (@lock) + { + if (free.Count == 0) + { + free.Push(new List()); + } + + var list = free.Pop(); + + busy.Add(list); + + return list; + } + } + + public static void Free(List list) + { + lock (@lock) + { + if (!busy.Remove(list)) + { + throw new ArgumentException("The list to free is not in use by the pool.", nameof(list)); + } + + list.Clear(); + + free.Push(list); + } + } + } + + public static class XListPool + { + public static List ToListPooled(this IEnumerable source) + { + var list = ListPool.New(); + + foreach (var item in source) + { + list.Add(item); + } + + return list; + } + + public static void Free(this List list) + { + ListPool.Free(list); + } + } +} diff --git a/Runtime/Scripts/Extensions/DataTypes/ListPool.cs.meta b/Runtime/Scripts/Extensions/DataTypes/ListPool.cs.meta new file mode 100644 index 0000000..0cf2780 --- /dev/null +++ b/Runtime/Scripts/Extensions/DataTypes/ListPool.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: acf2ea081c624d7085363db9c33dc6c8 +timeCreated: 1648266079 \ No newline at end of file diff --git a/Runtime/Scripts/Extensions/ElementGeneration/ContainerData.cs b/Runtime/Scripts/Extensions/ElementGeneration/ContainerData.cs index 0544bd8..3613926 100644 --- a/Runtime/Scripts/Extensions/ElementGeneration/ContainerData.cs +++ b/Runtime/Scripts/Extensions/ElementGeneration/ContainerData.cs @@ -2,6 +2,9 @@ namespace instance.id.EATK.Extensions { + /// + /// Contains the objects needed to generate editor window elements + /// public class ContainerData { public ContainerStyle containerType; diff --git a/Runtime/Scripts/Extensions/ElementGeneration/ContainerStyle.cs b/Runtime/Scripts/Extensions/ElementGeneration/ContainerStyle.cs index 6df8406..eebc424 100644 --- a/Runtime/Scripts/Extensions/ElementGeneration/ContainerStyle.cs +++ b/Runtime/Scripts/Extensions/ElementGeneration/ContainerStyle.cs @@ -1,5 +1,8 @@ namespace instance.id.EATK.Extensions { + /// + /// The type of container to use as a parent element when generating editor elements + /// public enum ContainerStyle { AnimatedFoldout, diff --git a/Runtime/Scripts/Extensions/ElementGeneration/ElementGeneration.cs b/Runtime/Scripts/Extensions/ElementGeneration/ElementGeneration.cs index 93ac987..50c7e48 100644 --- a/Runtime/Scripts/Extensions/ElementGeneration/ElementGeneration.cs +++ b/Runtime/Scripts/Extensions/ElementGeneration/ElementGeneration.cs @@ -1,3 +1,4 @@ +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.Linq; @@ -7,6 +8,7 @@ using Vector2 = UnityEngine.Vector2; using Vector3 = UnityEngine.Vector3; using Vector4 = UnityEngine.Vector4; +using UnityObject = UnityEngine.Object; namespace instance.id.EATK.Extensions { @@ -29,8 +31,7 @@ public static VisualElement GenerateElements(this T classData, float labelMin Dictionary uniqueContainers = new Dictionary(); var attributes = classData.GetEditorAttributes(); - - + foreach (var v in attributes.fieldDatas) { var data = v.Value.attributeData.container; @@ -42,16 +43,16 @@ public static VisualElement GenerateElements(this T classData, float labelMin switch (data.containerType) { case ContainerStyle.AnimatedFoldout: - containers.TryAddValue((data.containerId, data.containerName), CreateAnimatedFoldout(data)); - containerTypes.TryAddValue(typeof(AnimatedFoldout), containers[(data.containerId, data.containerName)]); + containers.TryAdd((data.containerId, data.containerName), CreateAnimatedFoldout(data)); + containerTypes.TryAdd(typeof(AnimatedFoldout), containers[(data.containerId, data.containerName)]); break; case ContainerStyle.Foldout: - containers.TryAddValue((data.containerId, data.containerName), CreateFoldout(data)); - containerTypes.TryAddValue(typeof(Foldout), containers[(data.containerId, data.containerName)]); + containers.TryAdd((data.containerId, data.containerName), CreateFoldout(data)); + containerTypes.TryAdd(typeof(Foldout), containers[(data.containerId, data.containerName)]); break; case ContainerStyle.Box: - containers.TryAddValue((data.containerId, data.containerName), CreateBox(data)); - containerTypes.TryAddValue(typeof(Box), containers[(data.containerId, data.containerName)]); + containers.TryAdd((data.containerId, data.containerName), CreateBox(data)); + containerTypes.TryAdd(typeof(Box), containers[(data.containerId, data.containerName)]); break; default: throw new ArgumentOutOfRangeException(); @@ -70,8 +71,8 @@ public static VisualElement GenerateElements(this T classData, float labelMin .SetParent(parent.Value); } - containers.ForEach(x => { generatedElements.Add(x.Value); }); - containerTypes.ForEach(x => + containers.forEach(x => { generatedElements.Add(x.Value); }); + containerTypes.forEach(x => { if (x.Key == typeof(AnimatedFoldout)) generatedElements.Query() @@ -128,6 +129,9 @@ private static VisualElement DetermineType(FieldData field case Type t when t == typeof(Color): return new ColorField { value = (Color)value, style = { flexGrow = 1 } } .RegisterValueCallback>(evt => fieldData.fieldInfo.SetValue(classData, evt.newValue)); + // case Type t when value.GetType().IsDerivingFrom() + // return new ObjectField { value = (UnityObject)value, style = { flexGrow = 1 } } + // .RegisterValueCallback>(evt => fieldData.fieldInfo.SetValue(classData, evt.newValue)); case Type t when t.IsEnum: var e = new EnumField() { style = { flexGrow = 1 } }; e.Init((System.Enum)fieldData.fieldInfo.GetValue(classData)); @@ -143,3 +147,4 @@ private static VisualElement DetermineType(FieldData field } } } +#endif diff --git a/Runtime/Scripts/Extensions/ReflectionExtensions.cs b/Runtime/Scripts/Extensions/ReflectionExten.cs similarity index 87% rename from Runtime/Scripts/Extensions/ReflectionExtensions.cs rename to Runtime/Scripts/Extensions/ReflectionExten.cs index d1200f9..7bd7d45 100644 --- a/Runtime/Scripts/Extensions/ReflectionExtensions.cs +++ b/Runtime/Scripts/Extensions/ReflectionExten.cs @@ -6,7 +6,7 @@ namespace instance.id.EATK.Extensions { - public static class ReflectionExtensions + public static class ReflectionExten { /// /// Get attributes from a class @@ -24,8 +24,8 @@ public static class ReflectionExtensions foreach (var field in thisType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { if (!(field.GetCustomAttributes(typeof(T), true).FirstOrDefault() is T att)) continue; - classData.fieldDatas.TryAddValue(field.Name, new FieldData(field)); - classData.fieldList.TryAddValue(classData.fieldDatas[field.Name].attributeData); + classData.fieldDatas.TryAdd(field.Name, new FieldData(field)); + classData.fieldList.TryAdd(classData.fieldDatas[field.Name].attributeData); } } catch (Exception e) { Debug.LogException(e); } diff --git a/Runtime/Scripts/Extensions/ReflectionExtensions.cs.meta b/Runtime/Scripts/Extensions/ReflectionExten.cs.meta similarity index 100% rename from Runtime/Scripts/Extensions/ReflectionExtensions.cs.meta rename to Runtime/Scripts/Extensions/ReflectionExten.cs.meta diff --git a/Runtime/Scripts/Extensions/VisualElementExtension.cs b/Runtime/Scripts/Extensions/VisualElementExtension.cs index 052c82d..206c5b3 100644 --- a/Runtime/Scripts/Extensions/VisualElementExtension.cs +++ b/Runtime/Scripts/Extensions/VisualElementExtension.cs @@ -5,17 +5,26 @@ #if UNITY_EDITOR using System; -using System.Collections.Generic; using System.Linq; -using System.Numerics; +using System.Collections; +using System.Collections.Generic; using UnityEngine; -using UnityEngine.UIElements; using UnityEditor; +using UnityEngine.UIElements; using UnityEditor.UIElements; -using Quaternion = UnityEngine.Quaternion; using Vector2 = UnityEngine.Vector2; using Vector3 = UnityEngine.Vector3; using Vector4 = UnityEngine.Vector4; +using UnityObject = UnityEngine.Object; +using Quaternion = UnityEngine.Quaternion; + +#if USING_HYBRID +using Unity.Entities; +#endif + +#if USING_ADDRESSABLES +using UnityEngine.AddressableAssets; +#endif namespace instance.id.EATK.Extensions { @@ -30,7 +39,6 @@ public static class VisualElementExtension private static StyleEnum directionCol = new StyleEnum(FlexDirection.Column); #region General VisualElement - public enum ContainerType { Row, @@ -52,11 +60,51 @@ public static VisualElement CreateEnumField(this T enumField, Action onCha #endif public static TextField CreateTextField(this TextField textField, EventCallback> evt = null, string label = null) { - textField = new TextField { label = label }; + textField = new TextField {label = label}; if (evt != null) textField.RegisterCallback(evt); return textField; } + + #region Build Visual Elements + // --| BuildRoot --------------------------------------- + public static T Root(this T element, out VisualElement variable, StyleSheet styleSheet = default, string name = null, params StyleSheet[] stylesheets) + where T : VisualElement + { + if (name != null) element.name = name; + else element.name = "inspectorRoot"; + element.AddToClassList(element.name); + element.styleSheets.Add(styleSheet); + + if (stylesheets.Length != 0) + for (int i = 0; i < stylesheets.Length; i++) + { + element.styleSheets.Add(stylesheets[i]); + } + + return (T) (variable = element); + } + + // --| BuildHeader ------------------------------------- + public static T BuildHeader(this T element, string headerText, string className, string labelClass = null) where T : VisualElement + { + var classString = labelClass ?? className; + return element.Create($"{className}LabelContainer", $"{className}LabelContainer").AddAll(new VisualElement[] + { + new Label(headerText).Create($"{className}Label", $"{classString}Label") + }); + } + + public static T BuildHeader(this T element, out T variable, string headerText, string className, string labelClass = null) where T : VisualElement + { + var classString = labelClass ?? className; + return variable = element.Create($"{className}LabelContainer", $"{className}LabelContainer").AddAll(new VisualElement[] + { + new Label(headerText).Create($"{className}Label", $"{classString}Label") + }); + } + #endregion + // --|--------------------------------------- Containers // --|-------------------------------------------------- /// @@ -66,11 +114,16 @@ public static TextField CreateTextField(this TextField textField, EventCallback< /// The target element to perform this action upon /// Returns the element as an out variable to allow the user of the nameof() function in chained methods /// If a name is specifically passed as a parameter, it will be used, otherwise the target variable name is used + /// Set the content justification setting /// VisualElement - public static T CreateRow(this T element, out T variable, string name = null) where T : VisualElement + public static T CreateRow(this T element, out T variable, string name = null, Justify justification = default) where T : VisualElement { if (name != null) element.name = name; element.style.flexDirection = directionRow; + + if (justification != default) + element.style.justifyContent = justification; + return variable = element; } @@ -109,6 +162,64 @@ public static T Create(this T element, string name = null) where T : VisualEl return element; } + public static T Create(this T element, string name, string className) where T : VisualElement + { + if (name != null) element.name = name; + element.AddToClassList(name); + element.AddToClassList(className); + return element; + } + + public static Image Create(this Image element, UnityObject obj, out Image variable, string name = null) + { + if (name != null) element.name = name; + element.image = TryGetPreview(obj); + return variable = element; + } + + /// + /// Retrieves the child VisualElement from the parent contentContainer at index 1 + /// + /// + /// new EnumField(ExampleEnum.ENUM_VALUE) + /// .CreateWithLabel( + /// out var exampleEnum, + /// labelText: "Example Enum Field: ", + /// labelClass: "labelRow", + /// elementClass: "fieldRow" + /// ).ToUSS(nameof(exampleEnum)); + /// + /// ((EnumField)exampleEnum).GetField().RegisterValueChangedCallback(evt => + /// { + /// Debug.Log($"{((ExampleEnum)evt.newValue).ToString()}"); + /// }); + /// + /// + /// + /// + /// The type in which the element actually is + /// + public static E GetField(this VisualElement element) + where E : VisualElement + { + return (E) element.contentContainer[1]; + } + + public static E GetField(this T element) + where T : VisualElement + where E : VisualElement + { + return (E) element.contentContainer[1]; + } + + public static E GetLabel(this T element) + where T : VisualElement + where E : VisualElement + { + return (E) element.contentContainer[0]; + } + + /// /// Creates the VisualElement and return it as an out variable which can be chained to .ToUSS() /// new VisualElement().Create(out var myElement); @@ -117,8 +228,10 @@ public static T Create(this T element, string name = null) where T : VisualEl /// Returns the element as an out variable to allow the user of the nameof() function in chained methods /// If a name is specifically passed as a parameter, it will be used, otherwise the target variable name is used /// Whether this element should be a row or column + /// The text string for the label to display /// VisualElement - public static VisualElement CreateWithLabel(this T element, out VisualElement variable, string name = null, ContainerType containerType = ContainerType.Row, string labelText = default, float labelMinWidth = default) where T : VisualElement + public static VisualElement CreateWithLabel(this T element, out VisualElement variable, string name = null, ContainerType containerType = ContainerType.Row, string labelText = "", string labelClass = default, float labelMinWidth = default, string elementClass = default) + where T : VisualElement { StyleEnum direction = containerType == ContainerType.Row ? new StyleEnum(FlexDirection.Row) @@ -126,9 +239,17 @@ public static VisualElement CreateWithLabel(this T element, out VisualElement if (name != null) element.name = name; - new VisualElement { style = { flexDirection = direction } }.Create(out var elementContainer).ToUSS($"{element.name}Container", (containerType == ContainerType.Row ? "containerRow" : "containerColumn"), labelText); - if (labelMinWidth != default) new Label { text = labelText, style = { minWidth = labelMinWidth } }.Create().ToUSS($"{element.name}Label").SetParent(elementContainer); - else new Label { text = labelText }.Create().ToUSS($"{element.name}Label").SetParent(elementContainer); + if (labelClass == default) labelClass = $"{element.name}Label"; + if (elementClass != default) element.AddToClassList(elementClass); + + Label label; + + new VisualElement {style = {flexDirection = direction}}.Create(out var elementContainer).ToUSS($"{element.name}Container", (containerType == ContainerType.Row ? "containerRow" : "containerColumn"), labelText); + if (labelMinWidth != default) new Label {text = labelText, style = {minWidth = labelMinWidth}}.Create(out label).ToUSS($"{element.name}Label", labelClass).SetParent(elementContainer); + else new Label {text = labelText}.Create(out label).ToUSS($"{element.name}Label", labelClass).SetParent(elementContainer); + label.style.alignSelf = Align.Center; + label.style.paddingTop = 0; + element.style.alignSelf = Align.Center; element.SetParent(elementContainer); return variable = elementContainer; @@ -144,9 +265,9 @@ public static VisualElement CreateWithLabel(this T element, out VisualEle if (name != null) element.name = name; - new VisualElement { style = { flexDirection = direction } }.Create(out var elementContainer).ToUSS($"{element.name}Container", (containerType == ContainerType.Row ? "containerRow" : "containerColumn"), labelText); - if (labelMinWidth != default) new Label { text = labelText, style = { minWidth = labelMinWidth } }.Create().ToUSS($"{element.name}Label").SetParent(elementContainer); - else new Label { text = labelText }.Create().ToUSS($"{element.name}Label").SetParent(elementContainer); + new VisualElement {style = {flexDirection = direction}}.Create(out var elementContainer).ToUSS($"{element.name}Container", (containerType == ContainerType.Row ? "containerRow" : "containerColumn"), labelText); + if (labelMinWidth != default) new Label {text = labelText, style = {minWidth = labelMinWidth}}.Create().ToUSS($"{element.name}Label").SetParent(elementContainer); + else new Label {text = labelText}.Create().ToUSS($"{element.name}Label").SetParent(elementContainer); if (onValueChanged != null) element.RegisterCallback(onValueChanged); @@ -154,7 +275,94 @@ public static VisualElement CreateWithLabel(this T element, out VisualEle element.SetParent(elementContainer); return variable = elementContainer; } - + + public static VisualElement CreateWithHeader(this T element, out VisualElement variable, string name = null, ContainerType containerType = ContainerType.Column, + string labelText = default, + string labelClass = default, + float labelMinWidth = default, + string elementClass = default, + float headerLabelHeight = default) + where T : VisualElement + { + StyleEnum direction = containerType == ContainerType.Row + ? new StyleEnum(FlexDirection.Row) + : new StyleEnum(FlexDirection.Column); + + if (name != null) element.name = name; + + if (labelClass == default) labelClass = $"{element.name}Label"; + if (elementClass != default) element.AddToClassList(elementClass); + + Label label; + VisualElement elementContainer = new VisualElement(); + bool isBox = false; + if (typeof(T) == typeof(Box)) + { + elementContainer = element; + elementContainer.style.paddingLeft = 10; + elementContainer.style.paddingBottom = 5; + isBox = true; + } + else new VisualElement {style = {flexDirection = direction}}.Create(out elementContainer).ToUSS($"{element.name}Container", (containerType == ContainerType.Row ? "containerRow" : "containerColumn"), labelText); + + if (labelMinWidth != default) new Label {text = labelText, style = {minWidth = labelMinWidth}}.Create(out label).ToUSS($"{element.name}Label", labelClass).SetParent(elementContainer); + else new Label {text = labelText}.Create(out label).ToUSS($"{element.name}Label", labelClass).SetParent(elementContainer); + + var hrColor = Colors.DolphinGray; + hrColor.a = 0.5f; + HR(elementContainer, leftMargin: -4, rightMargin: 5, bottomMargin: 3, thickness: 1, color: hrColor); + label.style.unityFontStyleAndWeight = FontStyle.Bold; + + label.style.alignSelf = Align.FlexStart; + label.style.paddingTop = headerLabelHeight; + label.style.marginLeft = -4; + + if (!isBox) + { + element.style.alignSelf = Align.Center; + element.SetParent(elementContainer); + } + + return variable = elementContainer; + } + + // --| CustomElements ----------------------------- + // --|--------------------------------------------- + public static VisualElement HR(this T element, out VisualElement variable, float topMargin = default, float bottomMargin = default, float leftMargin = default, float rightMargin = default, float allMargins = default, Color color = default, float thickness = default, + VisualElement root = default) + where T : VisualElement + { + new VisualElement().Create(out var horizontalRule).ToUSS(nameof(horizontalRule)); + if (root != default) horizontalRule.SetParent(root); + + if (allMargins != default) topMargin = bottomMargin = leftMargin = rightMargin = allMargins; + if (thickness != default) horizontalRule.style.borderBottomWidth = thickness; + if (topMargin != default) horizontalRule.style.marginTop = topMargin; + if (bottomMargin != default) horizontalRule.style.marginBottom = bottomMargin; + if (leftMargin != default) horizontalRule.style.marginLeft = leftMargin; + if (rightMargin != default) horizontalRule.style.marginRight = rightMargin; + if (color != default) horizontalRule.style.borderBottomColor = color; + + return variable = horizontalRule; + } + + public static VisualElement HR(VisualElement root = default, float topMargin = default, float bottomMargin = default, float leftMargin = default, float rightMargin = default, float allMargins = default, Color color = default, float thickness = default) + { + new VisualElement().Create(out var horizontalRule).ToUSS(nameof(horizontalRule)); + if (root != default) + horizontalRule.SetParent(root); + + if (allMargins != default) topMargin = bottomMargin = leftMargin = rightMargin = allMargins; + if (thickness != default) horizontalRule.style.borderBottomWidth = thickness; + if (topMargin != default) horizontalRule.style.marginTop = topMargin; + if (bottomMargin != default) horizontalRule.style.marginBottom = bottomMargin; + if (leftMargin != default) horizontalRule.style.marginLeft = leftMargin; + if (rightMargin != default) horizontalRule.style.marginRight = rightMargin; + if (color != default) horizontalRule.style.borderBottomColor = color; + + return horizontalRule; + } + /// /// Is elementName is passed, sets the target elements name and USS class to elementName. /// If no parameter is passed, the element USS class is set to the targets current name. @@ -171,7 +379,7 @@ public static T ToUSS(this T element, params string[] elementClassNames) wher { if (elementClassNames != null && element.name != null) { - element.name = elementClassNames[0]; + element.name = elementClassNames.FirstOrDefault(); for (var i = 0; i < elementClassNames.Length; i++) element.AddToClassList(elementClassNames[i]); } @@ -197,16 +405,126 @@ public static void NameAsUSS(this T element, string name = null) where T : Vi public static T RegisterValueCallback(this T element, EventCallback changeEvent) where T : VisualElement where E : EventBase, new() { - ((VisualElement)element).RegisterCallback(changeEvent); + ((VisualElement) element).RegisterCallback(changeEvent); return element; } - + public static T RegisterValueChangeCallback(this T element, EventCallback changeEvent) where T : VisualElement where E : EventBase, new() { - ((VisualElement)element).RegisterCallback(changeEvent); + ((VisualElement) element).RegisterCallback(changeEvent); + return element; + } + + // public static T RegisterValue(this T element, E valueObject, EventCallback> evt = default) + // where T : VisualElement + // where E : UnityObject + // { + // element.value = valueObject; + // element.RegisterValueChangedCallback(evt); + // return element; + // } + + public static T RegisterValue(this T element, TE valueObject, EventCallback> evt = default) + where T : ObjectField + where TE : UnityObject + { + element.value = valueObject; + element.RegisterCallback(evt); + return element; + } + + public static ColorField RegisterValue(this ColorField element, Color valueObject, EventCallback> evt = default) + { + element.value = valueObject; + element.RegisterValueChangedCallback(evt); + return element; + } + + public static Toggle RegisterValue(this Toggle element, bool valueObject, EventCallback> evt = default) + { + element.value = valueObject; + element.RegisterValueChangedCallback(evt); + return element; + } + + + public static Slider RegisterValue(this Slider element, float valueObject, EventCallback> evt = default) + { + element.value = valueObject; + element.RegisterValueChangedCallback(evt); + return element; + } + + public static FloatField RegisterValue(this FloatField element, float valueObject, EventCallback> evt = default) + { + element.value = valueObject; + element.RegisterValueChangedCallback(evt); + return element; + } + + public static IntegerField RegisterValue(this IntegerField element, int valueObject, EventCallback> evt = default) + { + element.value = valueObject; + element.RegisterValueChangedCallback(evt); + return element; + } + + public static TextField RegisterValue(this TextField element, string valueObject, EventCallback> evt = default) + { + element.value = valueObject; + element.RegisterValueChangedCallback(evt); + return element; + } + + public static EnumField RegisterValue(this EnumField element, Enum valueObject, EventCallback> evt = default) + { + element.value = valueObject; + element.RegisterValueChangedCallback(evt); + return element; + } + + public static MinMaxSlider RegisterValue(this MinMaxSlider element, Vector2 valueObject, EventCallback> evt = default) + { + element.value = valueObject; + element.RegisterValueChangedCallback(evt); + return element; + } + + public static LayerMaskField RegisterValue(this LayerMaskField element, LayerMask valueObject, EventCallback> evt = default) + { + element.value = valueObject; + element.RegisterCallback(evt); + return element; + } + + // public static PropertyField RegisterValue(this PropertyField element, string valueObject, EventCallback> evt = default) + // { + // element.value = valueObject; + // element.RegisterCallback(evt); + // return element; + // } + +#if USING_HYBRID + // public static ObjectField RegisterValue(this ObjectField element, GameObjectEntity valueObject, EventCallback> evt = default) + // { + // element.value = valueObject; + // element.RegisterValueChangedCallback(evt); + // + // + // return element; + // } +#endif + +#if USING_ADDRESSABLES + public static ObjectField RegisterValue(this ObjectField element, AssetReference valueObject, EventCallback> evt = default) + { + element.value = valueObject.editorAsset; + element.objectType = valueObject != null ? valueObject.GetType() : default; + element.RegisterValueChangedCallback(evt); return element; } - +#endif + /// /// Convert an object to another type /// @@ -214,7 +532,7 @@ public static void NameAsUSS(this T element, string name = null) where T : Vi /// VisualElement static T Convert(object value) { - return (T)System.Convert.ChangeType(value, typeof(T)); + return (T) System.Convert.ChangeType(value, typeof(T)); } /// @@ -256,9 +574,7 @@ public static V SetParent(this T element, V parent, int index = -1) where return parent; } - #endregion - #endregion public static VisualElement GetFirstAncestorWithClass(this VisualElement element, string className) @@ -287,7 +603,7 @@ public static VisualElement GetFirstAncestorOfType(VisualElement element) /// Current element to search parents. /// Type which you want to find /// Collection of T instances found. - public static IEnumerable GetParentsOfType(this T element, T type = null) where T : VisualElement + public static IEnumerable GetParentsOfType(this VisualElement element, T type = null) where T : VisualElement { Debug.Log($"Type {typeof(T).Name}"); @@ -299,7 +615,7 @@ public static IEnumerable GetParentsOfType(this T element, T type = null) if (parent is T selected) result.Add(selected); - parent = (T)parent.parent; + parent = (VisualElement) (T) parent.parent; } return result; @@ -327,7 +643,7 @@ public static int GetSiblingIndex(this VisualElement element) /// T instance found public static T GetFirstParentOfType(this VisualElement element) where T : VisualElement { - return GetParentsOfType((T)element).FirstOrDefault(); + return GetParentsOfType((T) element).FirstOrDefault(); } public static T GetFirstAncestorOfType(this VisualElement element, Type elementType) where T : VisualElement @@ -460,6 +776,7 @@ public static T OpenURL(this T element, string url) where T : VisualElement /// The amount of time in which to wait before the toggles value is changed. /// Default: 1000ms /// Whether the automatic toggle should be interrupted if the cursor is placed back into the bounds of the target element + /// /// VisualElement public static T AutoToggleAfter(this T element, Toggle toggleTarget, long toggleTimer = 1000, bool interruptible = false, bool autoToggleValue = false) where T : VisualElement @@ -490,10 +807,43 @@ public static T AutoToggleAfter(this T element, Toggle toggleTarget, long tog return element; } + + public static T AutoToggleAfterChange(this T element, Toggle toggleTarget, long toggleTimer = 1000, int maxValue = default, bool interruptible = false, bool autoToggleValue = false) + where T : VisualElement + { + bool interrupter = false; + IVisualElementScheduledItem menuCloser = element.schedule.Execute(() => + { + if (interrupter == false && toggleTarget.value) toggleTarget.value = autoToggleValue; + }); + + Action interruption = delegate(int i) + { + if (i >= maxValue) menuCloser.ExecuteLater(toggleTimer); + }; + + element.RegisterCallback(evt => + { + if (!interruptible) return; + + interrupter = true; + menuCloser?.Pause(); + evt.StopPropagation(); + }); + element.RegisterCallback(evt => + { + interrupter = false; + + if (toggleTarget.value) + menuCloser.ExecuteLater(toggleTimer); + evt.StopPropagation(); + }); + + return element; + } #endregion #region Text Related - public static void SelectRangeDelayed(this TextField textField, int cursorIndex, int selectionIndex) { textField.schedule.Execute(() => @@ -523,16 +873,13 @@ public static (string, string) ApplyPrivacyMask(this string exposedString, int p return (exposedString, tmpString.Aggregate((i, j) => i + j)); } - #endregion #region Style Related - // ---------------------------------------------------------------------------------------- Style Changes #region Style Changes - // ------------------------------------------------ Value adjustments /// /// Sets a float value to 0.0001 instead of true 0 due to issues with opacity bugging out. @@ -540,7 +887,7 @@ public static (string, string) ApplyPrivacyMask(this string exposedString, int p /// The target number in which to adjust value public static float Zero(this int num) { - var tmpNum = (float)num; + var tmpNum = (float) num; tmpNum = 0.0001f; return tmpNum; } @@ -606,6 +953,20 @@ public static void SetBorderWidth(this T element, float borderThickness = 0) element.style.borderTopWidth = borderThickness; } + /// + /// Set the radius value on all sides of the VisualElement + /// + /// The target element to add a border + /// The value in which to set the border radius + /// VisualElement + public static void SetBorderRadius(this T element, float radiusValue = 0) where T : VisualElement + { + element.style.borderTopLeftRadius = radiusValue; + element.style.borderTopRightRadius = radiusValue; + element.style.borderBottomLeftRadius = radiusValue; + element.style.borderBottomRightRadius = radiusValue; + } + /// /// Sets the margin to all sides of the VisualElement /// @@ -683,6 +1044,22 @@ public static T SetDisplay(this T element, bool value) where T : VisualElemen return element; } + public static T[] SetDisplay(this T[] elements, bool value) where T : VisualElement + { + foreach (var e in elements) + { + e.style.display = value ? DisplayStyle.Flex : DisplayStyle.None; + } + + return elements; + } + + public static bool IfDisplay(this T element, bool value) where T : VisualElement + { + element.style.display = value ? DisplayStyle.Flex : DisplayStyle.None; + return value; + } + /// /// Set elements item alignment /// @@ -732,7 +1109,6 @@ public static T SetOpacity(this T element, float opacity = 0) where T : Visua element.style.opacity = opacity; return element; } - #endregion @@ -880,56 +1256,56 @@ public static T FromStyleData(this VisualElementStyleStore source, T target) { var styleValues = new Dictionary { - { nameof(target.style.width), target.style.width = source.Width }, - { nameof(target.style.height), target.style.height = source.Height }, + {nameof(target.style.width), target.style.width = source.Width}, + {nameof(target.style.height), target.style.height = source.Height}, { nameof(target.style.maxWidth), target.style.maxWidth = (source.MaxWidth.value == 0 || source.MaxWidth == StyleKeyword.Null) ? new StyleLength(StyleKeyword.Auto) : source.MaxWidth.value }, - { nameof(target.style.maxHeight), target.style.maxHeight = source.MaxHeight.value == 0 ? new StyleLength(StyleKeyword.Auto) : source.MaxHeight.value }, - { nameof(target.style.minWidth), target.style.minWidth = source.MinWidth.value == 0 ? new StyleLength(StyleKeyword.Auto) : source.MinWidth.value }, - { nameof(target.style.minHeight), target.style.minHeight = source.MinHeight.value == 0 ? new StyleLength(StyleKeyword.Auto) : source.MinHeight.value }, - { nameof(target.style.flexBasis), target.style.flexBasis = source.FlexBasis.value == 0 ? new StyleLength(StyleKeyword.Auto) : source.FlexBasis.value }, - { nameof(target.style.flexGrow), target.style.flexGrow = source.FlexGrow }, - { nameof(target.style.flexShrink), target.style.flexShrink = source.FlexShrink }, - { nameof(target.style.flexDirection), target.style.flexDirection = (FlexDirection)source.FlexDirection.value }, - { nameof(target.style.flexWrap), target.style.flexWrap = (Wrap)source.FlexWrap.value }, - { nameof(target.style.marginLeft), target.style.marginLeft = source.MarginLeft }, - { nameof(target.style.marginTop), target.style.marginTop = source.MarginTop }, - { nameof(target.style.marginRight), target.style.marginRight = source.MarginRight }, - { nameof(target.style.marginBottom), target.style.marginBottom = source.MarginBottom }, - { nameof(target.style.paddingLeft), target.style.paddingLeft = source.PaddingLeft }, - { nameof(target.style.paddingTop), target.style.paddingTop = source.PaddingTop }, - { nameof(target.style.paddingRight), target.style.paddingRight = source.PaddingRight }, - { nameof(target.style.paddingBottom), target.style.paddingBottom = source.PaddingBottom }, - { nameof(target.style.alignSelf), target.style.alignSelf = (Align)source.AlignSelf.value }, - { nameof(target.style.unityTextAlign), target.style.unityTextAlign = (TextAnchor)source.UnityTextAlign.value }, - { nameof(target.style.unityFontStyleAndWeight), target.style.unityFontStyleAndWeight = (FontStyle)source.UnityFontStyleAndWeight.value }, - { nameof(target.style.fontSize), target.style.fontSize = source.FontSize }, - { nameof(target.style.whiteSpace), target.style.whiteSpace = (WhiteSpace)source.WhiteSpace.value }, - { nameof(target.style.color), target.style.color = source.Color }, - { nameof(target.style.backgroundColor), target.style.backgroundColor = source.BackgroundColor }, - { nameof(target.style.unityFont), target.style.unityFont = source.UnityFont }, - { nameof(target.style.unityBackgroundScaleMode), target.style.unityBackgroundScaleMode = (ScaleMode)source.UnityBackgroundScaleMode.value }, - { nameof(target.style.unityBackgroundImageTintColor), target.style.unityBackgroundImageTintColor = source.UnityBackgroundImageTintColor }, - { nameof(target.style.alignItems), target.style.alignItems = (Align)source.AlignItems.value }, - { nameof(target.style.alignContent), target.style.alignContent = (Align)source.AlignContent.value }, - { nameof(target.style.justifyContent), target.style.justifyContent = (Justify)source.JustifyContent.value }, - { nameof(target.style.borderLeftColor), target.style.borderLeftColor = source.BorderLeftColor }, - { nameof(target.style.borderRightColor), target.style.borderRightColor = source.BorderRightColor }, - { nameof(target.style.borderTopColor), target.style.borderTopColor = source.BorderTopColor }, - { nameof(target.style.borderBottomColor), target.style.borderBottomColor = source.BorderBottomColor }, - { nameof(target.style.borderLeftWidth), target.style.borderLeftWidth = source.BorderLeftWidth }, - { nameof(target.style.borderRightWidth), target.style.borderRightWidth = source.BorderRightWidth }, - { nameof(target.style.borderTopWidth), target.style.borderTopWidth = source.BorderTopWidth }, - { nameof(target.style.borderBottomWidth), target.style.borderBottomWidth = source.BorderBottomWidth }, - { nameof(target.style.borderTopLeftRadius), target.style.borderTopLeftRadius = source.BorderTopLeftRadius }, - { nameof(target.style.borderTopRightRadius), target.style.borderTopRightRadius = source.BorderTopRightRadius }, - { nameof(target.style.borderBottomLeftRadius), target.style.borderBottomLeftRadius = source.BorderBottomLeftRadius }, - { nameof(target.style.borderBottomRightRadius), target.style.borderBottomRightRadius = source.BorderBottomRightRadius }, - { nameof(target.style.opacity), target.style.opacity = source.Opacity.value }, - { nameof(target.style.visibility), target.style.visibility = (Visibility)source.Visibility.value }, - { nameof(target.style.display), target.style.display = (DisplayStyle)source.Display.value } + {nameof(target.style.maxHeight), target.style.maxHeight = source.MaxHeight.value == 0 ? new StyleLength(StyleKeyword.Auto) : source.MaxHeight.value}, + {nameof(target.style.minWidth), target.style.minWidth = source.MinWidth.value == 0 ? new StyleLength(StyleKeyword.Auto) : source.MinWidth.value}, + {nameof(target.style.minHeight), target.style.minHeight = source.MinHeight.value == 0 ? new StyleLength(StyleKeyword.Auto) : source.MinHeight.value}, + {nameof(target.style.flexBasis), target.style.flexBasis = source.FlexBasis.value == 0 ? new StyleLength(StyleKeyword.Auto) : source.FlexBasis.value}, + {nameof(target.style.flexGrow), target.style.flexGrow = source.FlexGrow}, + {nameof(target.style.flexShrink), target.style.flexShrink = source.FlexShrink}, + {nameof(target.style.flexDirection), target.style.flexDirection = (FlexDirection) source.FlexDirection.value}, + {nameof(target.style.flexWrap), target.style.flexWrap = (Wrap) source.FlexWrap.value}, + {nameof(target.style.marginLeft), target.style.marginLeft = source.MarginLeft}, + {nameof(target.style.marginTop), target.style.marginTop = source.MarginTop}, + {nameof(target.style.marginRight), target.style.marginRight = source.MarginRight}, + {nameof(target.style.marginBottom), target.style.marginBottom = source.MarginBottom}, + {nameof(target.style.paddingLeft), target.style.paddingLeft = source.PaddingLeft}, + {nameof(target.style.paddingTop), target.style.paddingTop = source.PaddingTop}, + {nameof(target.style.paddingRight), target.style.paddingRight = source.PaddingRight}, + {nameof(target.style.paddingBottom), target.style.paddingBottom = source.PaddingBottom}, + {nameof(target.style.alignSelf), target.style.alignSelf = (Align) source.AlignSelf.value}, + {nameof(target.style.unityTextAlign), target.style.unityTextAlign = (TextAnchor) source.UnityTextAlign.value}, + {nameof(target.style.unityFontStyleAndWeight), target.style.unityFontStyleAndWeight = (FontStyle) source.UnityFontStyleAndWeight.value}, + {nameof(target.style.fontSize), target.style.fontSize = source.FontSize}, + {nameof(target.style.whiteSpace), target.style.whiteSpace = (WhiteSpace) source.WhiteSpace.value}, + {nameof(target.style.color), target.style.color = source.Color}, + {nameof(target.style.backgroundColor), target.style.backgroundColor = source.BackgroundColor}, + {nameof(target.style.unityFont), target.style.unityFont = source.UnityFont}, + {nameof(target.style.unityBackgroundScaleMode), target.style.unityBackgroundScaleMode = (ScaleMode) source.UnityBackgroundScaleMode.value}, + {nameof(target.style.unityBackgroundImageTintColor), target.style.unityBackgroundImageTintColor = source.UnityBackgroundImageTintColor}, + {nameof(target.style.alignItems), target.style.alignItems = (Align) source.AlignItems.value}, + {nameof(target.style.alignContent), target.style.alignContent = (Align) source.AlignContent.value}, + {nameof(target.style.justifyContent), target.style.justifyContent = (Justify) source.JustifyContent.value}, + {nameof(target.style.borderLeftColor), target.style.borderLeftColor = source.BorderLeftColor}, + {nameof(target.style.borderRightColor), target.style.borderRightColor = source.BorderRightColor}, + {nameof(target.style.borderTopColor), target.style.borderTopColor = source.BorderTopColor}, + {nameof(target.style.borderBottomColor), target.style.borderBottomColor = source.BorderBottomColor}, + {nameof(target.style.borderLeftWidth), target.style.borderLeftWidth = source.BorderLeftWidth}, + {nameof(target.style.borderRightWidth), target.style.borderRightWidth = source.BorderRightWidth}, + {nameof(target.style.borderTopWidth), target.style.borderTopWidth = source.BorderTopWidth}, + {nameof(target.style.borderBottomWidth), target.style.borderBottomWidth = source.BorderBottomWidth}, + {nameof(target.style.borderTopLeftRadius), target.style.borderTopLeftRadius = source.BorderTopLeftRadius}, + {nameof(target.style.borderTopRightRadius), target.style.borderTopRightRadius = source.BorderTopRightRadius}, + {nameof(target.style.borderBottomLeftRadius), target.style.borderBottomLeftRadius = source.BorderBottomLeftRadius}, + {nameof(target.style.borderBottomRightRadius), target.style.borderBottomRightRadius = source.BorderBottomRightRadius}, + {nameof(target.style.opacity), target.style.opacity = source.Opacity.value}, + {nameof(target.style.visibility), target.style.visibility = (Visibility) source.Visibility.value}, + {nameof(target.style.display), target.style.display = (DisplayStyle) source.Display.value} }; //styleValues.Add(nameof(target.style. ),target.style.left = source.left); //styleValues.Add(nameof(target.style. ),target.style.top = source.top); @@ -1034,8 +1410,127 @@ public static T CopyElement(this T source, T target) where T : VisualElement return target; } - #endregion + + public static bool TryGetPreview(UnityObject target, out Texture2D preview) + { + preview = null; + + if (target == null) + return false; + + switch (target) + { + case GameObject go: + { + var renderers = ListPool.New(); + + try + { + go.GetComponentsInChildren(renderers); + foreach (var renderer in renderers) + { + switch (renderer) + { + case MeshRenderer _: + case SkinnedMeshRenderer _: + preview = AssetPreview.GetAssetPreview(target); + return true; + case SpriteRenderer spriteRenderer when spriteRenderer.sprite != null: + preview = AssetPreview.GetAssetPreview(spriteRenderer.sprite); + return true; + } + } + } + finally + { + renderers.Free(); + } + + return false; + } + case Material _: + case Sprite _: + case Texture2D _: + preview = AssetPreview.GetAssetPreview(target); + return true; + default: + return false; + } + } + + public static IEnumerator GetAssetPreview(UnityObject asset, Action callback) + { + // GetAssetPreview will start loading the preview, or return one if available + var texture = AssetPreview.GetAssetPreview(asset); + + // If the preview is not available, IsLoadingAssetPreview will be true until loading has finished + while (AssetPreview.IsLoadingAssetPreview(asset.GetInstanceID())) + { + texture = AssetPreview.GetAssetPreview(asset); + yield return null; + } + + // If loading a preview fails, fall back to the MiniThumbnail + if (!texture) + texture = AssetPreview.GetMiniThumbnail(asset); + + callback(texture); + } + + public static Texture2D TryGetPreview(UnityObject target) + { + Texture2D preview = null; + if (target == null) + return null; + + // if ((preview = (Texture2D) AssetDatabase.GetCachedIcon(AssetDatabase.GetAssetPath(target.GetInstanceID()))) != null) + // { + // return preview; + // } + + switch (target) + { + case GameObject go: + { + var renderers = ListPool.New(); + + try + { + go.GetComponentsInChildren(renderers); + foreach (var renderer in renderers) + { + switch (renderer) + { + case MeshRenderer _: + case SkinnedMeshRenderer _: + // EditorCoroutineUtility.StartCoroutine(GetAssetPreview(target, texture => preview = texture), target); + preview = AssetPreview.GetAssetPreview(target); + return preview; + case SpriteRenderer spriteRenderer when spriteRenderer.sprite != null: + // EditorCoroutineUtility.StartCoroutine(GetAssetPreview(spriteRenderer.sprite, texture => preview = texture), target); + preview = AssetPreview.GetAssetPreview(spriteRenderer.sprite); + return preview; + } + } + } + finally + { + renderers.Free(); + } + + return null; + } + case Material _: + case Sprite _: + case Texture2D _: + // EditorCoroutineUtility.StartCoroutine(GetAssetPreview(target, texture => preview = texture), target); + preview = AssetPreview.GetAssetPreview(target); + return preview; + default: + return null; + } + } } } #endif diff --git a/Runtime/Scripts/UI/EATKEditor.cs b/Runtime/Scripts/UI/EATKEditor.cs index 28dd71b..6d6dd15 100644 --- a/Runtime/Scripts/UI/EATKEditor.cs +++ b/Runtime/Scripts/UI/EATKEditor.cs @@ -191,7 +191,7 @@ private void BuildUIInterface() root.Add(toolbar); root.Add(elementBox); - buttonContainerDictionary.ForEach(x => + buttonContainerDictionary.forEach(x => { x.Value.AddToClassList("rightEdgePadding"); x.Value.JumpToCode("ButtonCascadeAnimation", true, "Jump To Animation", @@ -834,7 +834,7 @@ void ButtonCascade() var totalCount = buttonContainerDictionary.Count; // -- Iterate over the dictionary of row elements -------- - buttonContainerDictionary.ForEach(x => + buttonContainerDictionary.forEach(x => { // -- Then query for each button within the row ------ // -- Set default button cascade delay and counters -- @@ -880,7 +880,7 @@ void ButtonCascadeReversal() void StartReturnLoop() { var loopTime = 0; - buttonContainerDictionary.ForEach(x => + buttonContainerDictionary.forEach(x => { var buttons = x.Value.Query