需要安装 photoshop-python-api
1 """Change the color of the background and foreground."""
2 # Import local modules
3 from photoshop import Session
4
5
6 with Session() as ps:
7 foregroundColor = ps.SolidColor()
8 foregroundColor.rgb.red = 255
9 foregroundColor.rgb.green = 0
10 foregroundColor.rgb.blue = 0
11 ps.app.foregroundColor = foregroundColor
12
13 backgroundColor = ps.SolidColor()
14 backgroundColor.rgb.red = 0
15 backgroundColor.rgb.green = 0
16 backgroundColor.rgb.blue = 0
17 ps.app.backgroundColor = backgroundColor