void Awake() { // Register the singleton if (Instance != null) { Debug.LogError("Multiple instances of ColorDefinitions!"); } Instance = this; }
/// <summary> /// Gets a color definition. /// </summary> /// <param name="name">The name of the color definition.</param> /// <returns>A color definition. A default color definition if the definition was not found.</returns> public ColorDefinition GetColorDefinition(string name) { ColorDefinition colorDef = ColorDefinitions.FirstOrDefault(x => x.Name == name); if (colorDef == null) { if (!CurrentApplication.IsRelease) { //throw new InvalidOperationException("Saknar färgdefinition i temat."); } if (ForegroundColor != null) { colorDef = new ColorDefinition(name, ForegroundColor); } else { colorDef = new ColorDefinition(name, "000000"); } } return(colorDef); }