Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. using Xamarin.Forms;
  2.  
  3. namespace ColorSample
  4. {
  5. public partial class ColorSamplePage : ContentPage
  6. {
  7. public ColorSamplePage()
  8. {
  9. InitializeComponent();
  10.  
  11. var red = new Label { Text = "Red", BackgroundColor = Color.Red };
  12. var orange = new Label { Text = "Orange", BackgroundColor = Color.FromHex("FF6A00") };
  13. var yellow = new Label { Text = "Yellow", BackgroundColor = Color.FromHsla(0.167, 1.0, 0.5, 1.0) };
  14. var green = new Label { Text = "Green", BackgroundColor = Color.FromRgb(38, 127, 0) };
  15. var blue = new Label { Text = "Blue", BackgroundColor = Color.FromRgba(0, 38, 255, 255) };
  16. var indigo = new Label { Text = "Indigo", BackgroundColor = Color.FromRgb(0, 72, 255) };
  17. var violet = new Label { Text = "Violet", BackgroundColor = Color.FromHsla(0.82, 1, 0.25, 1) };
  18.  
  19. var space = new Label { Text = " ", BackgroundColor = Color.Transparent };
  20.  
  21. var transparent = new Label { Text = "Transparent", BackgroundColor = Color.Transparent };
  22. var @default = new Label { Text = "Default", BackgroundColor = Color.Default };
  23. var accent = new Label { Text = "Accent", BackgroundColor = Color.Accent };
  24.  
  25.  
  26. Content = new StackLayout
  27. {
  28. Padding = Device.OnPlatform(Android: new Thickness(),
  29. iOS: new Thickness(0, 20, 0, 0),
  30. WinPhone: new Thickness()),
  31. Children = {
  32. new Label {
  33. Text = "Color Demo",
  34. FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
  35. FontAttributes = FontAttributes.Bold
  36. },
  37. red, orange, yellow, green, blue, indigo, violet,
  38. space,
  39. transparent, @default, accent
  40. }
  41. };
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement