H. Chase Stevens Logo

Most Common Tags

  1. programming
  2. python
  3. code
  4. philosophy
  5. evolution
  6. game design
  7. probability
  8. video games
  9. genetic algorithms
  10. government



Posts with tag "web design":

Exporting Color Scheme Designer Palettes to Paint.Net

posted on: Saturday, November 19, 2011 (10:59 am) by Chase Stevens

If you're like me and use the excellent tool over at Color Scheme Designer in conjunction with Paint.Net, you may have grown frustrated with creating palettes one color at a time by copy-pasting hex values. No longer! Below, please find a short python application I wrote (which even uses a fancy and unnecessary GUI) to create Paint.Net palettes from Color Scheme Designer palettes. Just export your Color Scheme Designer palette to text, copy what the site gives you, paste it into the application, and click "convert and save". The resulting file is ready to import into Paint.Net at your leisure.

from Tkinter import *
from tkFileDialog import asksaveasfilename as save
from tkMessageBox import showinfo as disp

def convert():
    intext = str(text.dump(1.0, END))
    intext = intext.split(' = ')
    colorlist = list()
    for ss in intext:
        if ss[0] == '#':
    filename = save(defaultextension='txt',initialdir='\%HOMEPATH\%\\My Documents\\Paint.NET User Files\\Palettes')
    palette = open(filename, 'w')
    for color in colorlist:
        palette.write('FF%s\n' %color)
    disp('File Saved', 'File successfully saved as %s.' %filename)
root = Tk()
menubar = Menu(root)
menubar.add_command(label="Convert and Save", command=convert)
menubar.add_command(label="Quit", command=quit)
scroll = Scrollbar(root)
scroll.pack(side=RIGHT, fill=Y)
text = Text(root, wrap=WORD, yscrollcommand=scroll.set)

Tags: code, color, design, internet, programming, python, tkinter, web, web design