1 # SPDX-License-Identifier: GPL-2.0-or-later
5 This script imports a Krita/Gimp Palette to Blender.
8 Run this script from "File->Import" menu and then load the desired KPL file.
16 def load(context
, filepath
):
17 (path
, filename
) = os
.path
.split(filepath
)
21 finput
= open(filepath
)
22 line
= finput
.readline()
28 pal
= bpy
.data
.palettes
.new(name
=filename
)
33 col
[0] = int(values
[0]) / 255.0
34 col
[1] = int(values
[1]) / 255.0
35 col
[2] = int(values
[2]) / 255.0
37 palcol
= pal
.colors
.new()
38 palcol
.color
[0] = col
[0]
39 palcol
.color
[1] = col
[1]
40 palcol
.color
[2] = col
[2]
45 line
= finput
.readline()