Skip to content

Instantly share code, notes, and snippets.

@Intedai
Intedai / paint_net_palette_parser.py
Last active May 18, 2023 16:40
Paint.NET Palette File Parser
from typing import TextIO # For type hinting for the file object in parse_palette
def parse_palette(file: TextIO) -> list:
"""
Parses Paint.NET palette files into a python list that contains the strings of the hex color values:
parses the colors,
pads hex colors that their length is smaller than 8 with the needed amount of 0's,
if line contains non hex characters or it has more than 8 characters it skips them (also skips ; comments),