본문 바로가기
삽질/WP7.C#

[WP7] 윈도우폰 설정 된 테마 색상 가져오기

by 푸딩s 2012. 4. 4.
728x90
반응형



Background : Dark(Black), Light(White)  

1)

    Color themeColor = (Color)Application.Current.Resources["PhoneBackgroundColor"];

    if (themeColor.ToString() == "#FF000000")  ; // "Dark";

    else if (themeColor.ToString() == "#FFFFFFFF")  ; // "Light"; 

2) 

    // 글자 색상이 흰색이라면 현재 테마는 Dark, 검은색이라면 Light 

    Color themeColor = (Color)Application.Current.Resources[" PhoneForegroundColor "];

    if (themeColor.ToString() == "#FFFFFFFF")  ; // "Dark";

    else if (themeColor.ToString() == "#DE000000")  ; // "Light"; 


Accent Color

    Color accentColor = (Color)Application.Current.Resources["PhoneAccentColor"];

    switch (accentColor.ToString())
    {
case "#FFFF0097":
accent = "magenta";
break;
case "#FFA200FF":
accent = "purple";
break;
case "#FF00ABA9":
accent = "teal";
break;
case "#FF8CBF26":
accent = "lime";
break;
case "#FFA05000":
accent = "brown";
break;
case "#FFE671B8":
accent = "pink";
break;
case "#FFF09609":
accent = "orange";
break;
case "#FF1BA1E2":
accent = "blue";
break;
case "#FFE51400":
accent = "red";
break;
case "#FF339933":
accent = "green";
break;
    }

참고 : 
new SolidColorBrush(Colors.Gray)
new SolidColorBrush { Color = new Color { R = 0, G = 32, B = 120, A = 100 } }

728x90
반응형

댓글