using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
namespace Disco.Services.Extensions
{
public static class UIHelpers
{
///
/// FontAwesome Category Icons
///
public static ReadOnlyCollection> Icons { get; private set; }
///
/// User-selectable Colour Themes
///
public static ReadOnlyCollection> ThemeColours { get; private set; }
///
/// Noticeboard Colour Themes
///
public static ReadOnlyCollection> NoticeboardThemes { get; private set; }
///
/// Returns a randomly selected Icon using .
///
public static string RandomIcon()
{
return RandomIcon(null);
}
///
/// Returns a randomly selected Icon using .
///
/// A list of Icons which will be ignored (if all are excluded, a random one will be returned)
public static string RandomIcon(IEnumerable Except)
{
var rnd = new Random();
if (Except != null)
{
var availableIcons = UIHelpers.Icons.Select(i => i.Key).Except(Except).ToList();
if (availableIcons.Count > 0)
return availableIcons[rnd.Next(availableIcons.Count - 1)];
}
return UIHelpers.Icons[rnd.Next(UIHelpers.Icons.Count - 1)].Key;
}
///
/// Returns a randomly selected Theme Colour using .
///
public static string RandomThemeColour()
{
return RandomThemeColour(null);
}
///
/// Returns a randomly selected Theme Colour using .
///
/// A list of Theme Colours which will be ignored (if all are excluded, a random one will be returned)
public static string RandomThemeColour(IEnumerable Except)
{
var rnd = new Random();
if (Except != null)
{
var availableColours = UIHelpers.ThemeColours.Select(i => i.Key).Except(Except).ToList();
if (availableColours.Count > 0)
return availableColours[rnd.Next(availableColours.Count - 1)];
}
return UIHelpers.ThemeColours[rnd.Next(UIHelpers.ThemeColours.Count - 1)].Key;
}
static UIHelpers()
{
// Icons
Icons = new List>(){
new KeyValuePair("ambulance" , "Ambulance"),
new KeyValuePair("anchor" , "Anchor"),
new KeyValuePair("android" , "Android"),
new KeyValuePair("apple" , "Apple"),
new KeyValuePair("archive" , "Archive"),
new KeyValuePair("area-chart" , "Area Chart"),
new KeyValuePair("arrow-circle-down" , "Arrow Circle Down"),
new KeyValuePair("arrow-circle-left" , "Arrow Circle Left"),
new KeyValuePair("arrow-circle-right" , "Arrow Circle Right"),
new KeyValuePair("arrow-circle-up" , "Arrow Circle Up"),
new KeyValuePair("asterisk" , "Asterisk"),
new KeyValuePair("ban" , "Ban"),
new KeyValuePair("beer" , "Beer"),
new KeyValuePair("bell" , "Bell"),
new KeyValuePair("binoculars" , "Binoculars"),
new KeyValuePair("bolt" , "Bolt"),
new KeyValuePair("bomb" , "Bomb"),
new KeyValuePair("book" , "Book"),
new KeyValuePair("bookmark" , "Bookmark"),
new KeyValuePair("briefcase" , "Briefcase"),
new KeyValuePair("bug" , "Bug"),
new KeyValuePair("bicycle" , "Bicycle"),
new KeyValuePair("building-o" , "Building"),
new KeyValuePair("bullhorn" , "Bullhorn"),
new KeyValuePair("bullseye" , "Bullseye"),
new KeyValuePair("bus" , "Bus"),
new KeyValuePair("cab" , "Cab"),
new KeyValuePair("calculator" , "Calculator"),
new KeyValuePair("calendar" , "Calendar"),
new KeyValuePair("calendar-o" , "Calendar"),
new KeyValuePair("car" , "Car"),
new KeyValuePair("check-circle" , "Check Circle"),
new KeyValuePair("child" , "Child"),
new KeyValuePair("clock-o" , "Clock"),
new KeyValuePair("cloud" , "Cloud"),
new KeyValuePair("coffee" , "Coffee"),
new KeyValuePair("comments" , "Comments"),
new KeyValuePair("compass" , "Compass"),
new KeyValuePair("credit-card" , "Credit Card"),
new KeyValuePair("crosshairs" , "Crosshairs"),
new KeyValuePair("cube" , "Cube"),
new KeyValuePair("cubes" , "Cubes"),
new KeyValuePair("desktop" , "Desktop"),
new KeyValuePair("dollar" , "Dollar"),
new KeyValuePair("dot-circle-o" , "Dot Circle"),
new KeyValuePair("envelope" , "Envelope"),
new KeyValuePair("exclamation" , "Exclamation"),
new KeyValuePair("eye" , "Eye"),
new KeyValuePair("eyedropper" , "Eyedropper"),
new KeyValuePair("fax" , "Fax"),
new KeyValuePair("female" , "Female"),
new KeyValuePair("fighter-jet" , "Fighter Jet"),
new KeyValuePair("film" , "Film"),
new KeyValuePair("filter" , "Filter"),
new KeyValuePair("fire" , "Fire"),
new KeyValuePair("fire-extinguisher" , "Fire Extinguisher"),
new KeyValuePair("flask" , "Flask"),
new KeyValuePair("frown-o" , "Frown"),
new KeyValuePair("gamepad" , "Gamepad"),
new KeyValuePair("gift" , "Gift"),
new KeyValuePair("glass" , "Glass"),
new KeyValuePair("globe" , "Globe"),
new KeyValuePair("graduation-cap" , "Graduation Cap"),
new KeyValuePair("hand-o-down" , "Hand Down"),
new KeyValuePair("hand-o-left" , "Hand Left"),
new KeyValuePair("hand-o-right" , "Hand Right"),
new KeyValuePair("hand-o-up" , "Hand Up"),
new KeyValuePair("hdd-o" , "Hdd"),
new KeyValuePair("heart" , "Heart"),
new KeyValuePair("history" , "History"),
new KeyValuePair("home" , "Home"),
new KeyValuePair("info" , "Info"),
new KeyValuePair("key" , "Key"),
new KeyValuePair("keyboard-o" , "Keyboard"),
new KeyValuePair("language" , "Language"),
new KeyValuePair("laptop" , "Laptop"),
new KeyValuePair("leaf" , "Leaf"),
new KeyValuePair("legal" , "Legal"),
new KeyValuePair("life-ring" , "Life Ring"),
new KeyValuePair("lightbulb-o" , "Lightbulb"),
new KeyValuePair("line-chart" , "Line Chart"),
new KeyValuePair("linux" , "Linux"),
new KeyValuePair("location-arrow" , "Location Arrow"),
new KeyValuePair("magnet" , "Magnet"),
new KeyValuePair("male" , "Male"),
new KeyValuePair("map-marker" , "Map Marker"),
new KeyValuePair("medkit" , "Medkit"),
new KeyValuePair("meh-o" , "Meh"),
new KeyValuePair("microphone" , "Microphone"),
new KeyValuePair("microphone-slash" , "Microphone Slash"),
new KeyValuePair("minus-circle" , "Minus Circle"),
new KeyValuePair("mobile" , "Mobile"),
new KeyValuePair("money" , "Money"),
new KeyValuePair("moon-o" , "Moon"),
new KeyValuePair("music" , "Music"),
new KeyValuePair("newspaper-o" , "Newspaper"),
new KeyValuePair("paint-brush" , "Paint Brush"),
new KeyValuePair("paper-plane" , "Paper Plane"),
new KeyValuePair("paperclip" , "Paperclip"),
new KeyValuePair("paw" , "Paw"),
new KeyValuePair("pencil" , "Pencil"),
new KeyValuePair("phone" , "Phone"),
new KeyValuePair("pie-chart" , "Pie Chart"),
new KeyValuePair("picture-o" , "Picture"),
new KeyValuePair("plane" , "Plane"),
new KeyValuePair("plug" , "Plug"),
new KeyValuePair("power-off" , "Power Off"),
new KeyValuePair("print" , "Print"),
new KeyValuePair("puzzle-piece" , "Puzzle Piece"),
new KeyValuePair("question" , "Question"),
new KeyValuePair("question-circle" , "Question Circle"),
new KeyValuePair("random" , "Random"),
new KeyValuePair("recycle" , "Recycle"),
new KeyValuePair("retweet" , "Retweet"),
new KeyValuePair("road" , "Road"),
new KeyValuePair("rocket" , "Rocket"),
new KeyValuePair("shield" , "Shield"),
new KeyValuePair("shopping-cart" , "Shopping Cart"),
new KeyValuePair("smile-o" , "Smile"),
new KeyValuePair("space-shuttle" , "Space Shuttle"),
new KeyValuePair("star" , "Star"),
new KeyValuePair("suitcase" , "Suitcase"),
new KeyValuePair("sun-o" , "Sun"),
new KeyValuePair("tablet" , "Tablet"),
new KeyValuePair("tachometer" , "Tachometer"),
new KeyValuePair("tasks" , "Tasks"),
new KeyValuePair("thumbs-down" , "Thumbs Down"),
new KeyValuePair("thumbs-o-down" , "Thumbs Down"),
new KeyValuePair("thumbs-o-up" , "Thumbs Up"),
new KeyValuePair("thumbs-up" , "Thumbs Up"),
new KeyValuePair("thumb-tack" , "Thumb Tack"),
new KeyValuePair("trash" , "Trash"),
new KeyValuePair("trophy" , "Trophy"),
new KeyValuePair("truck" , "Truck"),
new KeyValuePair("umbrella" , "Umbrella"),
new KeyValuePair("university" , "University"),
new KeyValuePair("wheelchair" , "Wheelchair"),
new KeyValuePair("windows" , "Windows"),
new KeyValuePair("wrench" , "Wrench"),
new KeyValuePair("wifi" , "WiFi")
}.AsReadOnly();
// Icon Colours
ThemeColours = new List>(){
new KeyValuePair("lime" , "Lime"),
new KeyValuePair("green" , "Green"),
new KeyValuePair("emerald" , "Emerald"),
new KeyValuePair("teal" , "Teal"),
new KeyValuePair("cyan" , "Cyan"),
new KeyValuePair("cobalt" , "Cobalt"),
new KeyValuePair("indigo" , "Indigo"),
new KeyValuePair("violet" , "Violet"),
new KeyValuePair("pink" , "Pink"),
new KeyValuePair("magenta" , "Magenta"),
new KeyValuePair("crimson" , "Crimson"),
new KeyValuePair("red" , "Red"),
new KeyValuePair("orange" , "Orange"),
new KeyValuePair("amber" , "Amber"),
new KeyValuePair("yellow" , "Yellow"),
new KeyValuePair("brown" , "Brown"),
new KeyValuePair("olive" , "Olive"),
new KeyValuePair("steel" , "Steel"),
new KeyValuePair("mauve" , "Mauve"),
new KeyValuePair("sienna" , "Sienna")
}.AsReadOnly();
// Noticeboard Themes
NoticeboardThemes = new List>(){
new KeyValuePair("default" , "Default Blue"),
new KeyValuePair("default-soft" , "Default Blue Soft"),
new KeyValuePair("green" , "Green"),
new KeyValuePair("green-soft" , "Green Soft"),
new KeyValuePair("violet" , "Violet"),
new KeyValuePair("violet-soft" , "Violet Soft"),
new KeyValuePair("magenta" , "Magenta"),
new KeyValuePair("magenta-soft" , "Magenta Soft"),
new KeyValuePair("crimson" , "Crimson"),
new KeyValuePair("crimson-soft" , "Crimson Soft"),
new KeyValuePair("amber" , "Amber"),
new KeyValuePair("amber-soft" , "Amber Soft"),
new KeyValuePair("brown" , "Brown"),
new KeyValuePair("brown-soft" , "Brown Soft"),
new KeyValuePair("steel" , "Steel"),
new KeyValuePair("steel-soft" , "Steel Soft")
}.AsReadOnly();
}
}
}