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 = Icons.Select(i => i.Key).Except(Except).ToList();
if (availableIcons.Count > 0)
return availableIcons[rnd.Next(availableIcons.Count - 1)];
}
return Icons[rnd.Next(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 = ThemeColours.Select(i => i.Key).Except(Except).ToList();
if (availableColours.Count > 0)
return availableColours[rnd.Next(availableColours.Count - 1)];
}
return ThemeColours[rnd.Next(ThemeColours.Count - 1)].Key;
}
static UIHelpers()
{
// Icons
Icons = new List>(){
new KeyValuePair("address-book" , "Address Book"),
new KeyValuePair("address-card" , "Address Card"),
new KeyValuePair("adjust" , "Adjust"),
new KeyValuePair("amazon" , "Amazon"),
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("arrow-down" , "Arrow Down"),
new KeyValuePair("arrow-left" , "Arrow Left"),
new KeyValuePair("arrow-right" , "Arrow Right"),
new KeyValuePair("arrow-up" , "Arrow Up"),
new KeyValuePair("arrows" , "Arrows"),
new KeyValuePair("asterisk" , "Asterisk"),
new KeyValuePair("at" , "At"),
new KeyValuePair("balance-scale" , "Balance Scale"),
new KeyValuePair("ban" , "Ban"),
new KeyValuePair("bank" , "Bank"),
new KeyValuePair("bar-chart" , "Bar Chart"),
new KeyValuePair("barcode" , "Barcode"),
new KeyValuePair("bars" , "Bars"),
new KeyValuePair("bath" , "Bath"),
new KeyValuePair("battery-0" , "Battery 0"),
new KeyValuePair("battery-1" , "Battery 1"),
new KeyValuePair("battery-2" , "Battery 2"),
new KeyValuePair("battery-3" , "Battery 3"),
new KeyValuePair("battery-4" , "Battery 4"),
new KeyValuePair("bed" , "Bed"),
new KeyValuePair("beer" , "Beer"),
new KeyValuePair("bell" , "Bell"),
new KeyValuePair("bell-slash" , "Bell Slash"),
new KeyValuePair("binoculars" , "Binoculars"),
new KeyValuePair("birthday-cake" , "Cake"),
new KeyValuePair("bitcoin" , "Bitcoin"),
new KeyValuePair("black-tie" , "Black Tie"),
new KeyValuePair("blind" , "Blind"),
new KeyValuePair("bluetooth" , "Bluetooth"),
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-check-o" , "Calendar Check"),
new KeyValuePair("calendar-minus-o" , "Calendar Minus"),
new KeyValuePair("calendar-o" , "Calendar"),
new KeyValuePair("calendar-plus-o" , "Calendar Plus"),
new KeyValuePair("calendar-times-o" , "Calendar Times"),
new KeyValuePair("car" , "Car"),
new KeyValuePair("caret-square-o-down" , "Caret Square Down"),
new KeyValuePair("caret-square-o-left" , "Caret Square Left"),
new KeyValuePair("caret-square-o-right" , "Caret Square Right"),
new KeyValuePair("caret-square-o-up" , "Caret Square Up"),
new KeyValuePair("cart-arrow-down" , "Cart Arrow Down"),
new KeyValuePair("cart-plus" , "Cart Plus"),
new KeyValuePair("cc" , "CC"),
new KeyValuePair("cc-amex" , "CC American Express"),
new KeyValuePair("cc-mastercard" , "CC MasterCard"),
new KeyValuePair("cc-paypal" , "CC PayPal"),
new KeyValuePair("cc-stripe" , "CC Stripe"),
new KeyValuePair("cc-visa" , "CC VISA"),
new KeyValuePair("certificate" , "Certificate"),
new KeyValuePair("chain" , "Chain"),
new KeyValuePair("chain-broken" , "Chain Broken"),
new KeyValuePair("check" , "Check"),
new KeyValuePair("check-circle" , "Check Circle"),
new KeyValuePair("check-circle-o" , "Check Circle Outline"),
new KeyValuePair("check-square" , "Check Square"),
new KeyValuePair("check-square-o" , "Check Square Outline"),
new KeyValuePair("child" , "Child"),
new KeyValuePair("chrome" , "Chrome"),
new KeyValuePair("clipboard" , "Clipboard"),
new KeyValuePair("clock-o" , "Clock"),
new KeyValuePair("close" , "Close"),
new KeyValuePair("cloud" , "Cloud"),
new KeyValuePair("cloud-download" , "Cloud Download"),
new KeyValuePair("cloud-upload" , "Cloud Upload"),
new KeyValuePair("code" , "Code"),
new KeyValuePair("code-fork" , "Code Fork"),
new KeyValuePair("cog" , "Cog"),
new KeyValuePair("cogs" , "Cogs"),
new KeyValuePair("coffee" , "Coffee"),
new KeyValuePair("comment" , "Comment"),
new KeyValuePair("comment-o" , "Comment Outline"),
new KeyValuePair("commenting" , "Commenting"),
new KeyValuePair("commenting-o" , "Commenting Outline"),
new KeyValuePair("comments" , "Comments"),
new KeyValuePair("comments-o" , "Comments Outline"),
new KeyValuePair("compass" , "Compass"),
new KeyValuePair("compress" , "Compress"),
new KeyValuePair("copy" , "Copy"),
new KeyValuePair("copyright" , "Copyright"),
new KeyValuePair("creative-commons" , "Creative-Commons"),
new KeyValuePair("credit-card" , "Credit Card"),
new KeyValuePair("credit-card-alt" , "Credit Card ALternative"),
new KeyValuePair("crop" , "Crop"),
new KeyValuePair("crosshairs" , "Crosshairs"),
new KeyValuePair("cube" , "Cube"),
new KeyValuePair("cubes" , "Cubes"),
new KeyValuePair("cut" , "Cut"),
new KeyValuePair("cutlery" , "Cutlery"),
new KeyValuePair("database" , "Database"),
new KeyValuePair("deaf" , "Deaf"),
new KeyValuePair("desktop" , "Desktop"),
new KeyValuePair("diamond" , "Diamond"),
new KeyValuePair("dollar" , "Dollar"),
new KeyValuePair("dot-circle-o" , "Dot Circle"),
new KeyValuePair("drivers-license" , "Drivers License"),
new KeyValuePair("drivers-license-o" , "Drivers License Outline"),
new KeyValuePair("edge" , "Edge"),
new KeyValuePair("edit" , "Edit"),
new KeyValuePair("eject" , "Eject"),
new KeyValuePair("envelope" , "Envelope"),
new KeyValuePair("envelope-o" , "Envelope Outline"),
new KeyValuePair("envelope-open" , "Envelope Open"),
new KeyValuePair("envelope-open-o" , "Envelope Open Outline"),
new KeyValuePair("envelope-square" , "Envelope Square"),
new KeyValuePair("eraser" , "Eraser"),
new KeyValuePair("exchange" , "Exchange"),
new KeyValuePair("exclamation" , "Exclamation"),
new KeyValuePair("exclamation-circle" , "Exclamation Circle"),
new KeyValuePair("exclamation-triangle" , "Exclamation Triangle"),
new KeyValuePair("expand" , "Expand"),
new KeyValuePair("eye" , "Eye"),
new KeyValuePair("eye-slash" , "Eye Slash"),
new KeyValuePair("eyedropper" , "Eyedropper"),
new KeyValuePair("fax" , "Fax"),
new KeyValuePair("feed" , "Feed"),
new KeyValuePair("female" , "Female"),
new KeyValuePair("fighter-jet" , "Fighter Jet"),
new KeyValuePair("file" , "File"),
new KeyValuePair("film" , "Film"),
new KeyValuePair("filter" , "Filter"),
new KeyValuePair("fire" , "Fire"),
new KeyValuePair("fire-extinguisher" , "Fire Extinguisher"),
new KeyValuePair("firefox" , "FireFox"),
new KeyValuePair("flag" , "Flag"),
new KeyValuePair("flag-checkered" , "Flag Checkered"),
new KeyValuePair("flag-o" , "Flag Outline"),
new KeyValuePair("floppy-o" , "Floppy Outline"),
new KeyValuePair("folder" , "Folder"),
new KeyValuePair("folder-o" , "Folder Outline"),
new KeyValuePair("folder-open" , "Folder Open"),
new KeyValuePair("folder-open-o" , "Folder Open Outline"),
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("group" , "Group"),
new KeyValuePair("hand-grab-o" , "Hand Grab"),
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("hand-paper-o" , "Hand Paper"),
new KeyValuePair("hand-pointer-o" , "Hand Pointer"),
new KeyValuePair("hand-scissors-o" , "Hand Scissors"),
new KeyValuePair("hand-spock-o" , "Hand Spock"),
new KeyValuePair("handshake-o" , "Handshake"),
new KeyValuePair("hashtag" , "Hashtag"),
new KeyValuePair("hdd-o" , "Hdd"),
new KeyValuePair("heart" , "Heart"),
new KeyValuePair("heart-o" , "Heart Outline"),
new KeyValuePair("heartbeat" , "Heartbeat"),
new KeyValuePair("history" , "History"),
new KeyValuePair("home" , "Home"),
new KeyValuePair("hospital-o" , "Hospital"),
new KeyValuePair("hourglass" , "Hourglass"),
new KeyValuePair("hourglass-1" , "Hourglass 1"),
new KeyValuePair("hourglass-2" , "Hourglass 2"),
new KeyValuePair("hourglass-3" , "Hourglass 3"),
new KeyValuePair("hourglass-o" , "Hourglass Outline"),
new KeyValuePair("id-badge" , "Id Badge"),
new KeyValuePair("image" , "Image"),
new KeyValuePair("inbox" , "Inbox"),
new KeyValuePair("info" , "Info"),
new KeyValuePair("info-circle" , "Info Circle"),
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("lemon-o" , "Lemon"),
new KeyValuePair("level-down" , "Level Down"),
new KeyValuePair("level-up" , "Level Up"),
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("lock" , "Lock"),
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("microchip" , "Microchip"),
new KeyValuePair("microphone" , "Microphone"),
new KeyValuePair("microphone-slash" , "Microphone Slash"),
new KeyValuePair("minus" , "Minus"),
new KeyValuePair("minus-circle" , "Minus Circle"),
new KeyValuePair("minus-square" , "Minus Square"),
new KeyValuePair("minus-square-o" , "Minus Square Outline"),
new KeyValuePair("mobile" , "Mobile"),
new KeyValuePair("money" , "Money"),
new KeyValuePair("moon-o" , "Moon"),
new KeyValuePair("motorcycle" , "Motorcycle"),
new KeyValuePair("music" , "Music"),
new KeyValuePair("newspaper-o" , "Newspaper"),
new KeyValuePair("paint-brush" , "Paint Brush"),
new KeyValuePair("paper-plane" , "Paper Plane"),
new KeyValuePair("paper-plane-o" , "Paper Plane Outline"),
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("plus" , "Plus"),
new KeyValuePair("plus-circle" , "Plus Circle"),
new KeyValuePair("plus-square" , "Plus Square"),
new KeyValuePair("plus-square-o" , "Plus Square Outline"),
new KeyValuePair("power-off" , "Power Off"),
new KeyValuePair("print" , "Print"),
new KeyValuePair("puzzle-piece" , "Puzzle Piece"),
new KeyValuePair("qrcode" , "QR Code"),
new KeyValuePair("question" , "Question"),
new KeyValuePair("question-circle" , "Question Circle"),
new KeyValuePair