수색…


색상 조작

색상을 조작하기 위해 색상의 argb (Alpha, Red, Green 및 Blue) 값을 수정합니다.

먼저 색상에서 RGB 값을 추출합니다.

int yourColor = Color.parse("#ae1f67");

int red = Color.red(yourColor);
int green = Color.green(yourColor);
int blue = Color.blue(yourColor);

이제 빨강, 녹색 및 파랑 값을 줄이거 나 늘릴 수 있으며 다시 결합하여 색상으로 사용할 수 있습니다.

 int newColor = Color.rgb(red, green, blue);

또는 알파를 추가하려면 색상을 만드는 동안 추가 할 수 있습니다.

 int newColor = Color.argb(alpha, red, green, blue);

알파와 RGB 값은 [0-225] 범위에 있어야합니다.



Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow