Skip to content

Instantly share code, notes, and snippets.

@Paradox137
Created April 6, 2022 07:03
Show Gist options
  • Save Paradox137/32e40aa22d10b49bae0b14e7df4eb138 to your computer and use it in GitHub Desktop.
Save Paradox137/32e40aa22d10b49bae0b14e7df4eb138 to your computer and use it in GitHub Desktop.
Hierarchy highlighter for Unity Editor window
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace Scripts.Utility
{
public class HierarchyHighlighter : MonoBehaviour
{
//==============================================================================
//
// CONSTANTS
//
//==============================================================================
public static readonly Color DEFAULT_BACKGROUND_COLOR = new Color(0.76f, 0.76f, 0.76f, 1f);
public static readonly Color DEFAULT_BACKGROUND_COLOR_INACTIVE = new Color(0.306f, 0.396f, 0.612f, 1f);
public static readonly Color DEFAULT_TEXT_COLOR = Color.black;
//==============================================================================
//
// CONSTRUCTORS
//
//==============================================================================
public HierarchyHighlighter() { }
public HierarchyHighlighter(Color inBackgroundColor)
{
this.Background_Color = inBackgroundColor;
}
public HierarchyHighlighter(Color inBackgroundColor, Color inTextColor, FontStyle inFontStyle = FontStyle.Normal)
{
this.Background_Color = inBackgroundColor;
this.Text_Color = inTextColor;
this.TextStyle = inFontStyle;
}
//==============================================================================
//
// PROPERTIES
//
//==============================================================================
[Header("Active State")]
public Color Text_Color = DEFAULT_TEXT_COLOR;
public FontStyle TextStyle = FontStyle.Normal;
/// <summary>
/// Color of the background. Set alpha 0 to not draw a background period.
/// </summary>
public Color Background_Color = DEFAULT_BACKGROUND_COLOR;
[Header("Inactive State")]
public bool Custom_Inactive_Colors = false;
public Color Text_Color_Inactive = DEFAULT_TEXT_COLOR;
public FontStyle TextStyle_Inactive = FontStyle.Normal;
/// <summary>
/// Color of the background in an inactive state. Set alpha 0 to not draw a background period.
/// </summary>
public Color Background_Color_Inactive = DEFAULT_BACKGROUND_COLOR_INACTIVE;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment