|
Sub test()
Dim MyRGB As Colour
Dim H As Double, S As Double, L As Double
H = InputBox("输入色相(0-360度):") 'h=色相
For i = 0 To 10 's=饱和度
For j = 0 To 10 'l=亮度
S = i / 10: L = j / 10
MyRGB = HSL2RGB(NewHSL(H, S, L))
r1 = Round(255 * MyRGB.r, 0): g1 = Round(255 * MyRGB.g, 0): b1 = Round(255 * MyRGB.b, 0)
Cells(i + 1, j + 1).Interior.Color = RGB(r1, g1, b1)
Cells(i + 1, j + 1).Value = "'" & r1 & "," & g1 & "," & b1
MyRGB = HSL2RGB(NewHSL((H + 180) Mod 360, 1, 1 - L))
r2 = Round(255 * MyRGB.r, 0): g2 = Round(255 * MyRGB.g, 0): b2 = Round(255 * MyRGB.b, 0)
Cells(i + 1, j + 1).Font.Color = RGB(r2, g2, b2)
Next
Next
End Sub
单色渐变.zip
(24.25 KB, 下载次数: 257)
|
|