An 11-color "sepia" palette for PICO-8.

The palette was derived from a combination of greyscale luminosity sorting, negative blue/green hue matching, and luminosity diff balancing. And when some of that failed, I eyeballed it :P

This leaves 5 extra slots for colors (do with what you wish). In the example, I am using RGBY utility colors and a transparent color. There is also a commented out 4-color GB palette that I like:


  -- sepia palette
  pal(0,0,1)
  pal(1,128,1)
  pal(2,130,1)
  pal(3,133,1)
  pal(4,141,1)
  pal(5,4,1)
  pal(6,142,1)
  pal(7,14,1)
  pal(8,143,1)
  pal(9,15,1)
  pal(10,7,1)
  -- rgby utility
  pal(11,8,1)
  pal(12,139,1)
  pal(13,12,1)
  pal(14,10,1)
  -- 4-color gb palette
    -- pal(12,131,1)
    -- pal(13,139,1)
    -- pal(14,138,1)
    -- pal(15,135,1)
  -- transparent
  pal(15,1,1)
  palt(0,false)
  palt(15,true)

The cart animation is just an attempt to "demo" the palette in under 1024 compressed bytes (#Pico1k 2022 jam).

Here's the full cart code:



function _init()

  -- sepia palette
  pal(0,0,1)
  pal(1,128,1)
  pal(2,130,1)
  pal(3,133,1)
  pal(4,141,1)
  pal(5,4,1)
  pal(6,142,1)
  pal(7,14,1)
  pal(8,143,1)
  pal(9,15,1)
  pal(10,7,1)
  -- rgby utility
  pal(11,8,1)
  pal(12,139,1)
  pal(13,12,1)
  pal(14,10,1)
  -- 4-color gb palette
    -- pal(12,131,1)
    -- pal(13,139,1)
    -- pal(14,138,1)
    -- pal(15,135,1)
  -- transparent
  pal(15,1,1)
  palt(0,false)
  palt(15,true)

  -- display
  cls(0)
  mode=rint(1,2) -- 1 or 2, grow or shrink
  bars={}
end

function _update60()
  dobars()
  dcpu()
  dmem()
  dbars()
end

function dobars()
  if btnp(0) or btnp(3) or btnp(4) then mode=2 end
  if btnp(1) or btnp(2) or btnp(5) then mode=1 end
  if rint(1,mode)==1 then
    local d='v'
    if rint(1,2)==1 then d='h' end
    add(bars,newbar(d))
  end
  for k,v in pairs(bars) do
    drawbar(v)
    if mode==2 then
      v.s=v.s-1
      if v.s==0 then del(bars,bars[k]) end
    else
      v.s=v.s+1
      if v.s>40 then del(bars,bars[k]) end
    end
  end
end

-- d='v' or 'h'
function newbar(d)
  local smin=10
  local smax=40
  if mode==1 then
    smin=2
    smax=10
  end
  local b={
    x=rint(0,127),
    y=rint(0,127),
    s=rint(smin,smax),
    d=d
  }
  return b
end

function drawbar(bar)
  if bar.d=='h' then lineh(bar.x,bar.y,bar.s) end
  if bar.d=='v' then linev(bar.x,bar.y,bar.s) end
end

function linev(x,y,s)
  local sx=flr(x-s/2)
  for i=0,flr(s/2) do
    local c=i
    if c>10 then c=10 end
    line(sx+i,0,sx+i,127,c)
  end
  sx=flr(x+s/2)
  for i=0,flr(s/2) do
    local c=i
    if c>10 then c=10 end
    line(sx-i,0,sx-i,127,c)
  end
end

function lineh(x,y,s)
  local sy=flr(y-s/2)
  for i=0,flr(s/2) do
    local c=i
    if c>10 then c=10 end
    line(0,sy+i,127,sy+i,c)
  end
  sy=flr(y+s/2)
  for i=0,flr(s/2) do
    local c=i
    if c>10 then c=10 end
    line(0,sy-i,127,sy-i,c)
  end
end

function dcpu()
  bprint('cpu: '..stat(1),0,123-12,14,0)
end

function dmem()
  bprint('mem: '..stat(0),0,123-6,13,0)
end

function dbars()
  local nbars=#bars
  if nbars<10 then nbars='0'..nbars end
  bprint('bars: n='..nbars..' m='..mode,0,123,12,0)
end

-- o=outline color (or nil)
-- set x to -1 to auto center on screen
function bprint(v,x,y,c,o)
  if x==-1 then
    x=flr(64-(#v*4)/2)
  end
  if o~=nil then
    for sx=-1,1 do
      for sy=-1,1 do
        print(v,x+sx,y+sy,o)
      end
    end
  end
  print(v,x,y,c)
end

-- inclusive
function rint(min,max)
  return flr(rnd()*(max-min+1))+min;
end

Leave a comment

Log in with itch.io to leave a comment.