0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Xamarin.Formsにおける色指定の方法(C#、Xaml)

Last updated at Posted at 2019-01-12

これはXamarin.Formsにおける色指定の方法です.

備忘録

#Xamlでの色指定
Xamlで色指定する場合は、ビルトインの色名、RGB値、アルファ値(透明度)つきRGB、TinyRGB、アルファ値つきTinyRGBで指定できる。

        <Label Text="Sea color" BackgroundColor="Aqua" />
        <Label Text="RGB" BackgroundColor="#00FFFF" />
        <Label Text="Alpha plus RGB" BackgroundColor="#2200FFFF" />
        <Label Text="Tiny RGB" BackgroundColor="#0FF" />
        <Label Text="Tiny Alpha plus RGB" BackgroundColor="#C0FF" />

#C#での色指定
C#でも同じように色名(構造体)や16進表記(文字列)で指定できる。

            var label = new Label();
            label.BackgroundColor=Color.Aqua;
            label.BackgroundColor = Color.FromHex("#00FFFF");
            label.BackgroundColor = Color.FromHex("#2200FFFF");
            label.BackgroundColor = Color.FromHex("#0FF");
            label.BackgroundColor = Color.FromHex("#20FF");

他にも

            label.BackgroundColor = Color.FromRgb(0x00, 0xff, 0xff);
            label.BackgroundColor = Color.FromRgb(0x00, 0xff, 0xff,0x22);
0
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?