|
Sub 按钮3_Click()
Rows("2:65535").ClearContents
Dim x, ys
Cells.Interior.ColorIndex = xlNone
K = 2
For x = 380 To 780 Step 0.5
If x >= 380 And x < 430 Then '/*x为可见光波长,ys为颜色值*/
R = 255: G = 0: B = 2.1 * (x - 380) + 150
ElseIf x >= 430 And x < 460 Then
R = 255 - 8.5 * (x - 430): G = 0: B = 255
ElseIf x >= 460 And x < 480 Then
R = 0: G = 12.8 * (x - 460): B = 255
ElseIf x >= 480 And x < 540 Then
R = 0: G = 255: B = 255 - 4.25 * (x - 480)
ElseIf x >= 540 And x < 580 Then
R = 6.375 * (x - 540): G = 255: B = 0
ElseIf x >= 580 And x < 660 Then
R = 255: G = 255 - 3.1875 * (x - 580): B = 0
ElseIf x >= 660 And x < 780 Then
R = 255: G = 0: B = 0.833 * (x - 660)
Else
R = 255: G = 255: B = 255
End If
R = Round(R, 0): Cells(K, 1) = R
G = Round(G, 0): Cells(K, 2) = G
B = Round(B, 0): Cells(K, 3) = B
ys = R + G * 256 + B * 65536
ys = "&H" & Hex(CLng(ys))
Cells(K, 5).Interior.Color = ys
Cells(K, 4) = Cells(K, 5).Interior.Color
Cells(K, 6) = Cells(K, 5).Interior.ColorIndex
Cells(K, 7) = x
K = K + 1
Next
End Sub
RGB色谱.zip
(48.92 KB, 下载次数: 38)
|
评分
-
1
查看全部评分
-
|