public Colour4 GetColour(ThemeSlot slot) { if (colours.TryGetValue(slot, out Colour4 value)) { return(value); } throw new ArgumentException($"{slot} does not exist in '{this}' theme."); }
/// <summary> /// Adds a colour to the colour mappings. If a slot is already defined, it will be overwritten. /// </summary> /// <param name="slot">The slot to add the colour to.</param> /// <param name="colour">The colour to set the slot's value to</param> /// <returns></returns> public Theme AddColour(ThemeSlot slot, Colour4 colour) { if (colours == null) { colours = new Dictionary <ThemeSlot, Colour4>(); } if (colours.ContainsKey(slot)) { colours[slot] = colour; } else { colours.Add(slot, colour); } return(this); }
protected override void UpdateBackground(ThemeSlot slot) => background.Colour = slot;
protected virtual void UpdateLabel(ThemeSlot slot) { }
protected virtual void UpdateBackground(ThemeSlot slot) { }
/// <summary> /// Adds a colour to the colour mappings. If a slot is already defined, it will be overwritten. /// </summary> /// </summary> /// <param name="slot">The slot to add the colour to.</param> /// <param name="hex">The colour represented as a valid hex string.</param> /// <returns></returns> public Theme AddColour(ThemeSlot slot, string hex) => AddColour(slot, Colour4.FromHex(hex));