# id

> Search provider unique ID.

## Definition

* **Type:** Property
* **Namespace:** [UnityEditor.Search](/engine/6000.7/script-reference/unityeditor/search.md)
* **Assembly:** UnityEditor

```csharp
public string id { get; }
```

### Examples

```csharp
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEditor.Search;
using UnityEngine;

static class SearchProvider_id
{
    internal static string id = "example_colors";
    internal static string name = "example_Colors";

    #region ShowDetailsOptions
    [SearchItemProvider]
    internal static SearchProvider CreateProvider()
    {
        return new SearchProvider(id, name)
        {
            filterId = "hex:",
            priority = 99999, // put example provider at a low priority
            showDetailsOptions = ShowDetailsOptions.Description | ShowDetailsOptions.Preview,
            fetchItems = (context, items, provider) => FetchItems(context, provider),
            fetchPreview = (item, context, size, options) =>
            {
                return CreateTextureFromColor(item.id, (int)size.x, (int)size.y);
            },
        };
    }

    #endregion

    [MenuItem("Examples/SearchProvider/id")]
    public static void Run()
    {
        var context = SearchService.CreateContext(SearchService.GetProvider(id));

        Debug.Log(context.providers.First().id);
    }

    static IEnumerable<SearchItem> FetchItems(SearchContext context, SearchProvider provider)
    {
        var expression = context.searchQuery;
        if (expression.Length == 6 && IsHex(expression))
        {
            expression = "#" + expression;
            yield return provider.CreateItem(context, expression, GetColorName(expression),
                "Look at this " + GetColorName(expression) + " color!",
                CreateTextureFromColor(expression, 64, 64), null);
        }
    }

    private static Texture2D CreateTextureFromColor(string color, int width, int height)
    {
        Color fillColor;
        if (!ColorUtility.TryParseHtmlString(color, out fillColor))
            return null;
        var texture = new Texture2D(width, height, TextureFormat.ARGB32, false);
        var fillColorArray = texture.GetPixels32();

        for (var i = 0; i < fillColorArray.Length; ++i)
            fillColorArray[i] = fillColor;

        texture.SetPixels32(fillColorArray);

        texture.Apply();
        return texture;
    }

    private static bool IsHex(string expression)
    {
        foreach (var c in expression)
        {
            if (!Uri.IsHexDigit(c))
                return false;
        }
        return true;
    }

    private static string GetColorName(string color)
    {
        if (color[1] > color[3] && color[1] > color[5])
            return "reddish";
        else if (color[3] > color[1] && color[3] > color[5])
            return "greenish";
        else if (color[5] > color[1] && color[5] > color[3])
            return "bluish";
        return "undefined";
    }
}
```
