-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9344975
commit 7aaef85
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
Assets/_PackageRoot/Scripts/Binders/BaseColorBinder.Public.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using UnityEngine; | ||
|
||
namespace Unity.Theme.Binders | ||
{ | ||
public abstract partial class BaseColorBinder : MonoBehaviour | ||
{ | ||
public bool SetColorByName(string name) => SetColor(Theme.Instance?.GetColorByName(name)); | ||
public bool SetColorByGuid(string colorGuid) => SetColor(Theme.Instance?.GetColorByGuid(colorGuid)); | ||
public bool SetColor(ColorDataRef colorData) => SetColorByGuid(colorData.Guid); | ||
public bool SetColor(ColorData colorData) | ||
{ | ||
if (colorData == null) | ||
{ | ||
if (Theme.Instance?.debugLevel <= DebugLevel.Error) | ||
Debug.LogError($"Color is null. Can't set it as a color for the binder", gameObject); | ||
return false; | ||
} | ||
data.colorGuid = colorData.Guid; | ||
SetColor(GetColor(colorData)); | ||
return true; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/_PackageRoot/Scripts/Binders/BaseColorBinder.Public.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.