(I 심하게 설명하면 어떤 도움을 많이 감사하고 죄송)? 몇 가지 예를 들어 주시겠습니까?
상태가 45이면 빨간색과 녹색의 값은 무엇입니까? 상태가 75이면 빨간색과 초록색 값은 무엇입니까?
당신은 다음과 같이 할 수있는 당신을 감소 상태와 빨간색의 기초 증가 녹색하려는 경우 :
green = (255/(1/colorPercentage)); //green increases as per the colorPercentage's value
red = 255 - green; (if green is 200 you will get red as 55)
당신이 운동 솔루션에 도움이 될 것입니다 상태의 예와 약간의 기대 값을 넣으면 .
업데이트
안녕, 코드를 다음, 당신이 뭔가를 구현할 수 있습니다 참조하십시오. public void printColours (double apercentage) { 이중 비율 = apercentage/100; double yellowPercent = (백분율 < 0.25) 0 : (백분율> = 0.25 & & 백분율 < = 0.50)? 백분율 * 2 : ((1.0 - 백분율) * 2);
double red, yellow, green;
red = 255 * (1.0 - percentage);
green = 255 * (1.0 * percentage);
yellow = 255 * yellowPercent;
System.Diagnostics.Debug.WriteLine(string.Format("Red: {0}, Green: {1} and Yellow: {2} for Percentage of: {3}", red, green, yellow,percentage));
System.Diagnostics.Debug.WriteLine(yellowPercent);
}
당신은
printColours(10.00);
printColours(25.00);
printColours(40.00);
printColours(50.00);
printColours(60.00);
printColours(65.00);
printColours(75.00);
printColours(95.00);
printColours(100.00);
내가, 내가 생각 충분 당신의 필요에 따라 자유롭게 변경할 수 느껴야한다이 방법에서 다음과 같은 결과를 얻고있다하여이를 테스트 할 수 있습니다.
Red: 229.5, Green: 25.5 and Yellow: 0 for Percentage of: 0.1
Red: 191.25, Green: 63.75 and Yellow: 127.5 for Percentage of: 0.25
Red: 153, Green: 102 and Yellow: 204 for Percentage of: 0.4
Red: 127.5, Green: 127.5 and Yellow: 255 for Percentage of: 0.5
Red: 102, Green: 153 and Yellow: 204 for Percentage of: 0.6
Red: 89.25, Green: 165.75 and Yellow: 178.5 for Percentage of: 0.65
Red: 63.75, Green: 191.25 and Yellow: 127.5 for Percentage of: 0.75
Red: 12.75, Green: 242.25 and Yellow: 25.5 for Percentage of: 0.95
Red: 0, Green: 255 and Yellow: 0 for Percentage of: 1
희망이
내가/오렌지, 37, 노란색, 오렌지색으로, 25 레드로 0이 빨간색으로 할 것이 도움이 50, 75, 녹색이 될, 그리고 그것을 확장/노란색, 녹색, (100) inbetween 기본적으로, 그래서 방정식에 노란색을 추가하고 싶습니다. – Gabc
0 % 빨간색은 255, 노란색은 0, 녹색은 0, 25 %는 122와 빨간색 122, 녹색은 0이어야합니다. 50 % 노란색은 255이어야하고 녹색 0 빨간색 0, 노란색 75 % 122, 녹색 122, 빨간색 0 100 % 녹색 255 노란색 0 빨간색 0 잘하면 그게 설명해. – Gabc