//Formats ObjectcolorPairs as Photoshop readable css file
    void GenerateCSSRef(ObjectColorPair[] array)
    {
        string DocString = string.Empty;  //Initialises css contents

        //Loop through every ObjectColorPair in pairs array
        for (int i = 0; i < array.Length; i++)
        {
            ObjectColorPair o = array[i];  //Stores current item in array

            //Formats current ObjectcolorPair as a css 'a' tag with color content.
            // a{
            //    color: rgb(255, 55, 0);
            // }
            DocString += "a {";
            DocString += string.Format("color: rgb({0},{1},{2});",
                                       Mathf.Round(o.Key.r * 255),
                                       Mathf.Round(o.Key.g * 255),
                                       Mathf.Round(o.Key.b * 255));
            DocString += "}";
        }

        //opens save file dialog
        string Path = EditorUtility.SaveFilePanel("Save CSS swatches", "", "Color reference.css", "css");

        //Checks for null path
        if (Path == string.Empty)
        {
            return;
        }
        File.WriteAllText(Path, DocString); //Writes data.
    }
    //This function formats a file with refernces to color and block
    void GenerateTextRef(ObjectColorPair[] array)
    {
        //Initialise file content
        string DocString = string.Empty;

        //Loop through every ObjectColorPair in pairs array
        for (int i = 0; i < array.Length; i++)
        {
            ObjectColorPair o = array[i]; //Stores current item in array

            //Does some black magic in order to format ObjectColorPair to look like
            //0. BlockName == (255, 55, 66)
            DocString += string.Format("{0}. {1} == ({2}, {3}, {4})",
                                       i, o.Name, o.Key.r * 255, o.Key.g * 255, o.Key.b * 255);
            DocString += "\n";
        }

        //Opens a save file dialog
        string Path = EditorUtility.SaveFilePanel("Save text ref", "", "Color reference.txt", "txt");

        //if the path is empty of has been cancelled, return and do nothing
        if (Path == string.Empty)
        {
            return;
        }
        File.WriteAllText(Path, DocString); //Write formatted text to file path
    }