1 # SPDX-FileCopyrightText: 2019-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
7 This script imports a Krita/Gimp Palette to Blender.
10 Run this script from "File->Import" menu and then load the desired KPL file.
18 def load(context
, filepath
):
19 (path
, filename
) = os
.path
.split(filepath
)
23 finput
= open(filepath
)
24 line
= finput
.readline()
30 pal
= bpy
.data
.palettes
.new(name
=filename
)
35 col
[0] = int(values
[0]) / 255.0
36 col
[1] = int(values
[1]) / 255.0
37 col
[2] = int(values
[2]) / 255.0
39 palcol
= pal
.colors
.new()
40 palcol
.color
[0] = col
[0]
41 palcol
.color
[1] = col
[1]
42 palcol
.color
[2] = col
[2]
47 line
= finput
.readline()