Jump to content




chpal -- Palette changer for ComputerCraft 1.8 and later

computer utility

5 replies to this topic

#1 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 06 July 2017 - 11:35 PM

chpal is a cool program that lets you load and export palettes with the new features of ComputerCraft 1.8.

Posted ImagePosted Image

Download
pastebin get 1XBzKKrT chpal

Usage
chpal <path>
Change palette to the palette in path.
chpal --export <path>
Exports the current palette to path.
chpal --reset
Resets the palette to the default ComputerCraft palette.

Palette format
The palette format chpal uses is a limited version of the .Xresources format.
An example palette entry is
*.color0: #000000

The only criterium for an entry is
*.color<n>: #<hex>


Example palettes
You can find examples here.

pacpal
pastebin get xk8pjsJY pacpal
pacpal shows an image with all the colours, so you can get a quick look of all the colours.

Edited by CrazedProgrammer, 06 July 2017 - 11:53 PM.


#2 Lignum

  • Members
  • 558 posts

Posted 09 July 2017 - 10:08 AM

I'm surprised this isn't getting much attention, it's a simple but useful tool, and those examples are pretty nifty, as well! Cheers for making this.

#3 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 09 July 2017 - 12:10 PM

View PostLignum, on 09 July 2017 - 10:08 AM, said:

I'm surprised this isn't getting much attention, it's a simple but useful tool, and those examples are pretty nifty, as well! Cheers for making this.
Thanks, glad it was of use to someone :D

#4 MineRobber___T

  • Members
  • 50 posts
  • LocationStop being nosy

Posted 15 July 2017 - 09:49 PM

Regarding lines 39-45:

Quote

-- oh god why
local imgpath = "/tmpimg"..math.random(1, 9999)
local handle = fs.open(imgpath, "w")
handle.write(imgstr)
handle.close()
local img = paintutils.loadImage(imgpath)
fs.delete(imgpath)

I've submitted a PR to ComputerCraft so that that could be simplified to:

local img = paintutils.loadImage(imgstr,true)

PR here (https://github.com/d...rCraft/pull/378)

#5 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 15 July 2017 - 10:55 PM

View PostMineRobber___T, on 15 July 2017 - 09:49 PM, said:

Regarding lines 39-45:

Quote

-- oh god why
local imgpath = "/tmpimg"..math.random(1, 9999)
local handle = fs.open(imgpath, "w")
handle.write(imgstr)
handle.close()
local img = paintutils.loadImage(imgpath)
fs.delete(imgpath)

I've submitted a PR to ComputerCraft so that that could be simplified to:

local img = paintutils.loadImage(imgstr,true)

PR here (https://github.com/d...rCraft/pull/378)
Thanks! That would make the paintutils API a little less bad :P

#6 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 16 July 2017 - 01:08 AM

Not so bad that I wouldn't just avoid it completely, though.

Spoiler






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users